0
votes

I just created a new project and download and integrated the CocoaPods "RealmSwift". I get the following list of errors.

enter image description here

I have not added anything in my code. This is coming from Realm code. I am using Xcode 8 using Swift 3.0

Here is the Pod file:

enter image description here

If I say convert to Swift 3.0 then I get the following errors:

enter image description here

1
not sure what the problem could be but it looks like you're setting manually your target's swift version to 2.3. If you're using swift 3 you shouldn't need to do any manual changes in your Podfile - Marin Todorov
I can try again but in the documentation of the Realm for Swift they instructed to do that. - john doe
Check the Swift version you're using on your XCode project. If required the version 3, upgrade it in your Podfile. Sometimes you get errors like this one in Xcode the first time you open it. Run the project and the compiler will work and those errors will disappear. - Orlando
I am using Swift 3.0 on Xcode 8 - john doe
the code you used in your Podfile says '2.3' #or '3.0' - obviously you have to chose the version, which you'd like to use: 2.3 or 3.0 - Marin Todorov

1 Answers

1
votes

It seems the documentation for CocoaPods for RealmSwift may-be out of date when Xcode 8.1+ and Swift 3 is used. Step 3 is no more needed and you should skip it for this case.

i.e. you should now use (example):

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target 'RealmProjectAzam' do

    use_frameworks!
    pod 'RealmSwift'

end

Edit - addition information: Please note, after the above question has been posted, there was some additional discussion incl. Realm and the result is that Realm (thanks @realm!) has adjusted its Swift documentation to better face the above issue. Please see the updated instructions for Cocoapods installation at realm.io

In short, to "solve" the above issue please:

Run pod repo update to make CocoaPods aware of the latest available Realm versions.