Decodable Simple and strict, yet powerful object mapping made possible by Swift 2's error handling.

Related tags

JSON swift json
Overview

Decodable

Simple and strict, yet powerful object mapping made possible by Swift 2's error handling. Greatly inspired by Argo, but without a bizillion functional operators.

Carthage compatible Cocoapods version Platforms Travis

Repository { return try Repository( name: j => "nested" => "name", description: j => "description", stargazersCount: j => "stargazers_count", language: j => "language", sometimesMissingKey: j =>? "sometimesMissingKey", owner: j => "owner", defaultBranch: Branch(name: j => "default_branch") ) } } do { let json = try NSJSONSerialization.JSONObjectWithData(data, options: []) let repo = try [Repository].decode(json) } catch { print(error) } ">
struct Repository {
    let name: String
    let description: String
    let stargazersCount: Int
    let language: String?
    let sometimesMissingKey: String?
    
    let owner: User // Struct conforming to Decodable
    let defaultBranch: Branch // Struct NOT conforming to Decodable
    
    var fullName: String { return "\(owner.login)/\(name)" }
}

extension Repository: Decodable {
    static func decode(j: Any) throws -> Repository {
        return try Repository(
                    name: j => "nested" => "name", 
                    description: j => "description", 
                    stargazersCount: j => "stargazers_count", 
                    language: j => "language", 
                    sometimesMissingKey: j =>? "sometimesMissingKey",
                    owner: j => "owner", 
                    defaultBranch: Branch(name: j => "default_branch")
                )
    }
}

do {
    let json = try NSJSONSerialization.JSONObjectWithData(data, options: [])
    let repo = try [Repository].decode(json)
} catch {
    print(error)
}

How does it work?

A protocol

public protocol Decodable {
    static func decode(json: Any) throws -> Self
}

A parse-function

public func parse<T>(json: Any, path: [String], decode: (Any throws -> T)) throws -> T

And shameless operator-overloading

The too-many generated overloads, all calling the parse-function, can be found in Overloads.swift. Return types include T?, [T?], [T?]?, Any and [String: T]?. When conditional protocol conformance is supported in Swift this won't be necessary, and automagic decoding of infinitly nested generic types (like [[[[[[[[[A???]]: B]]]?]]?]]) would work.

An overload may look like this:

public func => <T: Decodable>(json: Any, keyPath: KeyPath) throws -> T

KeyPaths

Keypaths can be created from string and array literals as well as with explicit initializers. They can also be joined using the operators => and =>?. =>? is another operator that indicates that nil should be returned if the key to the right is missing.

  • When composing => and =>? operators in the same keypath, the strictness of => is still honoured.
  • Optional key paths (=>?) require an optional return type
"b" => "c" let string: String? = json =>? "key1" => "key2" => "key3"` ^^^^ allowed to be missing ">
let a: KeyPath = "a"
let b: KeyPath = ["a", "b"]
let c: KeyPath = "a" => "b" => "c"
let string: String? = json =>? "key1" => "key2" => "key3"`
                                ^^^^ allowed to be missing

Errors

Errors will be caught and rethrown in the decoding process to backpropagate metadata, like the JSON object that failed decoding, the key path to it, and the root JSON object.

From DecodingError.swift:

public enum DecodingError: ErrorProtocol, Equatable {
    /// Thrown when optional casting from `Any` fails.
    ///
    /// This can happen both when trying to access a key on a object
    /// that isn't a `NSDictionary`, and failing to cast a `Castable`
    /// primitive.
    case typeMismatch(expected: Any.Type, actual: Any.Type, Metadata)
    
    /// Thrown when a given, required, key was not found in a dictionary.
    case missingKey(String, Metadata)
    
    /// Thrown from the `RawRepresentable` extension when
    /// `init(rawValue:)` returned `nil`.
    case rawRepresentableInitializationError(rawValue: Any, Metadata)
    
    /// When an error is thrown that isn't `DecodingError`, it 
    /// will be wrapped in `DecodingError.other` in order to also provide
    /// metadata about where the error was thrown.
    case other(ErrorProtocol, Metadata)
}
"object" => "repo" => "owner" => "name" } catch let error { print(error) } // // MissingKeyError at object.repo.owner: name in { // id = 1; // login = anviking; // } ">
let dict: NSDictionary = ["object": ["repo": ["owner": ["id" : 1, "login": "anviking"]]]]

