iOS SDK Documentation
Native SwiftUI components for collecting feature requests directly in your iOS app.
Installation
Swift Package Manager
Add FeaturePortal to your project using Xcode:
- Open your project in Xcode
- Go to File → Add Package Dependencies...
- Enter the repository URL:
https://github.com/FeaturePortal/featureportal-ios - Select the version you want to use (we recommend the latest release)
- Click Add Package
Requirements
- iOS 15.0 or later
- Xcode 14.0 or later
- Swift 5.7 or later
Configuration
1. Get Your API Key
- Log in to your FeaturePortal dashboard
- Create a new project or select an existing one
- Go to the Settings tab
- Copy your API key from the API Configuration section
2. Initialize the SDK
Configure FeaturePortal in your app's initializer with your API key:
import SwiftUI
import FeaturePortal
@main
struct MyApp: App {
init() {
FeaturePortal.configure(
apiKey: "your_api_key_here"
)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}Components
FeatureListView
A complete feature request board that displays all features with voting and commenting capabilities.
import SwiftUI
import FeaturePortal
struct ContentView: View {
var body: some View {
FeaturePortal.FeatureListView()
}
}The FeatureListView automatically:
- Fetches features from your project
- Displays voting counts and allows users to upvote
- Shows comments and enables users to add new ones
- Supports dark mode automatically
- Refreshes on pull-to-refresh
- Handles loading and error states
Navigation Integration
Embed the feature list in a navigation view for a complete experience:
NavigationView {
FeaturePortal.FeatureListView()
.navigationTitle("Feature Requests")
}Tab Bar Integration
Add a dedicated tab for feature requests:
TabView {
HomeView()
.tabItem {
Label("Home", systemImage: "house")
}
FeaturePortal.FeatureListView()
.tabItem {
Label("Feedback", systemImage: "lightbulb")
}
SettingsView()
.tabItem {
Label("Settings", systemImage: "gear")
}
}Customization
Theme Support
FeaturePortal automatically adapts to your app's appearance mode (light/dark). No additional configuration required!
User Identity
By default, users are anonymous. You can optionally associate votes and comments with user emails:
// Set user email for attribution
FeaturePortal.setUserEmail("user@example.com")View Tracking (Analytics)
Enable view tracking to gain insights into which features users are viewing most. This data powers the analytics dashboard in your FeaturePortal project.
Implementation: Add view tracking when feature details are displayed:
import SwiftUI
import FeaturePortal
struct FeatureWishDetailView: View {
let featureWish: FeatureWish
var body: some View {
ScrollView {
// Your feature detail UI
VStack(alignment: .leading, spacing: 16) {
Text(featureWish.title)
.font(.title)
Text(featureWish.description)
// ... more UI
}
}
.onAppear {
// Track view when detail appears
Task {
try? await FeaturePortal.shared.trackView(
for: featureWish.id
)
}
}
}
}// Endpoint: POST /api/sdk/feature-wishes/{id}/view
// Headers: X-API-KEY, X-APP-USER-ID (optional)
// Body: { "source": "ios" }
// The SDK handles this automatically when you call:
try await FeaturePortal.shared.trackView(for: featureWishId)
// View tracking is:
// - Non-blocking (background task)
// - Fire-and-forget (won't fail your UI)
// - Anonymous by default
// - Rate limited (100 req/min per project)Note: View tracking is optional but recommended. It provides valuable insights into user engagement and helps you understand which features generate the most interest.
Best Practices
Troubleshooting
"Invalid API Key" Error
- Verify you copied the entire API key from the dashboard
- Check there are no extra spaces or line breaks
- Ensure you're using the correct project's API key
- Try regenerating the API key in project settings
Features Not Loading
- Check your internet connection
- Verify the API key is configured correctly
- Look for errors in the Xcode console
- Try pull-to-refresh in the feature list
Getting Help
Need additional help? Here's how to get support:
- GitHub Issues: Report bugs or request features at github.com/FeaturePortal/featureportal-ios/issues
- Documentation: Check the README on GitHub for the latest updates
- Web Dashboard: Review the API Reference for endpoint details