Grumme Grumme - 2 months ago 32
Swift Question

Converting from Swift 2.3 to 3.0

I'm trying to migrate my Swift project from Swift 2.3 to Swift 3.0. I'm using the Realm framework for data storage, and it's giving me a headache!

I have tried several times now, and i have manually migrated from Swift 2.2 to Swift 2.3.

But after i used the build in migration assistent, i'm getting the following error.

enter image description here

I can't see which binaries causing the issue this time, but earlier it came up with Realm and RealmSwift framework. I have upgraded the Realm pods to version 1.1.

I have tried Clean Build my folder several times, and i have deleted everthing inside DerivedData, but the same issue still persist.

Any suggestions?

Ryu Ryu
Answer

In your Podfile, add use_frameworks! and pod 'RealmSwift' to your main and test targets. Paste the following at the bottom of your Podfile updating the Swift version to 3.0:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.0'
    end
  end
end

Source: https://realm.io/docs/swift/latest/#installation

Credit for this goes to jpsim.

Comments