do {
    let username: String = try dict => "object" => "repo" => "owner" => "name"
} catch let error {
    print(error)
}
//
// MissingKeyError at object.repo.owner: name in {
//    id = 1;
//    login = anviking;
// }

Handling Errors

Expressions like j => "key" will throw directly, and catch-statements can be used to create the most complex error handling behaviours. This also means that try? can be used to return nil if anything goes wrong instead of throwing.

For convenience there is an operator, =>?, that only returns nil on missing keys, for APIs that indicate null in that manner, and to aid working with different response formats.

Overload Null Behaviour Missing Key Behavior Type Mismatch Behaviour Errors in subobjects
=> -> T throws throws throws uncaught (throws)
=> -> T? nil throws throws uncaught (throws)
=>? -> T? nil nil throws uncaught (throws)
try? => -> T nil nil nil caught (nil)

Customization

Int, Double,String, Bool, Date (ISO8601), NSArray, and NSDictionary types that conform to DynamicDecodable with the following declaration:

public protocol DynamicDecodable {
    associatedtype DecodedType
    static var decoder: (Any) throws -> DecodedType {get set}
}

This allows Decodable to implement default decoding closures while allowing you to override them as needed.

// Lets extend Bool.decoder so that it accepts certain strings:
Bool.decoder = { json in
    switch json {
    case let str as String where str == "true":
        return true
    case let str as String where str == "false":
        return false
    default:
        return try cast(json)
    }
}

Note that when extending new types to conform to Decodable there is really no point in conforming to DynamicDecodable since you already control the implementation. Also note that the decoder properties are intended as "set once". If you need different behaviour on different occations, please create custom decode functions.

The default Date.decoder uses a ISO8601 date formatter. If you don't want to create your own decode closure there's a helper:

Date.decoder = Date.decoder(using: formatter)

When Decodable isn't enough

Don't be afraid of not conforming to Decodable.

let array = try NSArray.decode(json => "list").map {
    try Contribution(json: $0, repository: repo)
}

Tips

  • You can use Decodable with classes. Just make sure to either call a required initializer on self (e.g self.init) and return Self, or make your class final. ( This might be a problem though)
  • The Decodable-protocol and the =>-operator should in no way make you committed to use them everywhere.

Compatibility

Swift version Compatible tag or branch
Swift 4.0 0.6.0
Swift 3.0 v0.5
Swift 2.3 v0.4.4
Swift 2.2 v0.4.3

Note on Swift 4.0 usage

Due to collisions with the standard library you will have to import ambiguous symbols specifically, in addition to Decodable as a whole.

This means you likely want the following

import Decodable
import protocol Decodable.Decodable

and you can import other symbols, e.g KeyPath, DecodingError, in a simlilar fashion (using import struct and import enum)

