PreferenceCenter

@MainActor
public protocol PreferenceCenter : AnyObject, Sendable

An interface for interacting with Airship’s Preference Center.

  • Called when the Preference Center is requested to be displayed. Return true if the display was handled, false to fall back to default SDK behavior.

    Declaration

    Swift

    @MainActor
    var onDisplay: (@MainActor @Sendable (_ preferenceCenterID: String) -> Bool)? { get set }
  • Open delegate for the Preference Center.

    Declaration

    Swift

    @MainActor
    var openDelegate: (any PreferenceCenterOpenDelegate)? { get set }
  • The theme for the Preference Center.

    Declaration

    Swift

    @MainActor
    var theme: PreferenceCenterTheme? { get set }
  • Loads a Preference Center theme from a plist file.

    Declaration

    Swift

    @MainActor
    func setThemeFromPlist(_ plist: String) throws

    Parameters

    plist

    The name of the plist in the bundle.

  • Displays the Preference Center with the given ID.

    Declaration

    Swift

    @MainActor
    func display(_ preferenceCenterID: String)

    Parameters

    preferenceCenterID

    The preference center ID.

  • Opens the Preference Center with the given ID. (Deprecated)

    Declaration

    Swift

    @available(*, deprecated, renamed: "display(identifier:﹚")
    @MainActor
    func open(_ preferenceCenterID: String)
  • Returns the configuration of the Preference Center with the given ID.

    Declaration

    Swift

    @MainActor
    func config(preferenceCenterID: String) async throws -> PreferenceCenterConfig

    Parameters

    preferenceCenterID

    The preference center ID.

  • Returns the configuration of the Preference Center as JSON data with the given ID.

    Declaration

    Swift

    @MainActor
    func jsonConfig(preferenceCenterID: String) async throws -> Data

    Parameters

    preferenceCenterID

    The preference center ID.