Overview
An event trigger fires when an event occurs through a user interaction or an updating value. You can choose if the Event trigger listens for a page event, view event, variable event, appearance event, device event, custom event, or location event. Each event type is customizable.
Trigger Properties
Type
Set the event type as a view, variable, device, custom, or location event:
Page Event: An event that occurs when an object, page, or sheet appears, loads, or disappears.
View Event: An event that occurs when an object or page appears, loads, disappears, or changes appearance.
Variable Event: An event that occurs when a variable's value changes.
Appearance: An event that fires when an object or page's UI appearance changes.
Device Event: An event that occurs when the native keyboard shows or hides or another device related event occurs.
Custom Event: An event that occurs when a custom Event is triggered.
Location Event: An event that occurs when a location or location authorization changes.
Is Enabled
Set if the trigger should fire when the trigger's conditions are met.
Page Event Properties
Event
Set if the trigger should fire when an object, page, or sheet appears, loads, or disappears:
On Load: Fires when a page loads.
On Appear: Fires when an object or page appears (shows or duplicates).
On Disappear: Fires when an object or page disappears (hides or removes).
On Will Appear: Fires just before an object or page appears.
On Will Disappear: Fires just before an object or page disappears.
On Sheet Dismiss: Fires when a native sheet is dismissed.
On Sheet Will Dismiss: Fires just before a native sheet is dismissed.
View Event Properties
Event
Set if the trigger should fire when a view initializes or when a view is laid out:
Initialized: Fires when SwiftUI instantiates the view struct.
On Layout: Fires when SwiftUI applies the view's position, size, and layout.
Variable Event Properties
Variable
Select the variable that the trigger will monitor.
Event
Set the variable event that will fire the trigger:
On Change: Fires when the selected variable's value changes.
Appearance Event Properties
Event
Set the appearance event that will fire the trigger:
Appearance Changed: Fires when an object or page's UI appearance changes.
Device Event Properties
Event
Set if the trigger should fire when the device becomes active, the app enters the foreground, the app enters the background, the keyboard shows, or the keyboard hides:
On Became Active: Fires when the iOS device becomes active.
Will Enter Foreground: Fires when the user opens the app clip/Play app.
Did Enter Background: Fires when the user opens another app.
On Keyboard Show: Fires when the native Apple keyboard opens.
On Keyboard Hide: Fires when the native Apple keyboard closes.
Custom Event Properties
Event
Select the custom event that will fire the trigger. Create a custom event in the Event Panel.
Location Event Properties
Event
Set if the trigger should fire when the user's location changes or when the user's auth status changes:
Auth Status Changed: Fires when the user changes their location authorization settings.
Location Updated: Fires when the user's location changes.
Expression Editor Properties
Is Enabled
trigger.isEnabled
Whether the trigger is enabled or disabled.