Latest 0.0.5
Homepage https://github.com/vysotskiyserhiy/NewEquatable
License MIT
Platforms ios 9.0
Authors

Example

// To make struct Equatable by all fields just conform to NewEquatable

struct SomeEasyStruct: NewEquatable {
    let id: String
    let name: String
    let isActive: Bool
    let users: [String]
}

// for class you need to make it final

final class SomeClass: NewEquatable {
    let id: String = "ID"
    let name: String = "SomeClassObject"
    var isActive: Bool = true
}

Compare against custom types

struct A: NewEquatable {
    // you can add comparers for any custom Equatable type like that
    // if you want objects to be comparable with this custom type
    func comparers() -> [(A, A) -> Bool] {
        return [comparer(for: B.self)]
    }

    let id: String
    let date: Date

    // custom property
    let b: B

    struct B: NewEquatable {
        let id: String
        let count: Int
    }
}

Latest podspec

{
    "name": "NewEquatable",
    "version": "0.0.5",
    "summary": "New way of implementing Equatable protocol",
    "homepage": "https://github.com/vysotskiyserhiy/NewEquatable",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Serhiy Vysotskiy": "[email protected]"
    },
    "source": {
        "git": "https://github.com/vysotskiyserhiy/NewEquatable.git",
        "tag": "0.0.5"
    },
    "platforms": {
        "ios": "9.0"
    },
    "swift_version": "4.2",
    "source_files": "NewEquatable/**/*"
}

Pin It on Pinterest

Share This