Comments
  • Experiment: Fix(?) keypaths and add `decode` overloads on `NSDictionary`

    Experiment: Fix(?) keypaths and add `decode` overloads on `NSDictionary`

    Adds overloads of the following form:

    extension NSDictionary {
        public func decode <A: Decodable>(_ keyPath: String...) throws -> A { ... }
    }
    

    Which enables the following usage:

    let _: String = dict.decode("a", "b")
    let _: String? = dict.decode("a", OptionalKey("b"))
    

    With the side effects of making the OptionalKeyPath/KeyPath slightly more complex and with changes to default behaviours:

    // OptionalKeys created from string literals have isRequired = true
    let a1: OptionalKeyPath = ["a", "b"] // a.b
    
    // OptionalKeys created with explicit initialiser have isRequired = false
    let a2: OptionalKeyPath = ["a", OptionalKey("b")] // a.b?
    

    I thought about adding a .optional property on String instead of OptionalKey("key"), but thought it was too vague.

    This would fix #26, while maintaining the following features:

    • Keys that are allowed to be missing have to be explicitly (and individually) marked
    • No wrapping JSON type
    • Previous syntax still works

    I'm not at all sold on this yet however. Some rambling thoughts:

    • The operator way and non-operator way cannot presumably live side by side forever
    • When dealing with dictionaries disguised as AnyObjects this adds verbosity
    • When dealing with optional keys this adds verbosity and removes the illusion that => works like a subscript, and the added ? in =>? works like in optional chaining. Though perhaps this is for the best because the implementation is made simpler, fixes one edge cases where the first key(s) are required where the latter are optional, and because this is how Decodable actually works.

    Also in the future OptionalKey could add functionality to distinguish between accepting NSNull and accepting missing keys, a small but useful feature.

    TODO:

    • Fix documentation
    • Think about it for a while
    opened by Anviking 9
  • Does Decodable only work with structs?

    Does Decodable only work with structs?

    I'm trying to use Decodable to create Realm objects, but I'm having issues. Then I realized all the examples were structs — does Decodable not work with classes?

    opened by kylebshr 8
  • Missing keys and optionals

    Missing keys and optionals

    Hi,

    What is the best practice for missing keys? I find it strange (I'm sure I'm wrong here) that the decoding process fails when it founds a missing key and this property is marked as Optional. Is it normal for API responses to not include all the information in their entities for every single call?

    I am trying to consume an "index" action that returns some data about the model and a "show" action that shows all the data, but since the "index" is a trimmed down version of the "show" it always fails.

    opened by raulriera 6
  • Decode top level array into object's property

    Decode top level array into object's property

    Hi,

    I'm getting an array of JSON objects as a response from my API. To keep my sanity, I'm trying to deal with deserialized objects only, and not have lists of objects in there as well. For that I tried wrapping the API response into another object that looks something like this:

    struct Campus {
        let buildings: [Building]
    }
    
    extension Campus: Decodable {
        static func decode(_ json: AnyObject) throws -> Campus {
            return try Campus(
                buildings: json => ""
            )
        }
    }
    

    Just supplying "" as the key doesn't seem to be working however. Is there a way I can tell Decodable to deserialize the top-level array I'm getting back into the buildings property?

    The JSON structure looks something like this for reference:

    [
        {
            "name": "Building1"
            ...
        },
        {
            "name": "Building2"
            ...
        },
        ...
    ]
    
    opened by kiliankoe 5
  • Anviking should weigh in on Swift Archival and Serialization proposal

    Anviking should weigh in on Swift Archival and Serialization proposal

    I'm not sure if you have seen this, but there's a proposal in the works for Shelocking Decodable:

    https://github.com/itaiferber/swift-evolution/blob/637532e2abcbdb9861e424359bb6dac99dc6b638/proposals/XXXX-swift-archival-serialization.md

    Not that it's a bad thing, I think that an official way to do what we are doing here would be great, but I also like how Decodable works.

    If you haven't already, perhaps take a moment (ok, a long moment) to read over the proposal and bring up any issues you have, no doubt, run into on the journey of creating this software that they may be missing solutions for.

    thoughts wanted 
    opened by voidref 4
  • Does `=>?` actually work as intended?

    Does `=>?` actually work as intended?

    I can’t figure out for the life of me why the following does not work:

    struct Foo: Decodable {
        let bar: String?
    
        static func decode(object: AnyObject) throws -> Foo {
            return try Foo(bar: object =>? "bar")
        }
    }
    

    When parsing the following JSON:

    {
      "bar": null
    }
    

    I would expect decode to not throw, and instead return Foo(bar: nil). What happens instead, is MissingKeyError(key: "bar").

    opened by irace 4
  • Getting a

    Getting a "ResponseObject"

    This library is great, I've been using it with some of my structs and it I dig it. How can I use this to return "JSON Objects", i.e. a raw JSON object?

    opened by damianesteban 4
  • Operators that return T? should return nil when the key path is missing

    Operators that return T? should return nil when the key path is missing

    Currently the => operators that return T?, [T]?, etc. will throw a .MissingKey if the key path is missing. For JSON not having a field be available is usually the same as having it explicitly be null. Right now the documentation suggests try? for cases like this, but then you will swallow .TypeMismatch errors.

    I recommend that either the => operators that return a nil also do so on .MissingKey, or a new set of operators, such as =>?, be introduced. The type already states that it's valid for it to not exist (the point of an Optional in my mind) and .MissingKey matches that.

    opened by brentleyjones 4
  • TypeMismatch NSTaggedPointerString when some attributes are not set to String

    TypeMismatch NSTaggedPointerString when some attributes are not set to String

    Hi There! I'm really liking your library. I'm currently attempting to decode responses I get from Alamofire's responseJSON serializer but I'm encountering issues. Here's a print out of the JSON response. It looks as expected:

    Optional({
        id = 173722;
        token = 9eea351ff15d43d1609145eb699412cc4297b58d173722;
        user =     {
            "activities_total" = 12780;
            avatar = "https://stagingsite.s3.amazonaws.com/avatars/[email protected]";
            "avatar_lg" = "https://stagingsite.s3.amazonaws.com/avatars/173722orig.jpeg";
            "competitions_on" = 1;
            converter = 1;
            "first_name" = "";
            gender = Male;
            "giveaway_points_on" = 1;
            "goal_enforced" = 0;
            "inception_date" = "2015-07-27 11:44:11";
            "last_name" = "";
            "last_visit" = "2015-10-02 11:26:04";
            level = 2;
            "levels_and_points" = 1;
            logo = "https://stagingsite.s3.amazonaws.com/logos/saZIvy_mountain-2.jpg";
            "mobilehealth_allowed" = 1;
            "number_of_entries" = 22;
            "pedometer_image" = "https://api.stagingsite.com/_views/images/devices/googlefit32.png";
            "pedometer_last_contact" = 1441394474;
            "pedometer_name" = Googlefit;
            "pedometer_type" = "Google Fit";
            points = 270;
            "points_granted" = 0;
            "points_to_grant" = 36;
            "program_end" = "2017-01-31";
            "program_start" = "2013-10-01";
            "step_average" = 4155;
            "step_goal" = 8000;
            "step_goal_met" = 0;
            "step_total" = 78628;
            "stride_length" = 0;
            "teams_on" = 1;
            "this_device" = "app_name/com. appname.app-name (1; os version 9.0 (build 13a340))";
            "total_privacy" = 0;
            units = Miles;
            url = "beta.stagingsite.com";
            username = somerusername;
        };
        username = someusername;
    })
    

    Then I have a struct for a UserSession and a User. The issue is that sometimes I'll get an error on attributes that are not set to be a String. For example, several of these attributes should be Bool's or Ints. In some cases this works fine. For example these attributes parse correctly:

    struct User {
        ...
        var competitionsOn: Int
        var giveawayPointsOn: Bool
        var mobilehealthAllowed: Int
        ...
    }
    

    But every so often one of the attributes throws this error:

    TypeMismatch NSTaggedPointerString, expected: Int in user.number_of_entries object: Optional(22)
    

    The correct value was found (22) but it's showing up as an Optional. Are there any additional steps I should take when parsing values to describe or cast their type? I currently am just using the most basic implementation per the examples:

    numberOfEntries: j => "number_of_entries",
    

    In any case -- adjusting the attribute type to a String resolves the parsing error but that is not ideal.

    opened by jimjeffers 4
  • Missing typical optional/nullable operator

    Missing typical optional/nullable operator

    Hi! Nice library. We're using Argo now and going to try this one out as a possible replacement.

    One problem I'm noticing though, is that there doesn't seem to be support for regular nullable functionality. You have 2 nullable (?) operators but neither do what I would expect.

    The only nullable operator (for setting an optional var) one would typically need would result in 3 cases:

    1. return the object if decode succeeds
    2. return nil if the key does not exist
    3. return an error if the key exists but decoding fails (ie the JSON object is corrupt/unexpected)

    This project does not satisfy case 3 and instead returns nil as well instead of an error(at least according to the documentation).

    In addition, there is the array '?' operator which weeds out objects that failed to decode but in general I think it should follow the same pattern as above (with no partial successes). Allowing a partial success should probably be a special case with its own operator if at all, because in general this would be the result of developer error (unless you are depending on an unstable API).

    tl:dr Should this library provide a way to decode an array or custom object in a failable/throwable way which satisfies the 3 above conditions?

    Just some thoughts, what do you think?

    opened by DimaVartanian 4
  • (Help) Adaptive mapping for arrays in model when JSon return single object instead array.

    (Help) Adaptive mapping for arrays in model when JSon return single object instead array.

    Hi, need some help please. :)

    I have to work with a restService that when needed to return an array that contains 1 object it will remove the brackets leaving the json to be a single object instead of an array containing 1 object as it saves on characters we send over the internet.

    example model:

    Struct example { var names: [String] }

    if I get a json back that is for example return 1 name i get { "names": "Donnald" }

    and if the json returned as multiple names then I get

    { "names":["Donald", "Daffy", "Neptune"] }

    From what I read in the info is that this will create a mismatch or I can get a nil using "try? => -> T"

    I need to change this so that instead of a nil or a throw it will try to fit the value as to imbed the single value in a array in this way resolving the problem.. same could be done for a number that should be a string or the other way around. some data types can be fitted or adapted and I need the mapping to be able to account for the "inconsistent" result I get with the restService I have to work with.

    Thanks for the help :)

    opened by nissaba 3
  • Ambigous operator => xcode 13

    Ambigous operator => xcode 13

    Hi, I tried running decodable on xcode 13 and getting error wherever kepath operators being used => showing error Ambigous operator. How to solve this.

    opened by dash-1234 2
  • While profiling app , it fails .

    While profiling app , it fails .

    Fails with No Such module as Decodable. But when I run it installs fine and can distribute the app to appstore too. import protocol Decodable.Decodable <- Error

    opened by Ankish 1
  • [WIP] Unification with Codable

    [WIP] Unification with Codable

    This is an experiment to see what happens when we remove all existing functionality and rely on Swift 4's Codable instead.

    • [x] Remove all existing functionality
    • [x] Create a few overloads (this initial implementation is likely suboptimal complete nonsense though)
    • [ ] Update tests
    • [ ] Investigate how different use-cases of e.g DynamicDecodable would be translated (subclassing JSONDecoder?)
    opened by Anviking 0
  • Unable to

    Unable to "ignore" an element. Instead it always throws

    I have an array of dictionaries, each with a "Type" field that is used to determine which struct should be used for decoding it. Currently I have some unsupported types. I would like to just ignore those and keep parsing the rest of the array instead of throwing an error and cancelling the whole parsing operation at one point. I also don't want to end up with a dummy object just for the sole purpose of returning a non-nil object in the decode function.

    Is there anyway to do that with the latest version?

    opened by mdonati 1
