Skip to main content

Install on iOS

AFCore is distributed as an XCFramework wrapped in a Swift Package, hosted on GitHub at AdvantaHealth/AFCore.

For step-by-step Xcode walkthroughs, capability setup, and App Store Connect notes, see the legacy iOS Setup page.


Quick add (Swift Package Manager)

  1. Xcode → File → Add Package Dependencies…
  2. Repository URL: https://github.com/AdvantaHealth/AFCore.git
  3. Version: Up to Next Major from the latest release
  4. Add AFCore to your app target. Optionally add AFCoreUI for the SwiftUI component library.

Minimum project setup

import AFCore

do {
let config = AFCoreConfig.Builder()
.baseUrl(value: "https://api.example.com")
.clientId(value: "…from AIDE…")
.clientSecret(value: "…from AIDE…")
.enableLogging(value: true)
.logLevel(value: AFLogLevel.verbose)
.build()

try AFCore.shared.initialize(config: config)
} catch {
print("AFCore initialization failed: \(error)")
}

See Initialization for the full lifecycle, and Session Management for sign-in flow.


What ships in the framework

  • AFCore — main entry point + all feature accessors
  • AFCoreUI (optional product) — themed SwiftUI components, see UI Components
  • PrivacyInfo.xcprivacy — Apple privacy manifest, auto-embedded

Background tasks (offline outbox)

If your app posts visits, self-reports, or barcode submissions, register the AFCore background task handler so the Event Outbox can flush queued events when the device is offline at capture time.

  1. Add com.advantahealth.afcore.outbox-flush to your Info.plist under BGTaskSchedulerPermittedIdentifiers.
  2. Enable Background fetch in Signing & Capabilities → Background Modes.
  3. Call AFBackgroundTasks.shared.registerHandler() before application(_:didFinishLaunchingWithOptions:) returns.

Android handles this automatically via WorkManager — no setup required.