confirmAllAssignments
Confirms all experiment assignments and returns them in an array.
The assignments may be different when a placement is registered due to changes in user, placement, or device parameters used in audience filters.
Purpose
Confirms all experiment assignments for the current user and returns them. This is useful for debugging experiment assignments or tracking which experiments a user is enrolled in.
Signature
public func confirmAllAssignments() async -> [Assignment]
public func confirmAllAssignments(completion: (([Assignment]) -> Void)? = nil)Parameters
The completion handler version takes an optional completion closure that receives an array of Assignment objects.
Returns / State
Returns an array of Assignment objects representing all confirmed experiment assignments. If config hasn't been retrieved yet, this will return an empty array.
Usage
Using async/await:
let assignments = await Superwall.shared.confirmAllAssignments()
print("User has \(assignments.count) experiment assignments")
for assignment in assignments {
print("Experiment: \(assignment.experimentId), Variant: \(assignment.variant)")
}Using completion handler:
Superwall.shared.confirmAllAssignments { assignments in
print("Confirmed \(assignments.count) assignments")
// Process assignments
for assignment in assignments {
// Handle assignment
}
}Related
- This method tracks a
confirmAllAssignmentsevent that can be received viaSuperwallDelegate.handleSuperwallEvent(withInfo:)
How is this guide?
Edit on GitHub