Airship

public final class Airship : Sendable

Main entry point for Airship. The application must call takeOff within application(_:didFinishLaunchingWithOptions:) before accessing any instances on Airship or Airship modules.

  • A flag that checks if the Airship instance is available. true if available, otherwise false.

    Declaration

    Swift

    public static var isFlying: Bool { get }
  • Airship config.

    Declaration

    Swift

    public static var config: RuntimeConfig { get }
  • Action registry.

    Declaration

    Swift

    public static var actionRegistry: any AirshipActionRegistry { get }
  • The Airship permissions manager.

    Declaration

    Swift

    public static var permissionsManager: any AirshipPermissionsManager { get }
  • A user configurable UAJavaScriptCommandDelegate

    Note

    this delegate is not retained.

    Declaration

    Swift

    public weak static var javaScriptCommandDelegate: (any JavaScriptCommandDelegate)? { get set }
  • The channel capture utility.

    Declaration

    Swift

    public static var channelCapture: any AirshipChannelCapture { get }
  • A user configurable deep link delegate.

    Note

    this delegate is not retained.

    Declaration

    Swift

    public weak static var deepLinkDelegate: (any DeepLinkDelegate)? { get set }
  • A user configurable deep link handler. Takes precedence over deepLinkDelegate when set.

    Declaration

    Swift

    @MainActor
    public static var onDeepLink: (@Sendable @MainActor (URL) async -> Void)? { get set }
  • The URL allow list used for validating URLs for landing pages, wallet action, open external URL action, deep link action (if delegate is not set), and HTML in-app messages.

    Declaration

    Swift

    public static var urlAllowList: any AirshipURLAllowList { get }
  • The locale manager.

    Declaration

    Swift

    public static var localeManager: any AirshipLocaleManager { get }
  • The privacy manager

    Declaration

    Swift

    public static var privacyManager: any AirshipPrivacyManager { get }
  • Shared Push instance.

    Declaration

    Swift

    public static var push: any AirshipPush { get }
  • Shared Contact instance.

    Declaration

    Swift

    public static var contact: any AirshipContact { get }
  • Shared Analytics instance.

    Declaration

    Swift

    public static var analytics: any AirshipAnalytics { get }
  • Shared Channel instance.

    Declaration

    Swift

    public static var channel: any AirshipChannel { get }
  • Initializes Airship. If any errors are found with the config or if Airship is already initialized it will throw with the error.

    Declaration

    Swift

    @available(*, deprecated, message: "Use Airship.takeOff(_:﹚ instead")
    @MainActor
    public class func takeOff(
        _ config: AirshipConfig? = nil,
        launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) throws

    Parameters

    config

    The Airship config. If nil, config will be loading from a plist.

    launchOptions

    The launch options passed into application:didFinishLaunchingWithOptions:.

  • Initializes Airship. If any errors are found with the config or if Airship is already intiialized it will throw with the error.

    Declaration

    Swift

    @MainActor
    public class func takeOff(
        _ config: AirshipConfig? = nil
    ) throws

    Parameters

    config

    The Airship config. If nil, config will be loading from a plist.

  • On ready callback gets called immediately when ready otherwise gets called immediately after takeoff

    Declaration

    Swift

    @MainActor
    public static func onReady(callback: @MainActor @Sendable @escaping () -> Void)

    Parameters

    callback

    callback closure that’s called when Airship is ready

  • waitForReady() Asynchronous

    Waits for Airship to be ready using async/await.

    This method provides a modern async/await interface for waiting until Airship has finished initializing. It’s particularly useful when you need to ensure Airship is ready before performing operations that depend on it.

    Usage

    // Wait for Airship to be ready
    await Airship.waitForReady()
    
    // Now safe to use Airship components
    Airship.push.enableUserNotifications()
    

    Behavior

    • If Airship is already initialized (isFlying is true), this method returns immediately
    • If Airship is not yet initialized, this method suspends until initialization completes
    • The method will not throw or fail - it simply waits for the ready state

    Note

    This method must be called from the main thread.

    Important

    This method assumes Airship.takeOff has been called. If takeOff is never called, this method will suspend indefinitely.

    Declaration

    Swift

    @MainActor
    static func waitForReady() async