Skip to content

Opinionated convenience additions to Swift for iOS and macOS.

Notifications You must be signed in to change notification settings

nicoverbruggen/konbini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Konbini

Opinionated convenience methods and helpers for Swift.

JSON

Using the JSON helper, you can easily convert an Encodable type to JSON (as a UTF-8 String) or back. Here's an example:

Encoding:

Note: The String that is returned is encoded using UTF-8. The data we're trying to encode must conform to the Encodable protocol.

let string = JSON.encode([1, 2, 3]) // returns "[1,2,3]"

Decoding

Note: This assumes the String is encoded using UTF-8. The data we're trying to decode must conform to the Decodable type, which must be specified.

let integers = JSON.decode(data, type: [Int].self)

About

Opinionated convenience additions to Swift for iOS and macOS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages