Failing to install SwiftyJSON

1.9k Views Asked by At

I want to include SwiftyJSON into my Xcode 6.3 project.

When I try to build it get about 40 compiler errors. Most of them are similar to 'AnyObject' is not convertible to 'String'. Did you mean as! to enforce downcast?

I followed the tutorial steps:

  1. Download SwiftyJSON (https://github.com/SwiftyJSON/SwiftyJSON)
  2. Drag and drop the SwiftyJSON.swift to my Xcode project.
  3. Accepting the "copy if necessary".
  4. Re-build project.

My best guess is that since I'm so new I'm missing some very "obvious" step.

Tutorial used: http://www.raywenderlich.com/82706/working-with-json-in-swift-tutorial

2

There are 2 best solutions below

4
On

You are using Swift 2 but the master version of this framework is for Swift 1.2 (until Swift 2 is out of beta). But you can use the other branch: Download here

EDIT: You actually just need a single file which is right here (Right click on RAW then "Download linked file"). Then you should just be able to drag the downloaded file from the download folder into your project (select "Copy if necessary") and it should be ready to go. I tried it myself and there was just a single deprecation warning.

EDIT: Oh wow I'm so sorry, I totally missed that you were using XCode 6.3. Of course you can't use the XCode 7 branch. here is the XCode 6.3 version of the file

0
On

Your xcode is not updated to the version expected by the swiftyjson library