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:

  1. Open your project in Xcode
  2. Go to File → Add Package Dependencies...
  3. Enter the repository URL: https://github.com/FeaturePortal/featureportal-ios
  4. Select the version you want to use (we recommend the latest release)
  5. 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

  1. Log in to your FeaturePortal dashboard
  2. Create a new project or select an existing one
  3. Go to the Settings tab
  4. Copy your API key from the API Configuration section

2. Initialize the SDK

Configure FeaturePortal in your app's initializer with your API key:

MyApp.swift
import SwiftUI
import FeaturePortal

@main
struct MyApp: App {
    init() {
        FeaturePortal.configure(
            apiKey: "your_api_key_here"
        )
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}
⚠️
Security Note
Never commit your API key to version control. Consider using environment variables or a configuration file that's excluded from git.

Components

FeatureListView

A complete feature request board that displays all features with voting and commenting capabilities.

ContentView.swift
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.

📊
Analytics Dashboard
View tracking data is automatically aggregated in your project's Analytics tab, showing most viewed features, view trends, and platform breakdown (iOS vs Web).

Implementation: Add view tracking when feature details are displayed:

FeatureWishDetailView.swift
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
                )
            }
        }
    }
}
API Details
// 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

Make it Easy to Find
Add a dedicated tab or menu item for feature requests so users can easily submit feedback.
Respond to Feedback
Use the dashboard to update feature statuses and post comments. Users see these updates in real-time.
Share Your Roadmap
Link to your public roadmap in app settings or about page to show users what's coming.
Engage Early
Introduce feature requests during onboarding to build a feedback culture from day one.

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:

💡
Example Project
Check out the example app in the GitHub repository to see FeaturePortal in action with complete implementation examples.