0
votes

I have integrated RealmSwift framework using carthage dependency tool.

I have followed below steps:

  1. Install Carthage 0.17.0 or later

  2. Add github "realm/realm-cocoa" "master" to your Cartfile.

  3. Run carthage update. To modify the Swift toolchain used to build, specify it via the --toolchain argument. For example:

carthage update --toolchain com.apple.dt.toolchain.Swift_2_3

  1. Drag RealmSwift.framework and Realm.framework from the appropriate platform directory in Carthage/Build/ to the "Embedded Binaries" section of your Xcode project's "General" settings.

  2. 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:

/usr/local/bin/carthage copy-frameworks and add the paths to the frameworks you want to use under “Input Files”, e.g.:

$(SRCROOT)/Carthage/Build/iOS/Realm.framework $(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework

Now,

When i am trying to build my project i got this error:

Module compiled with Swift 3.0 cannot be imported in Swift 2.3 : Carthage/Build/iOS/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule

I can't figure out what's the problem.

1

1 Answers

0
votes

From Installation section in Docs:

The --no-use-binaries argument is also necessary to avoid Carthage pulling the prebuilt Swift 3.0 binaries.

So the command on step 3 should look like

carthage update --toolchain com.apple.dt.toolchain.Swift_2_3 --no-use-binaries

(guessing you use Swift 2.3 in your main project)