realm-swift: RealmSwift 1.0.2 does not compile with Swift 2.3
Goals
Compile RealmSwift 1.0.2 with the Use Legacy Swift Language Version flag enabled.
Expected Results
I expect it to compiler without any errors.
Actual Results
The following two compilation errors:
.../Pods/RealmSwift/RealmSwift/Realm.swift:1137:18: Use of unresolved identifier 'RLMRealmDidChangeNotification'
.../Pods/RealmSwift/RealmSwift/Realm.swift:1139:18: Use of unresolved identifier 'RLMRealmRefreshRequiredNotification'
Steps to Reproduce
Try to compiler a test project with Swift 2.3 that depends on RealmSwift through Cocoaopds.
Code Sample
Because we are in Swift 2.3, the swift(>=3.0) code is not compiled. But Swift 2.3 requires Realm to reference RLMNotification.DidChange and RLMNotification.RefreshRequired instead of RLMRealmDidChangeNotification and RLMRealmRefreshRequiredNotification.
Version of Realm and Tooling
ProductName: Mac OS X
ProductVersion: 10.11.5
BuildVersion: 15F34
/Applications/Xcode-beta.app/Contents/Developer
Xcode 8.0
Build version 8S174q
/Users/david/.rbenv/shims/pod
1.1.0.beta.1
Realm (1.0.2)
RealmSwift (1.0.2)
RealmSwift (~> 1.0)
/bin/bash
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
/usr/local/bin/carthage
0.14.0
(not in use here)
/usr/bin/git
git version 2.8.4 (Apple Git-73)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (3 by maintainers)
We got Xcode 8 stable version. still facing problem with this issue.
Temporary Xcode 8 installation instructions for Realm Swift using CocoaPods and Carthage:
Xcode 8 Realm Swift Installation Instructions
CocoaPods
Install CocoaPods 0.39.0 or later.
In your Podfile, add
use_frameworks!and the following pods to your main and test targets:Paste the following at the bottom of your Podfile, updating the Swift version if necessary:
From the command line, run
pod install.Use the
.xcworkspacefile generated by CocoaPods to work on your project!Carthage
Install Carthage 0.17.0 or later.
Add
github "realm/realm-cocoa" "master"to your Cartfile.Run
carthage update. To modify the Swift toolchain used to build, specify it via the--toolchainargument. For example:Drag
RealmSwift.frameworkandRealm.frameworkfrom the appropriate platform directory inCarthage/Build/to the “Embedded Binaries” section of your Xcode project’s “General” settings.iOS/tvOS/watchOS: On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following contents:
and add the paths to the frameworks you want to use under “Input Files”, e.g.:
This script works around an App Store submission bug triggered by universal binaries. Make sure this phase is after the “Embed Frameworks” phase.
A release with official support for Xcode 8 is coming tomorrow. See https://github.com/realm/realm-cocoa/issues/3796#issuecomment-247412484 for more information.
Try this:
We intend to have a new release out with full Xcode 8 support sometime this week.
As Swift 2.3 is only available with a prerelease version of Xcode, we’re only supporting it when building from master at this time. Once Xcode 8 and Swift 2.3 are officially released it will be supported in released versions of Realm.
Sorry, just saw this was fixed in
master😃 My bad.