What's New / Privacy, Security & Identity

What's new in _PassKit_SwiftUI

+8 NewiOS

_PassKit_SwiftUI is a Swift cross-import overlay: API the compiler exposes only when a target imports both PassKit and SwiftUI. It provides SwiftUI views and types for presenting Apple Pay and Wallet content in a SwiftUI view hierarchy.

The 27 SDK adds 8 APIs, with no deprecations or removals. New types are ApplePayMerchandisingView, ApplePayMerchandisingAction, ApplePayMerchandisingPartnerConfiguration, and ApplePayMerchandisingStyle. The view exposes a Body associated type, and ApplePayMerchandisingAction and ApplePayMerchandisingStyle each carry a RawValue.

New

8
struct

ApplePayMerchandisingAction

NewiOS
public struct ApplePayMerchandisingAction : Equatable, RawRepresentable

Type of action taken when the button is tapped on the ApplePayMerchandisingView

Declaration
public struct ApplePayMerchandisingAction : Equatable, RawRepresentable {

    /// Displays a simple info sheet on the learn more details
    public static var learnMore: ApplePayMerchandisingAction

    /// Instantiates a particular action
    public init(rawValue: String)

    /// The string representation of the action
    public let rawValue: String

    /// The raw type that can be used to represent all values of the conforming
    /// type.
    ///
    /// Every distinct value of the conforming type has a corresponding unique
    /// value of the `RawValue` type, but there may be values of the `RawValue`
    /// type that don't have a corresponding value of the conforming type.
    @available(iOS 27.0, *)
    @available(macOS, unavailable)
    @available(tvOS, unavailable)
    @available(watchOS, unavailable)
    @available(macCatalyst, unavailable)
    @available(visionOS, unavailable)
    public typealias RawValue = String
}
struct

ApplePayMerchandisingPartnerConfiguration

NewiOS
public struct ApplePayMerchandisingPartnerConfiguration : Equatable

Defines the partner configuration for the ApplePayMerchandisingView

Declaration
public struct ApplePayMerchandisingPartnerConfiguration : Equatable {

    /// Show no partners
    public static let none: ApplePayMerchandisingPartnerConfiguration

    /// Show a limited number of specified partners
    public static func limited(partnerIdentifiers: [String]) -> ApplePayMerchandisingPartnerConfiguration

    /// Show all possible partners
    public static let all: ApplePayMerchandisingPartnerConfiguration

    /// Returns a Boolean value indicating whether two values are equal.
    ///
    /// Equality is the inverse of inequality. For any values `a` and `b`,
    /// `a == b` implies that `a != b` is `false`.
    ///
    /// - Parameters:
    ///   - lhs: A value to compare.
    ///   - rhs: Another value to compare.
    public static func == (a: ApplePayMerchandisingPartnerConfiguration, b: ApplePayMerchandisingPartnerConfiguration) -> Bool
}
struct

ApplePayMerchandisingStyle

NewiOS
public struct ApplePayMerchandisingStyle : Equatable, RawRepresentable

Styling layout of the ApplePayMerchandisingView

Declaration
public struct ApplePayMerchandisingStyle : Equatable, RawRepresentable {

    /// The Standard Promotional Widget
    public static var standard: ApplePayMerchandisingStyle

    /// Instantiates a particular style
    public init(rawValue: String)

    /// The string representation of the style
    public let rawValue: String

    /// The raw type that can be used to represent all values of the conforming
    /// type.
    ///
    /// Every distinct value of the conforming type has a corresponding unique
    /// value of the `RawValue` type, but there may be values of the `RawValue`
    /// type that don't have a corresponding value of the conforming type.
    @available(iOS 27.0, *)
    @available(macOS, unavailable)
    @available(tvOS, unavailable)
    @available(watchOS, unavailable)
    @available(macCatalyst, unavailable)
    @available(visionOS, unavailable)
    public typealias RawValue = String
}
struct

ApplePayMerchandisingView

NewiOS
public struct ApplePayMerchandisingView<Fallback> : View where Fallback : View
Declaration
@MainActor @preconcurrency public struct ApplePayMerchandisingView<Fallback> : View where Fallback : View {

    /// Constructs a view displaying Pay Later Promotional information given a configuration
    /// - Parameters:
    ///   - amount: The users bag price or item pricing
    ///   - currency: The ISO 4217 code for the country or region of the merchant’s principle place of business.
    ///   - region: The merchant's ISO 3166 country code.
    ///   - action: The type of action that is taken when the user taps on the call to action in the view
    ///   - style: The style of view that should be shown. This dictates the strings / image content
    ///   - partners: List of partners the view should show if they are supported.
    ///   - fallback: The fallback view will be shown when the contents cannot rendered
    nonisolated public init(amount: Decimal, currency: Locale.Currency, region: Locale.Region, action: ApplePayMerchandisingAction = .learnMore, style: ApplePayMerchandisingStyle = .standard, partners: ApplePayMerchandisingPartnerConfiguration = .all, @ViewBuilder fallback: () -> Fallback = { EmptyView() })

    /// The content and behavior of the view.
    ///
    /// When you implement a custom view, you must implement a computed
    /// `body` property to provide the content for your view. Return a view
    /// that's composed of built-in views that SwiftUI provides, plus other
    /// composite views that you've already defined:
    ///
    ///     struct MyView: View {
    ///         var body: some View {
    ///             Text("Hello, World!")
    ///         }
    ///     }
    ///
    /// For more information about composing views and a view hierarchy,
    /// see <doc:Declaring-a-Custom-View>.
    @MainActor @preconcurrency public var body: some View { get }

    /// The type of view representing the body of this view.
    ///
    /// When you create a custom view, Swift infers this type from your
    /// implementation of the required ``View/body-swift.property`` property.
    @available(iOS 27.0, *)
    @available(macOS, unavailable)
    @available(tvOS, unavailable)
    @available(watchOS, unavailable)
    @available(macCatalyst, unavailable)
    @available(visionOS, unavailable)
    public typealias Body = some View
}
extension

ApplePayMerchandisingView

NewiOS
extension ApplePayMerchandisingView : Sendable
Declaration
extension ApplePayMerchandisingView : Sendable {
}
typealias

ApplePayMerchandisingAction.RawValue

NewiOS
public typealias RawValue = String

The raw type that can be used to represent all values of the conforming type.

Every distinct value of the conforming type has a corresponding unique value of the RawValue type, but there may be values of the RawValue type that don't have a corresponding value of the conforming type.

typealias

ApplePayMerchandisingStyle.RawValue

NewiOS
public typealias RawValue = String

The raw type that can be used to represent all values of the conforming type.

Every distinct value of the conforming type has a corresponding unique value of the RawValue type, but there may be values of the RawValue type that don't have a corresponding value of the conforming type.

typealias

ApplePayMerchandisingView.Body

NewiOS
public typealias Body = some View

The type of view representing the body of this view.

When you create a custom view, Swift infers this type from your implementation of the required body-swift.property property.

No APIs match your filter.

← More in Privacy, Security & Identity