AppDelegateComponent 1.0.1

AppDelegateComponent 1.0.1

Maintained by Martin Hartl.



AppDelegateComponent

Build Status Version License Platform

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

The protocol 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

The protocol 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 AppDelegate.

AppDelegateComponentRunner

AppDelegateComponentRunner objects act as the glue between the App's AppDelegate and all AppDelegateComponent provided by the AppDelegateComponentStore. The runner forwards all the callbacks.

See 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.

Requirements

Installation

AppDelegateComponent is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'AppDelegateComponent'

Author

hartlco, [email protected]

License

AppDelegateComponent is available under the MIT license. See the LICENSE file for more info.