Esri / data-collection-ios

Mobile data collection app using the iOS Runtime SDK.
https://developers.arcgis.com/
Apache License 2.0
25 stars 26 forks source link

Consider: moving appContext KVOs to AppContextViewController & follow similar pattern as Notifications #46

Closed esreli closed 6 years ago

esreli commented 6 years ago

The current Notifications pattern is such that every view controller is of some sort a AppContextViewController subclass. When app notifications are fired (reachability changed, work mode changed, last sync changed) the AppContextViewController calls it's corresponding function, which can be subclassed by view controllers who care about receiving that message.

As for KVOs, there are 3 KVOs on app context properties but are managed by individual view controllers at the subclass level. In reality, these KVOs are accomplishing the same goal as the notifications, which is to inform the user of a change to the app context.

My idea here is to move KVOs that are concerned with app context properties to AppContextViewController and to follow the same pattern as found in notifications.

Thoughts? @nixta

esreli commented 6 years ago

I can extend this further by determining (using a protocol) which notifications / KVOs to subscribe to so that only those view controllers who care to hear about certain changes to the app context hear them.

esreli commented 6 years ago

Built this component out.