You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`location`|`[NSDirectionalRectEdge]`|`[.bottom, .trailing]`| The location of the widget on the screen. |
60
-
|`autoInject`|`Bool`|`true`| Injects the Feedback widget into the application when the integration is added. Set `autoInject: false` if you want to call `feedback.attachTo()` or `feedback.openDialog()` directly, or only want to show the widget on certain views. |
60
+
|`autoInject`|`Bool`|`true`| Injects the Feedback widget into the application when the integration is added. Set `autoInject: false` if you want to call `SentrySDK.feedback.showWidget()` directly, e.g. to show the widget on certain views. |
61
61
|`windowLevel`|`UIWindow.Level`|`UIWindow.Level.normal + 1`| The window level of the widget. |
62
62
|`showIcon`|`Bool`|`true`| Whether to show the widget icon. |
63
63
|`labelText`|`String?`|`"Report a Bug"`| The text of the widget label. If `nil`, then only the icon is shown. It is an error to set both `labelText` to `nil` and `showIcon` to `false`. |
Copy file name to clipboardExpand all lines: docs/platforms/apple/common/user-feedback/index.mdx
+86Lines changed: 86 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,92 @@ To start using the User Feedback widget in your Cocoa application, provide a fee
45
45
46
46
This setup will insert the widget into your app's view hierarchy. By default, it appears in the bottom trailing corner of the screen, but you can fully customize its appearance and behavior.
47
47
48
+
#### SwiftUI
49
+
50
+
SwiftUI apps cannot currently use automatic injection of the widget upon SDK start. Several options exist to display the feedback form:
51
+
52
+
##### Use your own button
53
+
54
+
Place a `UIButton` somewhere in your app, then provide the reference to the feedback configuration in the options provided on SDK start:
55
+
56
+
```swift
57
+
importSentry
58
+
importSwiftUI
59
+
importUIKit
60
+
61
+
@main
62
+
structSwiftUIApp: App {
63
+
// a button displayed somewhere in your app
64
+
publiclet feedbackButton = {
65
+
let button =UIButton(type: .custom)
66
+
button.setTitle("BYOB Feedback", for: .normal)
67
+
return button
68
+
}()
69
+
70
+
init() {
71
+
// start the SentrySDK as usual, as early as possible in your app's launch sequence
72
+
SentrySDK.start { options in
73
+
options.configureFeedback { config in
74
+
config.customButton= feedbackButton
75
+
}
76
+
77
+
// your other SDK options
78
+
}
79
+
}
80
+
}
81
+
```
82
+
83
+
##### Manually display the widget from a connected `UIWindowSceneDelegate`
84
+
85
+
You must set up a `UIApplicationDelegateAdapter`, connect a `UIScene` to your app, and manually call `SentrySDK.feedback.showWidget()`:
The User Feedback widget integrates seamlessly with Session Replay. When the widget is opened, the Replay SDK buffers up to 30 seconds of the user's session. If feedback is submitted, this replay is sent along with the feedback, allowing you to view both the feedback and the user's actions leading up to the feedback submission.
0 commit comments