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.
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:
Removed all instances of explicitly implemented == method
Declared necessary Model structs as conforming to Equatable
Made updateOrder method inside OrdersWorkerTests test suite return the Order object passed to it inside the completionHandler instead of the static mock object from OrdersWorkerTests.testOrders
I noticed that the models in
Order.swift
explicitly implement the==
function to conform toEquatable
. 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 toEquatable
too. Also,lhs.date.timeIntervalSince(rhs.date) < 1.0
comparison wasn't working correctly because for each case whenrhs
is later thanlhs
it would always return true. This also revealed an error in the Unit Tests whenOrdersWorker.updateOrder
method wasn't returning the correct order with the updated date in it. Therefore I have:==
methodEquatable
updateOrder
method insideOrdersWorkerTests
test suite return theOrder
object passed to it inside thecompletionHandler
instead of the static mock object fromOrdersWorkerTests.testOrders