AppDelegateDispatcher

public class AppDelegateDispatcher : EventDispatching

Use this class to broadcast your AppDelegate’s methods among the registered components.

  • Asks the delegate to open a resource specified by a URL, and provides a dictionary of launch options. This method is not called if your implementations return false from both the application(:willFinishLaunchingWithOptions:) and application(:didFinishLaunchingWithOptions:) methods. (If only one of the two methods is implemented, its return value determines whether this method is called.) If your app implements the applicationDidFinishLaunching(:) method instead of application(:didFinishLaunchingWithOptions:), this method is called to open the specified URL after the app has been initialized. If a URL arrives while your app is suspended or running in the background, the system moves your app to the foreground prior to calling this method. There is no equivalent notification for this delegation method.

    Declaration

    Swift

    public static func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool
  • Called on the main thread after the NSUserActivity object is available. Use the data you stored in the NSUserActivity object to re-create what the user was doing. You can create/fetch any restorable objects associated with the user activity, and pass them to the restorationHandler. They will then have the UIResponder restoreUserActivityState: method invoked with the user activity. Invoking the restorationHandler is optional. It may be copied and invoked later, and it will bounce to the main thread to complete its work and call restoreUserActivityState on all objects.

    Declaration

    Swift

    public static func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
  • Tells the delegate that events related to a URL session are waiting to be processed. The app calls this method after all background transfers associated with an URLSession object are done, whether they finished successfully or resulted in an error. The app also calls this method if authentication is required for one or more transfers. Use this method to reconnect any URL sessions and to update your app’s user interface. For example, you might use this method to update progress indicators or to incorporate new content into your views. After processing the events, execute the block in the completionHandler parameter so that the app can take a new snapshot of your user interface. If a URL session finishes its work when your app is not running, the system launches your app in the background so that it can process the event. In that situation, use the provided identifier to create a new URLSessionConfiguration and URLSession object. You must configure the other options of your URLSessionConfiguration object in the same way that you did when you started the uploads or downloads. Upon creating and configuring the new URLSession object, that object calls the appropriate delegate methods to process the events. If your app already has a session object with the specified identifier and is running or suspended, you do not need to create a new session object using this method. Suspended apps are moved into the background. As soon as the app is running again, the URLSession object with the identifier receives the events and processes them normally. At launch time, the app does not call this method if there are uploads or downloads in progress but not yet finished. If you want to display the current progress of those transfers in your app’s user interface, you must recreate the session object yourself. In that situation, cache the identifier value persistently and use it to recreate your session object.

    Declaration

    Swift

    public static func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void)
  • Registers an observer. The registered observer will be called as if it were the AppDelegate. The call order depends on the registration order. If a delegate method has a return type, then the iteration happens until one of the observers return a non-default value.

    Declaration

    Swift

    public static func register(_ observer: AppDelegateObserving)
  • Unregisters an observer.

    Declaration

    Swift

    public static func unregister(_ observer: AppDelegateObserving)
  • Declaration

    Swift

    public func registerObserver(_ observer: EventObserving)
  • Declaration

    Swift

    public func unregisterObserver(_ observer: EventObserving)