Simple Weather App using the Aeris Weather API
- As part of this update, I needed to wait for Snapkit to become 3.0 compatible. Checking the Issues of the repo earlier today, it appears that this has been resolved as of a day or two. It is unclear whether the resulting issues are from a change in 3.0 (likely for the issue with the collectionView) or from a change to Snapkit (like for the constraints issues on the collection view).
- Problem: The collectionView was not reloading its data
- Prior to the update, the collectionView in use was updated by a "manager" class that had a
.reloadData()
call in thewillSet
property observer of its[AWFForecastPeriod]
property. Following the update, this property observer was still being called, but at a time offset by enough as to not invoke.reloadData()
. How was this observed? Well, while a breakpoint proved that the property observer was being called, another breakpoint in thecollectionViews
datasource functions were not being called following that. After determining that the collectionView still had a reference to it's delegate/datasource, debugging moved on. - Solution: For whatever reason, it became necessary to make a
.reloadData()
call in bothwillSet
ANDdidSet
to ensure that the collection would reload when expected. The bug would remain if only eitherwillSet
ordidSet
was present; meaning both had to make the call for this to take effect. At this time, it is not clear as to what change specifically caused this, but problems with how Snapkit was updating its constraints may give a clue to a change in the lifecycle of the views.
- Prior to the update, the collectionView in use was updated by a "manager" class that had a
- Problem: Snapkit would throw in cases where there was a call to
snp.updateConstraint
inlayoutSubviews
- On throwing, Snapkit would say that it could not find the existing constraint to update... suggesting that the
layoutSubviews
call was being made before myconfigureConstraints
(which seems unlikely sinceconfigureConstraints
is called in the view's initialization) or that there was a race condition experienced or... other reasons. - Solution: Moving constraint configurations (that required a later update) for affected views into
layoutSubviews
seems to have fixed the problem without any noticeable side effects.
- On throwing, Snapkit would say that it could not find the existing constraint to update... suggesting that the
- CLLocation framework
- UICollectionView UI elements
- NSDateFormatter for light date conversion
- Custom fonts (Roboto via Google)
- Lightweight view controller by way of singleton & delegate design
- Requires permission to access location on device
- If building on simulator, update Run scheme to set a default location
- Loading screen animation has some unexpected animation behavior
Runs on Xcode 8.0.0 (Swift 3.0)
- Aeris Weather iOS SDK
- (Aeris Dependacy) AFNetworking
- SnapKit 3.0.1