iOS Session Replay installation
Install with the wizard
Run this command in your project directory to add PostHog to your iOS project. The wizard detects your framework, installs the SDK, and sets up your first events.
Or set it up manually by following the rest of this guide.
- 1
Install the SDK
RequiredInstall via Swift Package Manager. PostHog requires Xcode 26 or later, and iOS 15, macOS 12, tvOS 15, watchOS 10, or visionOS 1 or later.
Package.swiftUsing CocoaPods?Version 4 is only published to Swift Package Manager. Version 3 stays on CocoaPods (
pod "PostHog", "~> 3.0"), but CocoaPods trunk becomes read-only on December 2, 2026. After that, existing 3.x versions stay installable, but new releases only ship through Swift Package Manager. To switch, see the iOS migration guide. - 2
Enable session recordings in project settings
RequiredGo to your PostHog Project Settings and enable Record user sessions. Session recordings will not work without this setting enabled.
- 3
Configure PostHog with session replay
RequiredAdd
sessionReplay = trueto your PostHog configuration. Here are all the available options:AppDelegate.swiftFor more configuration options, see the iOS session replay docs.
SwiftUI supportSDK version 4.0 and later record SwiftUI, custom views and WebViews as screenshots. Earlier versions only support them if the
screenshotModeoption is enabled. AWKWebViewis masked whole whilemaskAllTextInputsormaskAllImagesis on, as in this snippet. - 4
Watch session recordings
RecommendedVisit your site or app and interact with it for at least 10 seconds to generate a recording. Navigate between pages, click buttons, and fill out forms to capture meaningful interactions.
- 5
Next steps
RecommendedNow that you're recording sessions, continue with the resources below to learn what else Session Replay enables within the PostHog platform.
Resource Description Watching recordings How to find and watch session recordings Privacy controls How to mask sensitive data in recordings Network recording How to capture network requests in recordings Console log recording How to capture console logs in recordings More tutorials Other real-world examples and use cases





