ios - Unable to use both Swift and Obj-C libs with Cocoapods -


i have started new swift project , use different libraries. in particular, use realm.io, obj-c library. but, use pure swift libraries such alamofire or dollar.

i use cocoapods managing dependencies. use latest version (0.37.0) , new use_frameworks! flag. pod install successful anytime.

unfortunately, when try build project 2 errors (for main target):

  • umbrella header realm.h not found module.modulemap
  • could not build objective-c module realm file using import realm

other imports work fine.

i have noticed following: if remove pure swift libs , use_frameworks, works fine. aware this current issue cocoapods. however, should not problem realm asks developers use flag.

here podfile:

platform :ios, '8.0' use_frameworks!  target 'rothrock'   pod 'realm'   pod 'cent'   pod 'swiftyjson'   pod 'alamofire' end  target 'rothrocktests', :exclusive => true end 

i use no bridging header. should i?

any idea or workaround?

alright, here full walkthrough:

  1. install dependencies using cocoapods , use_frameworks! flag.
  2. as need use objective-c dependency, create bridging header. can create 1 importing objective-c class swift project, remove (the wizard should ask if need bridging header). otherwise, create new header file. then, navigate target configuration , enter name of file in swift compiler - code generation > objective-c bridging header.
  3. still in target configuration, add new entry in search paths > user header search paths: pods value , flag recursive.
  4. remove import instruction code, relative objective-c library.
  5. build project. should have success.