IOS – Trying to import SwiftyJSON.framework

importios

I am trying to include SwiftyJSON as found here:

https://github.com/SwiftyJSON/SwiftyJSON#initialization

I installed Carthage with homebrew and setup a Cartfile as described on the Carthage github page under the If you're building for iOS heading.

I have the following directory structure:

x/
x/Cartfile
x/Cartfile.resolved
x/Carthage/Build/iOS/SwiftyJSON.framework
x/MyProject/{my Swift code and project}
x/MyProject.xcodeproj
x/MyProjectTests

Here's my project's General -> Linked Frameworks section:

enter image description here

Here's my project's Build Phases -> Run Script section:

enter image description here

If I don't have any code that references JSON then I'm fine. I can build. I can even get the dummy response from my little server providing some json stubbing.

However, as soon as I add let json = JSON(data: swiftObject) I'm in trouble.

No matter what I seem to do I get the following:

enter image description here

I know I must be missing something obvious or completely silly but I'm at my wits end. I haven't been able to find anyone explaining this issue via Google (Or I'm just having a bad day for searching). Can anyone point me toward what I'm probably overlooking or just totally missing?

Best Answer

Looks like you need to import the framework in the swift file where you try to use JSON().

import SwiftyJSON