4

I've got a really strange bug with Swift 2. I am using EventKitUI and I am able to display the view controller. When I try to add support for the delegate though I get two build errors:

Cannot find protocol declaration for 'EKEventEditViewDelegate'

Expected a type

The errors are showing in my projects -swift.h (the project mixes Swift and Objective-c).

Any idea why this is happening? Unless I'm missing something I can't see any basic mistakes (typo etc.) that could cause this.

2
  • Hi, could you show how you import EventKit ? Commented Sep 21, 2015 at 10:41
  • import EventKitUI at the top of the file. I also added the framework via the project settings. Commented Sep 21, 2015 at 10:43

3 Answers 3

13

Strange fix but by importing #import <EventKitUI/EventKitUI.h> in my bridging header the issue was resolved.

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

1 Comment

Check the difference between @import and #import. May explain this. stackoverflow.com/questions/18947516/import-vs-import-ios-7
1

For what it's worth, this happens if your protocol includes things that aren't supported in ObjC, such as swift structs. Whenever I get this, I usually find that a structs is a part of something that I was expecting to send back and forth from the protocol

1 Comment

This explains my issues since my imports are correct. There are two functions inside of the delegate that were returning a swift Struct. Thank you.
0

All of a sudden I got this error when using CocoaPods. I fixed it by importing SDWebImage in my Swift bridging header like this:

#import <SDWebImage/SDWebImage-umbrella.h> 

Comments