iOS SDK
v0.1.0Integrate BugScreen into your iOS app in minutes. Swift, SwiftUI, UIKit, SPM.
Installation
Swift Package Manager
In Xcode, choose File → Add Package Dependencies… and enter the repository URL:
https://github.com/bugscreenapp/bugscreen-iosOr add it to your Package.swift:
dependencies: [
.package(url: "https://github.com/bugscreenapp/bugscreen-ios", from: "0.1.0")
]Requires iOS 15.0+ and Swift 5.9+.
Setup
SwiftUI App
Initialize BugScreen in your App struct:
import SwiftUI
import BugScreenSDK
@main
struct MyApp: App {
init() {
BugScreenSDK.configure(
apiKey: "fb_your_api_key_here",
enableScreenshotDetection: true, // Default: true
enableLogging: false // Default: false
)
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}UIKit App
Initialize BugScreen in your AppDelegate:
import UIKit
import BugScreenSDK
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
BugScreenSDK.configure(
apiKey: "fb_your_api_key_here",
enableScreenshotDetection: true,
enableLogging: false
)
return true
}
}Photo Library Access (Recommended)
Add this to your Info.plist so BugScreen can auto-attach the screenshot the user just took, and so users can pick screenshots manually:
<key>NSPhotoLibraryUsageDescription</key>
<string>Attach screenshots to bug reports to help us fix issues faster</string>Usage
Automatic screenshot detection
When users take a screenshot, BugScreen automatically presents the bug report UI. No additional code required.
Manual triggering (SwiftUI)
Present the bug report screen programmatically:
Button("Report Bug") {
BugScreenSDK.presentBugReport()
}
// With pre-attached screenshot
Button("Report with Screenshot") {
BugScreenSDK.presentBugReport(screenshot: myImage)
}Manual triggering (UIKit)
@IBAction func reportBugTapped(_ sender: UIButton) {
BugScreenSDK.presentBugReport(from: self)
}
// With screenshot
BugScreenSDK.presentBugReport(
from: self,
screenshot: myImage
)Logging
Add context to bug reports with application logs:
BugScreenSDK.log("Detailed debug info", level: .verbose)
BugScreenSDK.log("Debug message", level: .debug)
BugScreenSDK.log("User tapped checkout button", level: .info)
BugScreenSDK.log("Network request took longer than expected", level: .warn)
BugScreenSDK.log("Payment failed: \(error.localizedDescription)", level: .error)Logs are automatically included with every bug report. The SDK maintains a 1 MB circular buffer of the most recent logs.
Lifecycle
// Check if SDK is configured
if BugScreenSDK.isConfigured {
// SDK is ready to use
}
// Optional: Shutdown SDK (usually not needed)
BugScreenSDK.shutdown()Configuration
| Option | Default | Description |
|---|---|---|
| apiKey: String | Required | Your API key from the BugScreen console (must start with "fb_") |
| enableScreenshotDetection: Bool | true | Auto-detect screenshots and present bug report UI |
| enableLogging: Bool | false | Enable debug logs to console (use false in production) |
What gets collected?
BugScreen automatically collects this information with each report:
- •Device model (e.g. Apple iPhone16,1)
- •iOS version
- •App version & build number
- •Bundle identifier
- •Screen resolution & scale
- •Screen size (logical points)
- •Memory (total & available)
- •Device locale
Ready to get started?
Create an account to get your API key.