Releases(0.6.0)
  • 0.6.0(Sep 29, 2017)

    This release contains no other changes than updated project settings to target Swift 4.

    Coming from earlier versions you will be faced with errors like 'Decodable' is ambiguous for type lookup in this context. Unfortunately you have to use the following import-syntax to get around it:

    import protocol Decodable.Decodable
    

    where you can also import other structs and enums as required.

    Source code(tar.gz)
    Source code(zip)
  • v0.5.1(Oct 2, 2017)

    This release mainly contains the following changes:

    • #127 URL is DynamicDecodable and Decodable
    • #131 Fix for SPM
    • #126 Updated documentation comments
    Source code(tar.gz)
    Source code(zip)
  • v0.5(Sep 12, 2016)

    Some significant changes:

    • #108 Every default implementation of Decodable can be overridden
    • #79 Errors are once again enums
    • #117 Any instead of AnyObject
    • #101, #99 New KeyPath ad OptionalKeyPath structs.

    Please see v0.5.0 migration guide and the new readme for more information.

    Source code(tar.gz)
    Source code(zip)
  • v0.4.4(Jul 9, 2016)

    • Project settings upgraded to support Xcode 8 with legacy Swift 2.3 support.

    Note: Unsure if this works with Xcode 7 or if you explicitly have to target v0.4.3. And if you've clicked on the releases page and wonder where the Swift 3 support is, it's on the master branch. Stable releases are coming.

    Source code(tar.gz)
    Source code(zip)
  • v0.4.3(Jun 15, 2016)

    This is the final planned Swift 2 release

    • Added decodeOneOf and decodeArrayAsOneOf (Thanks @Qata! #84)
    • Readme tweaks
    • Minor test coverage improvements
    Source code(tar.gz)
    Source code(zip)
  • v0.4.2(Mar 22, 2016)

    • Code generation = more overloads
    • Removed use of currying, so no more warnings about that
    • #78 More safe NSNumber decoding (Thanks @bdolman!)
    Source code(tar.gz)
    Source code(zip)
  • v0.4.1(Jan 23, 2016)

    • =>? now accepts null as it was intended to
    • receivedType typo fix (Thanks @JaviSoto!)
    • RawRepresentableInitializationError not RawRepresentableInitializationFailure
    Source code(tar.gz)
    Source code(zip)
  • v0.4(Jan 16, 2016)

    • Added NSValueCastable protocol for decoding [U]Int8, [U]Int16
    • (Re)added =>?, this time only for accepting TypeMismatches.
    • Errors are now structs conforming to DecodingError
    Source code(tar.gz)
    Source code(zip)
  • v0.3.4(Dec 16, 2015)

    • Added support for Dictionary decoding. Added => overloads returning [String: T], [String: T]? and [Decodable: AnyObject]?
    • Extension for NSArray
    • Added [T?]?-returning overload
    • Support for Swift Package Manager (#54 @neonichu)
    • Explicit deployment target for tvOS and watchOS (#55 @NachoSoto)
    Source code(tar.gz)
    Source code(zip)
  • v0.3.3(Oct 26, 2015)

    • =>? operator is removed, use either [T].decode(json, ignoreInvalidObjects: true) or try? json => "key"
    • => overload without inferred return-type will no longer be decoded as NSDictionary. It now returns AnyObject instead (no decoding at all).
    • Fixes the semiserious #34
    • A lot of target/platform/bitcode changes contributed by a lot of nice people. WatchOS, tvOS, and iOS should be supported with bitcode and Mac, as before, without it. However all of them should now work with CocoaPods.
    Source code(tar.gz)
    Source code(zip)
  • v0.3.2(Sep 14, 2015)

  • v0.3.1(Aug 16, 2015)

    • Fixed ignoredInvalidObjects typo in Array extension
    • Marked the T? returning overloads as throwing. However they will catch a NSNull TypeMismatch error.
    • Made catchNull and catchAll functions public
    • Added completely non-throwing =>?overload returning T?
    • Made improvements on how the error path is calculated in nested objects (try and preserve it from the very root object)
    • Various minor changes
    Source code(tar.gz)
    Source code(zip)
  • v0.3(Aug 14, 2015)

    • Use \u{0}-separated string for JSONPaths. This reduces the number of overloads needed. In the future this will make it easier to test and add new overloads with more return-types like T, T?, [T]...
    let a = json => "key1" => "key2" => "key3" // is equivlent to
    let a = json => "key1\u{0}key2\u{0}key3"
    // NOTE: Never actually do this, the character or implementation details might change.
    
    • Removed DecodableArray<T> and NilFilteringArray<T>. Use either:
    [T].decode(object, ignoreInvalidObject: false)
    // or 
    decodeArray(ignoreInvalidObjects: false)(json: object)
    
    • Added public parse()-function. This is what all the =>-overloads are calling.
    public func parse<T>(json: AnyObject, path: [String], decode: (AnyObject throws -> T)) throws -> T {
    
    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Aug 10, 2015)

  • v0.2(Jul 19, 2015)

    • Error Paths!
    • More complicated implementation
    • Possible to have [String: Castable] or [String: AnyObject] as final return type.
    • Right associativity (implementation detail, should not affect the basic use-cases)
    // j => ("a" => ("b" => "c"))
    
    Source code(tar.gz)
    Source code(zip)
  • v0.1(Jul 17, 2015)

    • Simple and straightforward first implementation
    • String, Int, Double, Bool, Dictionary
    • T, T?, [T], [T]?
    • Left associativity
    // ((j => "a") => "b") => "c"
    
    Source code(tar.gz)
    Source code(zip)
Owner
Johannes Lund
Johannes Lund
Reflection based (Dictionary, CKRecord, NSManagedObject, Realm, JSON and XML) object mapping with extensions for Alamofire and Moya with RxSwift or ReactiveSwift

EVReflection General information At this moment the master branch is tested with Swift 4.2 and 5.0 beta If you want to continue using EVReflection in

Edwin Vermeer 964 Dec 14, 2022
This framework implements a strict JSON parser and generator in Objective-C.

SBJson 5 Chunk-based JSON parsing and generation in Objective-C. Overview SBJson's number one feature is stream/chunk-based operation. Feed the parser

null 3.8k Jan 5, 2023
An extension for Alamofire that converts JSON data into Decodable objects.

Swift 4 introduces a new Codable protocol that lets you serialize and deserialize custom data types without writing any special code and without havin

Nikita Ermolenko 749 Dec 5, 2022
XcodeJSONValidator - XcodeJSONValidator is your script to to check for possible wrongly formed JSON files

XcodeJSONValidator XcodeJSONValidator is your script to to check for possible wr

Ivo Teixeira 3 Feb 13, 2022
Property mapping for Objective-C iOS apps.

Stop repeating your data parsing code in iOS apps. Data parsing is one of most common tasks we need to do in our apps, yet still majority of people do

Krzysztof Zabłocki 1.1k Sep 8, 2022
Easy JSON to NSObject mapping using Cocoa's key value coding (KVC)

#Motis Object Mapping Easy JSON to NSObject mapping using Cocoa's key value coding (KVC) Motis is a user-friendly interface with Key Value Coding that

Mobile Jazz 249 Jun 29, 2022
A library to turn dictionary into object and vice versa for iOS. Designed for speed!

WAMapping Developed and Maintained by ipodishima Founder & CTO at Wasappli Inc. Sponsored by Wisembly A fast mapper from JSON to NSObject Fast Simple

null 8 Nov 20, 2022
JSON object with Swift

JSON JSON using @dynamicMemberLookup, which allows us to write more natural code

Jewelz Hu 0 Dec 17, 2021
Dogtector: dog breed detection app for iOS using YOLOv5 model combined with Metal based object decoder optimized

Dogtector Project description Dogtector is dog breed detection app for iOS using YOLOv5 model combined with Metal based object decoder optimized for u

Bartłomiej Pluta 21 Aug 1, 2022
Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable

Elevate is a JSON parsing framework that leverages Swift to make parsing simple, reliable and composable. Elevate should no longer be used for

Nike Inc. 611 Oct 23, 2022
Simple and Elegant Range(A,B) to Range(P,Q) mapper in less then five lines of code.

HSRange Description HSRangeConvertor Simple and Elegant Range[A,B] to Range[P,Q] mapper in less then three lines of code. E.g. Suppose we have Range[1

Hitendra Hckr 10 Sep 29, 2021
An extremely simple JSON helper written in Swift.

Alexander Alexander is an extremely simple JSON helper written in Swift. It brings type safety and Foundation helpers to the cumbersome task of JSON u

HODINKEE 36 Sep 15, 2022
Simple service locator infrastructure for swift

ServiceLocator Simple service locator infrastructure. Pass around protocols backed by these locators to your view controllers and coordinators to simp

CoreSwift 3 Feb 14, 2022
A Simple Alert For Swift

JoeSimpleAlert Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation Joe

null 0 Nov 30, 2021
A simple solution to show a toast message by writing single one line of code

easySwiftToast A very simple solution to show a toast message by writing single one line of code. Installation easySwiftToast is available through Coc

wajeehulhassan 7 May 13, 2022
A simple educational application for the game Connect Four for two players

Connect4Game A simple educational application for the game Connect Four for two players. The algorithm checks the match of 4 tiles horizontally, verti

NIKOLAY NIKITIN 0 Oct 20, 2022
Simple implementation of asset management app UI using swiftUI

MyAssets (자산관리 앱 만들기) swiftUI를 이용하여 자산관리 앱 UI를 간략하게 구현 (swiftUI를 익히기 위함) 초기 화면 1. Tab bar 구현 자산, 추천, 알람, 설정 탭 구현 2. Navigation bar 구현 1) leading에 titl

null 0 Dec 9, 2021
A protocol to serialize Swift structs and classes for encoding and decoding.

Serpent (previously known as Serializable) is a framework made for creating model objects or structs that can be easily serialized and deserialized fr

Nodes - iOS 287 Nov 11, 2022
A fast, convenient and nonintrusive conversion framework between JSON and model. Your model class doesn't need to extend any base class. You don't need to modify any model file.

MJExtension A fast, convenient and nonintrusive conversion framework between JSON and model. 转换速度快、使用简单方便的字典转模型框架 ?? ✍??Release Notes: more details Co

M了个J 8.5k Jan 3, 2023