AgeGatingKit iOS v1.0.2
Native iOS support for AgeGatingKit — an open-source SDK that simplifies Apple's age assurance, regulatory features, parental consent, and significant app change APIs.
This release includes a complete UIKit example project demonstrating the recommended AgeGatingKit integration flow.
✨ What's Included
- Apple Declared Age Range integration
- Age feature eligibility detection
- Age range retrieval
- Regulatory feature reporting
- Parental consent support for significant app changes
- Parent approval / denial response observation
- Adult notification support
- Swift Concurrency (
async/await) - Swift Package Manager support
- Complete UIKit example application
📦 Installation
Swift Package Manager
In Xcode:
- Open your project.
- Select File → Add Package Dependencies.
- Enter the AgeGatingKit repository URL:
https://github.com/Sritejathuraka/AgeGatingKit.git
- Select version 1.0.2.
- Add AgeGatingKit to your application target.
Then import the package:
import AgeGatingKit⚙️ Required iOS Configuration
Add the Declared Age Range capability to your application target:
Target → Signing & Capabilities → + Capability → Declared Age Range
Make sure your application is properly configured for Apple's age-related APIs before calling AgeGatingKit.
🚀 Integration Flow
The recommended integration flow is:
Check Age
↓
Check Eligibility
↓
Read Age Range
↓
Inspect Regulatory Features
↓
Request Parental Consent (if required)
↓
Observe Parent Decision
↓
Show Adult Notification (if required)
1️⃣ Check Age
Start by calling:
let result = try await AgeGating.check(
ageGates: [13, 16, 18],
presentingViewController: self
)AgeGatingResult provides:
result.isEligibleForAgeFeatures
result.ageRange
result.regulatoryFeaturesThe age gates [13, 16, 18] are an example. Applications should provide the age thresholds appropriate for their own product.
2️⃣ Check Eligibility
Before using the returned age information, check whether age features are available:
guard result.isEligibleForAgeFeatures == true else {
// Age features are unavailable.
// Apply your application's fallback behavior.
return
}isEligibleForAgeFeatures is optional, so applications can also explicitly handle all states:
switch result.isEligibleForAgeFeatures {
case true:
print("Age features available")
case false:
print("Age features unavailable")
case nil:
print("Eligibility unknown")
}3️⃣ Read Age Range
When available, AgeGatingKit returns the age range provided by the platform:
if let ageRange = result.ageRange {
let lowerBound = ageRange.lowerBound
let upperBound = ageRange.upperBound
print("Lower Bound:", lowerBound as Any)
print("Upper Bound:", upperBound as Any)
}Either boundary may be unavailable depending on the range returned by the platform.
Your application should use this result according to its own age-gating requirements.
4️⃣ Check Regulatory Features
After checking eligibility, inspect the regulatory features:
guard let features = result.regulatoryFeatures else {
return
}AgeGatingKit exposes:
features.declaredAgeRangeRequired
features.significantAppChangeRequiresParentalConsent
features.significantAppChangeRequiresAdultNotificationThese values tell your application which platform flows are required for the current user and regulatory context.
👶 Declared Age Range Required
Check:
if features.declaredAgeRangeRequired {
// Declared age range handling is required.
}👨👩👧 Parental Consent Required
If:
features.significantAppChangeRequiresParentalConsent == truerequest parental consent:
try await AgeGating.requestSignificantAppUpdatePermission(
description: "Parental consent required for changes in the latest release.",
presentingViewController: self
)The parental decision may arrive asynchronously.
Calling this method starts the parental consent flow; it should not be treated as the final approval result.
👀 Observe Parent Decision
Listen for parental consent responses:
for await response in AgeGating.significantAppUpdateResponses() {
switch response.decision {
case .approved:
print("Parent approved")
case .denied:
print("Parent denied")
case .unknown:
print("Parent decision unknown")
@unknown default:
print("Unrecognized parent decision")
}
}For example, an application can keep an observation task:
private var responseTask: Task<Void, Never>?
private func observeParentalConsentResponses() {
responseTask = Task {
for await response in
AgeGating.significantAppUpdateResponses() {
switch response.decision {
case .approved:
// Parent approved the request.
break
case .denied:
// Parent denied the request.
break
case .unknown:
break
@unknown default:
break
}
}
}
}Cancel the observation when it is no longer needed:
deinit {
responseTask?.cancel()
}🔔 Adult Notification Required
If:
features.significantAppChangeRequiresAdultNotification == trueshow the adult notification:
try await AgeGating.showSignificantAppUpdateAdultNotification(
description: "Please review changes in the latest release.",
presentingViewController: self
)🧩 Complete Integration Example
do {
let result = try await AgeGating.check(
ageGates: [13, 16, 18],
presentingViewController: self
)
guard result.isEligibleForAgeFeatures == true else {
return
}
// Age Range
if let ageRange = result.ageRange {
print("Lower Bound:", ageRange.lowerBound as Any)
print("Upper Bound:", ageRange.upperBound as Any)
}
// Regulatory Features
guard let features = result.regulatoryFeatures else {
return
}
print(
"Declared Age Range Required:",
features.declaredAgeRangeRequired
)
// Parental Consent
if features.significantAppChangeRequiresParentalConsent {
try await AgeGating.requestSignificantAppUpdatePermission(
description:
"Parental consent required for changes in the latest release.",
presentingViewController: self
)
}
// Adult Notification
if features.significantAppChangeRequiresAdultNotification {
try await AgeGating.showSignificantAppUpdateAdultNotification(
description:
"Please review changes in the latest release.",
presentingViewController: self
)
}
} catch {
print("AgeGatingKit Error:", error)
}Note: Parental consent responses are asynchronous. Use
AgeGating.significantAppUpdateResponses()to observe the parent's final decision.
🧪 Example iOS Application
A complete UIKit example application is included in the repository:
examples/
└── example-ios/
└── example-age-gating-iOS/
The example demonstrates:
- Checking age eligibility
- Displaying the returned age range
- Displaying regulatory feature flags
- Requesting parental consent
- Waiting for parent approval or denial
- Observing asynchronous parental responses
- Showing adult notifications when required
- Loading states
- Error handling
- Recommended AgeGatingKit integration flow
Run the Example
Clone the repository:
git clone https://github.com/Sritejathuraka/AgeGatingKit.gitThen open:
examples/example-ios/example-age-gating-iOS/
example-age-gating-iOS.xcodeproj
Configure your development team and required capabilities, then build and run on a supported device.
⬇️ Download iOS Example
A standalone iOS example project is also available in the Assets section of this release.
Download:
AgeGatingKit-iOS-Example-v1.0.2.zip
Unzip the project and open:
example-age-gating-iOS.xcodeproj
This allows developers to explore AgeGatingKit without cloning the complete repository.
⚠️ Important
AgeGatingKit provides a simplified interface to platform-provided age assurance and regulatory signals.
Applications remain responsible for determining:
- Appropriate age thresholds
- Which functionality should be allowed or restricted
- Fallback behavior when age information is unavailable
- Compliance with applicable laws and regulations
- Compliance with Apple platform policies
AgeGatingKit is a developer tool and does not constitute legal advice.
📄 License
AgeGatingKit is released under the MIT License.
Built for developers integrating age-aware experiences on iOS.
AgeGatingKit — one API for age assurance across iOS, Android, and Flutter.