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:
But if you notice, The last UIButton don't have error. What do you think seems to be the problem?
-
2have you imported UIKit to your file?dirtydanee– dirtydanee2015-10-14 08:23:19 +00:00Commented Oct 14, 2015 at 8:23
-
@LEVISOGCPAS where did you import it?Andrey Chernukha– Andrey Chernukha2015-10-14 08:26:22 +00:00Commented 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.LEVIS OGCPAS– LEVIS OGCPAS2015-10-14 08:30:07 +00:00Commented Oct 14, 2015 at 8:30
Add a comment
|
3 Answers
Put #import <UIKit/UIKit.h> or @import UIKit; at the very top of the .h file where you get these errors
2 Comments
dirtydanee
it should be in the .h, because that is also using a UIView value.
LEVIS OGCPAS
Jeez! I can't believe i missed that. Thanks!
Otherwise if you are using both combination (Objective-C & Swift) means you need to add bridging header.
1 Comment
Marmoy
Combined this with @Andrey's answer to fix my issue in a mixed Swift/Objective-c project