Taco
Taco

Reputation: 700

Realm support for Swift 3.0

I was wondering whether it is already possible to use Realm with the beta of Swift 3.0.

Although I see a RealmSwift-swift3.0 directory in in the Realm repo, I do not succeed to use it correctly. How should I install it from source?

Upvotes: 19

Views: 9739

Answers (3)

Bogdan Farca
Bogdan Farca

Reputation: 4096

Starting from version 1.1.0 Realm is officially compatible with Swift 3.0/Xcode 8.0. See here.

This release brings official support for Xcode 8, Swift 2.3 and Swift 3.0. Prebuilt frameworks are now built with Xcode 7.3.1 and Xcode 8.0.

Here's an extract from the install docs :

If using Xcode 8, paste the following at the bottom of your Podfile, updating the Swift version if necessary:

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

Upvotes: 5

Ernesto Fernandez
Ernesto Fernandez

Reputation: 461

Realm released a new version 1.1.0. If you are using Cocoapods suggest you to check this PR and install the version 1.1.0.rc.2 to avoid the compile error Use Legacy Swift Language Version.

Upvotes: 0

Jose L Molina
Jose L Molina

Reputation: 334

You can use Realm with Swift 3.0, but take into account that the current version is still absolutely experimental.

You can clone the master branch of the realm-cocoa repo from GitHub.

Or you can use Carthage:

github "realm/realm-cocoa.git" "master"

Or if you prefer CocoaPods:

pod 'RealmSwift', :git => 'https://github.com/realm/realm-cocoa.git', :branch => 'master'

If you use Carthage, remember that you must add Realm and RealmSwift frameworks manually (ignore the IBAnimatable framework):

Project configuration image

In fact, I have one of my projects with Xcode 8, Swift 3 and Realm, and it works perfectly :)

Upvotes: 19

Related Questions