Getting Started

Native iOS autocomplete for SwiftUI and UIKit. iOS 17+, Swift 5.10+, zero dependencies.

Install

Requires iOS 17+ and Swift 5.10+. In Xcode, choose File → Add Package Dependencies… and paste the repository URL:

Package URL
https://github.com/magicx-ai/ai-autocomplete-ios.git

Or add it to your Package.swift directly:

Package.swift
dependencies: [
.package(
url: "https://github.com/magicx-ai/ai-autocomplete-ios.git",
from: "1.0.0"
)
],
targets: [
.target(
name: "MyApp",
dependencies: [
.product(name: "AIAutocompleteSwiftUI", package: "ai-autocomplete-ios")
]
)
]

The package ships three libraries — add the one that matches how you'll integrate:

  • AIAutocompleteSwiftUI — the SwiftUI views (AIAutocomplete, AIAutocompleteDropdown). Most apps want this one.
  • AIAutocompleteUIKit — the UIKit views (AIAutocompleteView, AIAutocompleteDropdownView) plus the appearance type.
  • AIAutocompleteCore — the headless @Observable controller, models, and networking. No UI.

First use

Drop AIAutocomplete into a view. It fetches suggestions on appear, fills pills as the user types, and hands you the completed query in onSubmit.

ContentView.swift
import AIAutocompleteCore
import AIAutocompleteSwiftUI
import SwiftUI
struct ContentView: View {
var body: some View {
AIAutocomplete(configuration: .init(
apiConfig: .apiKey(.init(apiKey: "pk_v1_your_public_key")),
onSubmit: { result in
print(result.query) // "Create a report"
print(result.rawQuery) // "Create a {{TASK_1}}"
print(result.completedParams) // [CompletedParam]
}
))
.padding()
}
}

Your key

The example hardcodes a public key (pk_v1_...) for clarity. Create yours on the Keys page — public keys are designed to ship in client apps.

Next steps

Integration tiers covers the SwiftUI and UIKit surfaces plus the headless controller. Styling covers the appearance tokens. Authentication covers the production access-token flow.