From 9b92617d910a5ce18feb8988944e25968e93de95 Mon Sep 17 00:00:00 2001 From: Ioannis J Date: Thu, 10 Oct 2024 17:37:39 +0200 Subject: [PATCH] chore: add sample code from SwiftUI view masking --- contents/docs/session-replay/ios.mdx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/contents/docs/session-replay/ios.mdx b/contents/docs/session-replay/ios.mdx index 4281b6c4411a..bc55c932d2f9 100644 --- a/contents/docs/session-replay/ios.mdx +++ b/contents/docs/session-replay/ios.mdx @@ -49,7 +49,7 @@ let imvProfilePhoto = UIImageView(frame: CGRect(x: 50, y: 50, width: 100, height imvProfilePhoto.accessibilityIdentifier = "ph-no-capture" ``` -> **Note:** This is currently not supported for SwiftUI. We're investigating the [issue](https://github.com/PostHog/posthog-ios/issues/162). +> **Note:** For SwiftUI please refer to the [Masking in SwiftUI](#masking-in-swiftui) section below > **Note:** A technical issue is causing the [SwiftUI Text](https://developer.apple.com/documentation/swiftui/text) view to be detected as a `SwiftUI Image` view. This means that it'll be automatically masked if `maskAllImages` is set to `true`, even if the `maskAllTextInputs` is disabled. We're investigating this [issue](https://github.com/PostHog/posthog-ios/issues/163). @@ -58,7 +58,13 @@ imvProfilePhoto.accessibilityIdentifier = "ph-no-capture" - When using the [SwiftUI TextField](https://developer.apple.com/documentation/swiftui/textfield) with [UITextInputTraits](https://developer.apple.com/documentation/uikit/uitextinputtraits), setting traits such as `TextField("Email", text: ...).keyboardType(.emailAddress)` will always be automatically masked since it's for private text. - The [SwiftUI SecureField](https://developer.apple.com/documentation/swiftui/securefield) view is always automatically masked. -- You can manually mark a SwiftUI View for masking using the `postHogMask(_:)` view modifier +- You can manually mark a SwiftUI View for masking using the `postHogMask(_:)` view modifier: + + ```swift + // This view will be masked in session replay recordings + MyCoolView() + .postHogMask() + ``` ## Limitations