From astralform
Integrate Astralform iOS SDK into Swift/SwiftUI projects. Use when user asks to "add Astralform", "integrate Astralform SDK", "setup Astralform in iOS app", or "configure Astralform Swift client".
How this skill is triggered — by the user, by Claude, or both
Slash command
/astralform:astralform-ios-setupThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill automates the integration of the Astralform iOS SDK into Swift projects.
This skill automates the integration of the Astralform iOS SDK into Swift projects.
Before integration, ensure:
Look for these files to determine dependency manager:
Package.swift → Swift Package ManagerPodfile → CocoaPods*.xcodeproj without above → Manual/SPM via XcodeFor Swift Package Manager (Package.swift):
dependencies: [
.package(url: "https://github.com/astralform/astralform-ios.git", from: "1.0.0")
]
For CocoaPods (Podfile):
pod 'Astralform', '~> 1.0'
For Xcode SPM: Instruct user to:
https://github.com/astralform/astralform-ios.gitSearch for the app entry point:
@main struct with App protocolAppDelegate class with @main or @UIApplicationMainCommon patterns:
// SwiftUI
@main
struct MyApp: App { ... }
// UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate { ... }
SwiftUI App:
import Astralform
@main
struct MyApp: App {
init() {
Astralform.configure(
apiKey: "YOUR_API_KEY",
baseURL: URL(string: "https://api.astralform.ai")!
)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
UIKit AppDelegate:
import Astralform
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
Astralform.configure(
apiKey: "YOUR_API_KEY",
baseURL: URL(string: "https://api.astralform.ai")!
)
return true
}
}
SwiftUI integration:
import SwiftUI
import Astralform
struct ContentView: View {
@State private var showChat = false
var body: some View {
Button("Open AI Chat") {
showChat = true
}
.sheet(isPresented: $showChat) {
AstralformChatView(
endUserId: "user_123", // Unique identifier for this user
systemPrompt: "You are a helpful assistant."
)
}
}
}
UIKit integration:
import UIKit
import Astralform
class ViewController: UIViewController {
@IBAction func openChat(_ sender: Any) {
let chatVC = AstralformChatViewController(
endUserId: "user_123",
systemPrompt: "You are a helpful assistant."
)
present(chatVC, animated: true)
}
}
If the project uses client-side MCP tools (calendar, contacts, etc.):
import Astralform
// Register client tool handlers
Astralform.registerClientTool("calendar_events") { parameters async throws -> ToolResult in
// Fetch calendar events
let events = try await fetchCalendarEvents(parameters)
return .success(events)
}
Astralform.registerClientTool("add_reminder") { parameters async throws -> ToolResult in
// Add reminder
try await addReminder(parameters)
return .success(["status": "created"])
}
Add a simple test to verify integration:
// Add to a test file or playground
import Astralform
Task {
do {
let response = try await Astralform.shared.chat(
message: "Hello, are you working?",
endUserId: "test_user"
)
print("AI Response: \(response.content)")
} catch {
print("Error: \(error)")
}
}
Never hardcode API keys - Use environment variables or secure storage:
let apiKey = ProcessInfo.processInfo.environment["ASTRALFORM_API_KEY"] ?? ""
Use different keys for dev/prod:
#if DEBUG
let apiKey = "sk_test_..."
#else
let apiKey = "sk_live_..."
#endif
Validate end user IDs - Use authenticated user identifiers
| Issue | Solution |
|---|---|
| "No such module 'Astralform'" | Clean build, reset package caches |
| Network errors | Check API key and baseURL |
| Chat not loading | Verify project has LLM configured |
| Tool calls failing | Check client tool registration |
Remind user to:
YOUR_API_KEY with actual key from Astralform dashboardendUserId for user trackingCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub astralform-ai/astralform-plugins --plugin astralform