Contents

requestAgeRange(ageGates:_:_:in:)

Requests an age range for the person logged onto iCloud on the device.

Declaration

func requestAgeRange(ageGates threshold1: Int, _ threshold2: Int? = nil, _ threshold3: Int? = nil, in window: NSWindow) async throws -> AgeRangeService.Response

Parameters

  • threshold1:

    The primary age threshold for your app.

  • threshold2:

    An optional second age threshold that creates an additional age range.

  • threshold3:

    An optional third age threshold that creates a final age range.

  • window:

    The window that anchors the system UI presentation. The system UI appears as an interface or popover attached to this window.

Return Value

An AgeRangeService.Response value indicating whether the person shared their age range.

Discussion

This method presents a system-provided interface that allows people to share their age information with your app. The interface explains what information will be shared and gives people control over whether to provide this information.

The system may return age ranges that override the age gates you specify based on the person’s location and applicable regulations. When local regulations require specific age gates, the returned age range reflects regulatory requirements rather than the bounds of your age gates.

See Also

Getting the age range