Closed esreli closed 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.
Built this component out.
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) theAppContextViewController
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