A micro-framework helping you modularize and declutter your
AppDelegate by splitting the functionality into testable components. The components get the
AppDelegatecallbacks forwarded for implementing decoupled functionality.
AppDelegateComponent consists of 3 parts:
AppDelegateComponent defines functions from
UIApplicationDelegate. Your types conforming to
AppDelegateComponent can implement the callbacks it needs to provide the wanted functionality. For example registering a crash-logging framework in
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool.
AppDelegateComponentStore defines an array of
AppDelegateComponent. They represent all available components that should receive the forwarded
AppDelegate callbacks. One obvious candidate to conform to
AppDelegateComponentStore is your
AppDelegateComponentRunner objects act as the glue between the App's
AppDelegate and all
AppDelegateComponent provided by the
AppDelegateComponentStore. The runner forwards all the callbacks.
AppDelegate.swift for a practical example.
This project currently only supports the most common
UIApplicationDelegate callbacks, or what was needed for Icro. Please feel free to open a pull-request to extend it.
AppDelegateComponent is available through CocoaPods. To install it, simply add the following line to your Podfile:
AppDelegateComponent is available under the MIT license. See the LICENSE file for more info.