Fork me on GitHub

Alex Rupérez

Link: http://j.mp/2IiYRPb
Published: 14 May 10:01
I starred ConradoMateu/JSwift at GitHub.
Easily conversion of JSON into Codable Structs supported by Swift 4
View on GitHub


View README


drawing

Build Status

Easily conversion of JSON into Codable Structs supported by Swift 4

Requirements

  • macOS 10.13+
  • Xcode 8.3+
  • Swift 4.0+

Installation

Download the App

  • Download JSwift's last release

XCodeExtesion

  • Run the app, then quit. Do not delete the App
  • Go to System Preferences -> Extensions -> Xcode Source Editor and enable the JSwiftExtension extension
  • Menu items should now be available from Xcode's Editor menu

Soon available in App Store 🙌

Manual

  • Clone or download the repo
  • Run pod install
  • Open JSwift.xcworkspace
  • Enable target signing for both the Application and the Source Code Extension using your own developer ID

XCodeExtesion

  • Select the application target and then Product > Archive
  • Export the archive as a macOS App
  • Run the app, then quit. Do not delete the App
  • Go to System Preferences -> Extensions -> Xcode Source Editor and enable the JSwiftExtension
  • The menu item should now be available from Xcode's Editor menu

Usage

User Interface

Paste your JSON or open a JSON file:

Alt Text

Extension

Selecting JSON using XCode:

Alt Text

Using copied JSON from your Clipboard:

Alt Text

Once you have your codable structs created, you can easily retrieve data using:

let url = URL(string: "http://yourjsonurl.com")
let task = URLSession.shared.dataTask(with: url!) { (data, response, error) in
	let response = try JSONDecoder().decode(Main.self, from: data!)
}
task.resume()

Features

  • Codable Alamofire Support
  • Cocopods Library
  • Swift Dictionary Mapping Support

Credits

Thanks to my friend Seb Holt for doing JSwift's logo

License

JSwift is released under the MIT license. See LICENSE for details.