Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using SwiftyJSON with Swift3

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?

like image 544
Inna Black Avatar asked Sep 13 '16 16:09

Inna Black


People also ask

How do I use Alamofire with SwiftyJSON?

Steps to add Alamofire and SwiftyJSON Pods to your project It will create Podfile in your project's directory. Edit the pod file with your pods which you want to use and must remember the targets. Add pods to the particular target where you want to use that pod.


2 Answers

SwiftyJSON now supports Swift 3.

pod 'SwiftyJSON', '3.0.0'

like image 173
Marcus Leon Avatar answered Oct 01 '22 09:10

Marcus Leon


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.

like image 45
Paul Cantrell Avatar answered Oct 01 '22 08:10

Paul Cantrell