Reputation: 658
I am trying to create a project which uses Realm and RealmSwift. I have used Cocoapods to install these dependencies. I have seen the other posts too on stackoverflow and tried their solutions. They don't work for me. In my project, I'm getting the error "No such module as RealmSwift"
when I write the import RealmSwift
statement. Here are the steps I took for installation:
pod init
command to create a pod fileuse_frameworks!
statementI wrote in pod 'Realm'
and pod 'RealmSwift'
. I gave the sources as:
source 'https://github.com/artsy/Specs.git'
pod install
What am I doing wrong? Or what am I not doing? Is a bridging header required? Has anybody else managed to resolve this error?
Any relevant suggestions or insights are most welcome.
Upvotes: 2
Views: 4296
Reputation: 6251
Need to uncomment platform in your pod file then try once again your pod.
# Uncomment this line to define a global platform for your project
platform :ios, '9.0' // Uncomment this
# Uncomment this line if you're using Swift
use_frameworks!
target 'Demo_Realm' do
pod 'RealmSwift'
end
target 'Demo_RealmTests' do
end
target 'Demo_RealmUITests' do
end
Upvotes: 0
Reputation: 658
Its working now! Its so weird since I didn't do anything. I just went into my pod file commented out the use_frameworks! statement and ran pod update
on the terminal. It gave me an error, so I added it back to my pod file. I wrote in pod update
again and hit enter. I restarted Xcode cleaned it and built it and I wasn't getting this error anymore.
Upvotes: 2