3

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.

Community
  • 1
  • 1

3 Answers3

12

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

  • Check the difference between @import and #import. May explain this. http://stackoverflow.com/questions/18947516/import-vs-import-ios-7 – Jan ATAC Sep 21 '15 at 12:25
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

niklassaers
  • 7,810
  • 18
  • 90
  • 141
  • 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. – Louis Cremen Mar 09 '17 at 01:22
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>
ullstrm
  • 8,862
  • 6
  • 48
  • 80