Journey
public extension Journey
-
Creates a Journey instance with sensible defaults and optional customization.
This configures:
- Logging and timeout
- Default headers via
CustomHeader.config - Node transformation, session management, and OIDC support modules
Callback registrations for common Journey callbacks
Declaration
Swift
static func createJourney(block: @Sendable (JourneyConfig) -> Void = {_ in }) -> JourneyParameters
blockAn optional configuration closure to customize
JourneyConfigand modules.Return Value
A configured Journey.
-
start(_:Asynchronousconfigure: ) Starts a Journey by name with optional options configuration.
Declaration
Swift
func start(_ journeyName: String, configure: @Sendable (inout Options) -> Void = { _ in }) async -> NodeParameters
journeyNameThe name of the Journey (auth tree) to start.
configureOptional closure to modify
Optionsbefore starting.Return Value
The first
Nodereturned by the Journey start. -
resume(_:Asynchronousconfigure: ) Resumes a Journey from a suspended URI with optional options configuration.
Declaration
Swift
func resume(_ uri: URL, configure: @Sendable (inout Options) -> Void = { _ in }) async -> NodeParameters
uriThe resume URI containing the suspendedId parameter.
configureOptional closure to modify
Optionsbefore resuming.Return Value
The next
Nodereturned by the Journey resume, or aFailureNodeif URI is invalid. -
journeySignOff()AsynchronousSigns off the Journey session and performs any configured cleanup.
Declaration
Swift
func journeySignOff() async -> Result<Void, Error>Return Value
.success(())on success or.failure(Error)if sign-off fails. -
Creates a Journey instance from a JSON dictionary.
This factory parses and validates a platform-neutral JSON configuration and delegates to
createJourney(block:)with the extracted values. Unknown fields are silently ignored for forward compatibility.Declaration
Swift
static func createJourney(json: [String : Any]) -> Result<Journey, Error>Parameters
jsonA
[String: Any]dictionary conforming to the unified SDK configuration schema (see design doc for field reference).Return Value
.success(Journey)on valid input,.failure(JsonConfigError)if a required field is absent or a field has the wrong type. -
journeyUser()AsynchronousReturns the current authenticated user for this Journey, if available.
This will:
- Initialize the Journey if needed
- Return a cached user if present
If a session exists, prepare and cache a
UserDelegatebacked byOidcUser
Declaration
Swift
public func journeyUser() async -> User?Return Value
A
Userif available, otherwisenil.
View on GitHub