The iOS app requires an API key to access The Space Devs Launch Library API. This guide explains how to configure the API key for local development and CI/CD.
-
Ensure you have a
.envfile in the project root with your API key:API_KEY="your_api_key_here" -
Run the generation script:
./scripts/generate-ios-secrets.sh
-
Add
Secrets.plistto your Xcode project:- Open
iosApp/iosApp.xcodeprojin Xcode - Right-click on the
iosAppfolder in the navigator - Select "Add Files to 'iosApp'..."
- Navigate to
iosApp/iosApp/Secrets.plist - ✅ Check "Copy items if needed"
- ✅ Check "Add to targets: iosApp"
- Click "Add"
- Open
If you prefer to create the file manually:
-
Copy the template:
cp iosApp/iosApp/Secrets.plist.template iosApp/iosApp/Secrets.plist
-
Edit
iosApp/iosApp/Secrets.plistand replaceYOUR_API_KEY_HEREwith your actual API key -
Add to Xcode project (see step 3 above)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>apiKey</key>
<string>YOUR_API_KEY_HERE</string>
</dict>
</plist>- EnvironmentManager (
commonMain) requests API key - AppSecrets (
iosMain) reads fromSecrets.plist - NSBundle loads the plist from the app bundle
- API key is injected into Koin dependency graph
- All API clients use the key for authentication
AppSecrets.kt (iOS):
actual object AppSecrets {
actual val apiKey: String
get() = getStringResource("Secrets", "plist", "apiKey") ?: ""
}EnvironmentManager.kt (Common):
fun getEnv(key: String, defaultValue: String = ""): String {
return when (key) {
"API_KEY" -> AppSecrets.apiKey
else -> defaultValue
}
}For GitHub Actions CI/CD, the Secrets.plist is generated automatically during the build process.
API_KEY- Your Space Devs API key
The master-deploy.yml workflow includes:
- name: Create Secrets.plist for iOS
run: |
cat > iosApp/iosApp/Secrets.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>apiKey</key>
<string>${{ secrets.API_KEY }}</string>
</dict>
</plist>
EOFThe actual Secrets.plist file is excluded from git:
# iOS Secrets
iosApp/iosApp/Secrets.plist- ✅
Secrets.plist.template- Template file (no real keys) - ✅
generate-ios-secrets.sh- Script to generate from .env - ❌
Secrets.plist- Actual file with API key (gitignored)
- Verify
Secrets.plistexists iniosApp/iosApp/ - Verify the file is added to the Xcode project
- Verify the API key value is correct
- Clean and rebuild the project
- Run
./scripts/generate-ios-secrets.sh - Add the file to Xcode project (see Quick Setup above)
- Ensure the file is in the correct location:
iosApp/iosApp/Secrets.plist
- Verify the file format is valid XML
- Check that the file is included in the app target
- In Xcode, verify the file appears in "Build Phases → Copy Bundle Resources"
- Re-run the generation script:
./scripts/generate-ios-secrets.sh - Clean build folder in Xcode (Cmd+Shift+K)
- Rebuild the project
| Platform | API Key Source | Configuration File |
|---|---|---|
| Android | .env → BuildConfig |
build.gradle.kts |
| iOS | .env → Secrets.plist |
Generated at build time |
| Desktop | .env → DesktopSecret.kt |
Kotlin source file |
To get a free API key for The Space Devs Launch Library:
- Visit https://thespacedevs.com/llapi
- Sign up for a free account
- Copy your API key
- Add to
.envfile in project root