CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

DifferenceRepresentable 0.1.1

DifferenceRepresentable 0.1.1

Maintained by Satoshi Takano.



  • By
  • satoshi-takano

DifferenceRepresentable

Tiny library to detect differences between two instances. For example, you can check whether the users edited their data at some kind of form views before send the changes to your server.

struct User: DifferenceRepresentable {
    let name: String
    let country: String
    let imageUrl: URL?
}

let userA = User(name: "Bob", country: "Japan", imageUrl: URL(string: "https://example.com"))
let userB = User(name: "Bob", country: "United State", imageUrl: nil)
var diff = userA.difference(from: userB)
diff.keys   // ["country", "imageUrl"]
diff.values // ["United State", URL(https://example.com)]

Requirements

  • Xcode 11.x / Swift 5.x
  • iOS 8.0 or later
  • macOS 10.9 or later
  • tvOS 9.0 or later
  • watchOS 2.0 or later

Installation

This library can be installed via Swift Package Manager and CocoaPods

CocoaPods

Insert pod 'DifferenceRepresentable' to your Podfile and run pod install.

License

This library is under the MIT License.