An object that signals your app’s intention to make exclusive use of the device’s contactless features.
Create an instance of this type to obtain exclusive use of the user interface for a selected credential. This prevents interruptions to your app from Wallet, any other default contactless app, or other apps using the `SecureElementCredential` framework. The assertion expires when any of the following occur:
* The assertion instance deinitializes.
* You call the ``relinquish()`` method to indicate that you no longer need the assertion.
* The system's 60-second timeout expires.
* The session encounters a ``CredentialSession/Event/cardEmulationTimeout``, potentially caused by one of the `performTransaction` methods.
Apps can only acquire an assertion 15 seconds after relinquishing the previous assertion.
Any of the `transaction` methods automatically acquire an internal instance of the `PresentmentIntentAssertion`. Because of this, call `relinquish()` prior to using the transaction methods. The following sequence shows how this works in a SwiftUI application:
1. Call ``CredentialSession/acquirePresentmentAssertion()`` before showing any proprietary payment UI.
2. Call ``relinquish()`` to stop using the assertion before invoking the transaction method.
3. Invoke ``CredentialSession/configuration()`` to start a `transactionTask`.
4. Perform the transaction with the `transactionTask`.
5. Call ``CredentialTransaction/Configuration/invalidate()`` after presenting the credential.
6. Optionally, call ``CredentialSession/acquirePresentmentAssertion()`` to finish up any proprietary payment UI.
7. Call ``relinquish()`` again to end use of the assertion.
In a UIKit app, use the following approach:
1. Call ``CredentialSession/acquirePresentmentAssertion()`` prior to showing any proprietary payment UI.
2. Call ``relinquish()`` to stop using the assertion before invoking the transaction API.
3. Perform the transaction task.
4. Optionally, call ``CredentialSession/acquirePresentmentAssertion()`` to finish up any proprietary payment UI.
5. Call ``relinquish()`` again to end use of the assertion.
Members (2)
method · iOS 18.1+
relinquish
TypeScript
relinquish(): Promise<void>
Swift declaration
final func relinquish() async throws
Ends the presentment intent assertion.
Call this function after your presentment task finishes.
A ``SecureElementCredential/CredentialSession/PresentmentIntentAssertion`` times out after 60 seconds. If you don't explicitly relinquish the object by then, the session produces a ``SecureElementCredential/CredentialSession/Event/presentmentIntentAssertionTimeout`` event, and invalidates this object.
get · iOS 18.1+
state
TypeScript
get state(): Promise<CredentialSession_PresentmentIntentAssertion_State>
Swift declaration
final var state: CredentialSession.PresentmentIntentAssertion.State { get async }
The state of a presentment intent assertion, indicating whether it's currently valid.
Be sure to check if the state of the acquired intent assertion is stale before attempting to present over the contactess interface.