Manager

public protocol Manager : AnyObject, ClassName

Simplifies Managers start and reset routine. All managers could be then started/reseted on apropriate point in app, e.g. on user login/logout.

To get all Managers in some place (e.g. ApplicationManager) you could use following construction:

 private var managers: [Manager.Type] = {
     return g_getClassesConformToProtocol(Manager.self)
 }()
  • Start manager. Usually on app start or user login.

    Declaration

    Swift

    static func start()
  • Reset manager state. Common patter is to clean userDefaults/database manager records and reassign shared variable. Usually on user logout.

    Declaration

    Swift

    static func reset()