Clean-Swift / CleanStore

A sample iOS app built using the Clean Swift architecture. Clean Swift is Uncle Bob's Clean Architecture applied to iOS and Mac projects. CleanStore demonstrates Clean Swift by implementing the create order use case described by in Uncle Bob's talks.
https://clean-swift.com/clean-swift-ios-architecture/
MIT License
1.91k stars 315 forks source link

Remove unnecessary explicit conformance to Equatable #30

Open sergeysmagleev opened 5 years ago

sergeysmagleev commented 5 years ago

I noticed that the models in Order.swift explicitly implement the == function to conform to Equatable. This means that each time a model is updated, this method must be updated too, which makes it easy to make a mistake by forgetting to do so. This could be avoided by making all properties inside the models conform to Equatable too. Also, lhs.date.timeIntervalSince(rhs.date) < 1.0 comparison wasn't working correctly because for each case when rhs is later than lhs it would always return true. This also revealed an error in the Unit Tests when OrdersWorker.updateOrder method wasn't returning the correct order with the updated date in it. Therefore I have: