Latest 1.0.0
Homepage https://github.com/Meniny/DeftEquatable
License MIT
Platforms ios 8.0, osx 10.10, tvos 9.0, watchos 2.0
Frameworks Foundation
Authors




VersionAuthorBuild PassingSwift
PlatformsMIT
CocoapodsCarthageSPM

Introduction

What’s this?

With DeftEquatable, you NEVER implement Equatable manually again.

Installation

CocoaPods

pod 'DeftEquatable'

Contribution

You are welcome to fork and submit pull requests.

License

DeftEquatable is open-sourced software, licensed under the MIT license.

Usage

import DeftEquatable

class MyClass: DeftEquatable {
    let myString: String
    let myInt: Int

    init(myString: String, myInt: Int) {
        self.myString = myString
        self.myInt = myInt
    }
}

class MyClassWithAnotherClass: DeftEquatable {
    let myClass: MyClass

    init(myClass: MyClass) {
        self.myClass = myClass
    }
}

enum GenericEnum: DeftEquatableEnum {
    case one
    case two
}

class MyClassWithGenericEnum: DeftEquatable {
    let myEnum: GenericEnum

    init(myEnum: GenericEnum) {
        self.myEnum = myEnum
    }
}

class MyClassWithArray<T>: DeftEquatable {
    let myArray: [T]

    init(myArray: [T]) {
        self.myArray = myArray
    }
}
let one = MyClass.init(myString: "somethings", myInt: 1)
let two = MyClass.init(myString: "somethings", myInt: 2)

let three = MyClassWithAnotherClass.init(myClass: two)
let four = MyClassWithAnotherClass.init(myClass: two)

let five = MyClassWithGenericEnum.init(myEnum: .one)
let six = MyClassWithGenericEnum.init(myEnum: .two)

let seven = MyClassWithArray<Int>.init(myArray: [1,2,3])
let eight = MyClassWithArray<Int>.init(myArray: [1,2,3])

print(one == two) // false
print(three == four) // true
print(five == six) // false
print(seven == eight) // true

Latest podspec

{
    "name": "DeftEquatable",
    "version": "1.0.0",
    "summary": "Never implement Equatable manually again.",
    "description": "With DeftEquatable, you never implement Equatable manually again.",
    "homepage": "https://github.com/Meniny/DeftEquatable",
    "license": "MIT",
    "authors": {
        "Elias Abel": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Meniny/DeftEquatable.git",
        "tag": "1.0.0"
    },
    "social_media_url": "https://meniny.cn/",
    "platforms": {
        "ios": "8.0",
        "osx": "10.10",
        "tvos": "9.0",
        "watchos": "2.0"
    },
    "source_files": "DeftEquatable/**/*.{h,swift}",
    "public_header_files": "DeftEquatable/**/*{.h}",
    "frameworks": "Foundation",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This