13

How do I use SwiftyJSON with Swift3? I've installed the pod.

pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :branch => 'swift3'

But it throws a lot of errors using Xcode 8 GM.

Can someone help me install it properly?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Inna Black
  • 251
  • 3
  • 9

3 Answers3

27

Update: as Marcus notes, SwiftyJSON now supports Swift 3. In order to get bug fixes, I recommend not pinning yourself to 3.0.0, but rather:

pod 'SwiftyJSON', '>= 3.0.0'

…or if you don’t want to accidentally pick up whatever API-breaking changes may arrive in 4.x:

pod 'SwiftyJSON', '~> 3.0'

[Old answer] There is an actively maintained fork that works:

pod 'SwiftyJSON', git: 'https://github.com/BaiduHiDeviOS/SwiftyJSON.git', branch: 'swift3'

Hopefully the project maintainers merge it. Until then, you can just use the fork.

Paul Cantrell
  • 9,175
  • 2
  • 40
  • 48
  • You're awesome, my lorde. Thank you very much – M090009 Sep 17 '16 at 16:14
  • Trying to build via Carthage didn't work for me, but I pulled this code on its own from their Github, and it works fine! Thank you for posting this! – dokun1 Sep 18 '16 at 15:37
7

SwiftyJSON now supports Swift 3.

pod 'SwiftyJSON', '3.0.0'

Marcus Leon
  • 55,199
  • 118
  • 297
  • 429
0

Please try this. I had a trouble for days. And this solve the issue for me.

pod 'SwiftyJSON', '3.1.4'
Alf Bae
  • 546
  • 6
  • 10
  • There's no need to post a new answer every time the version changes. Existing answers already show how to update the repository version. – Eric Aya Mar 01 '17 at 13:54