Closed michaelkirk closed 8 years ago
Let's talk about this today after stand up. Reading Swift is turning out to be difficult.
If we don't get a chance...
The pattern I use is to have the controller be responsible for fetching the remote data and then telling the views to refresh.
I tell a view to refresh by sending them setNeedsLayout
which will trigger the view's layoutSubviews
method.
It is that reference in the Spot model to the UIImageView that is a little strange...
agreed that the reference from the Spot Model to the UIImageView is the awkward bit. I did try to put things in their "proper place" but unfortunately it was resulting in quite a lot more code, so I backed down. Maybe there is a different way to structure the relations that puts things in their "proper" place without a net increase in confusion.
I am not concerned about the blurred lines between the Model and View. To my eye your implementation looked more complicated, but I didn't spend time thinking about alternatives.
I would have just shoved the behavior into the controller.
fixes #79
Initially shows "loading screen" for each spot, while real image is fetched async.
I don't like that the Spot model now has to track it's spot view and notify it on change - but is there a better way @jmoody ?