- iOS 13 and above
Import dependenices:
import AppBehaviorDispatcher
Use in AppDelegate:
import UIKit
import AppBehaviorDispatcher
class AppDelegate: AppBehaviorDelegate {
var window: UIWindow?
override var behaviors: [ApplicationBehavior] {
return [
RootBehavior()
]
}
}
Use in some Behavior file:
import UIKit
import AppBehaviorDispatcher
final class RootBehavior: NSObject, ApplicationBehavior {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
// Run some code here
return true
}
}
- Right click in the Project Navigator
- Select "Add Packages..."
- Search for
https://github.com/eugene-software/AppBehaviorDispatcher.git
Eugene Software
AppBehaviorDispatcher is available under the MIT license. See the LICENSE file for more info.