Piepants Piepants - 24 days ago 10
Swift Question

XCode 9: Module compiled with Swift 3.0.2 cannot be imported in Swift 3.2

I'm trying to build a project using Realm which is installed using pods. I've done this:

1) Updated to XCode 9
2) Run "pod update". Note the podfile has SWIFT_VERSION set to 3.2
3) Checked in XCode settings that Swift Language version is set to 3.2
for all the projects and targets.
4) Deleted derived data
5) Cleaned everything
6) Quit and re-launched XCode
7) Rebuilt everything, including explicitly rebuilding the Realm targets


Despite everything being set to Swift 3.2, despite cleaning everything, despite deleted derived data, despite rebuilding everything. Still I keep getting this error:


"Module compiled with Swift 3.0.2 cannot be imported in Swift 3.2".


It is saying this for the RealmSwift library.

Why, when the RealmSwift target is set to 3.2, and it has been rebuild, why why why is it still saying its 3.0.2?

Answer Source

Try this:

  1. Remove RealmSwift from your pod file
  2. Run pod update
  3. Re-add RealmSwift to your pod file
  4. Run pod update
  5. Clean your project
  6. Build and run