3

I'm working on a swift project until i needed This "Analog Type Time Picker". I downloaded the repo and tried it using Xcode 6.4 and it works fine. But when I started to transfer it to my project, It ask me to create a Bridging-Header and I created one, Also I imported the .h file in the bridging header. My project can see the delegate method so I think its just fine. But the problem is, the variables on the .m file has an error like this: enter image description here But if you notice, The last UIButton don't have error. What do you think seems to be the problem?

3
  • 2
    have you imported UIKit to your file? Commented Oct 14, 2015 at 8:23
  • @LEVISOGCPAS where did you import it? Commented Oct 14, 2015 at 8:26
  • I imported the objective C project that I downloaded to My Swift Project. Specifically the CustomTimePicker.m and CustomTimePicker.h if you check the link. Commented Oct 14, 2015 at 8:30

3 Answers 3

8

Put #import <UIKit/UIKit.h> or @import UIKit; at the very top of the .h file where you get these errors

Sign up to request clarification or add additional context in comments.

2 Comments

it should be in the .h, because that is also using a UIView value.
Jeez! I can't believe i missed that. Thanks!
2

It clearly looks like you do not imported UIKit. Just add #import <UIKit/UIKit.h> or @import UIKit; to the top of your .h file.

Comments

2

Otherwise if you are using both combination (Objective-C & Swift) means you need to add bridging header.

1 Comment

Combined this with @Andrey's answer to fix my issue in a mixed Swift/Objective-c project

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.