File tree Expand file tree Collapse file tree
swift-bridge/Sources/ScreenCaptureKitBridge Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,8 +158,16 @@ public func showContentSharingPicker(
158158 let configBox : Box < SCContentSharingPickerConfiguration > = unretained ( config)
159159
160160 DispatchQueue . main. async {
161+ // Activate the app to ensure picker can show
162+ NSApp . activate ( ignoringOtherApps: true )
163+
161164 let picker = SCContentSharingPicker . shared
162165
166+ // Remove old observer if any
167+ if let old = currentObserver {
168+ picker. remove ( old)
169+ }
170+
163171 let observer = PickerObserver ( callback: callback, userData: userData)
164172 currentObserver = observer
165173
@@ -181,8 +189,16 @@ public func showContentSharingPickerWithResult(
181189 let configBox : Box < SCContentSharingPickerConfiguration > = unretained ( config)
182190
183191 DispatchQueue . main. async {
192+ // Activate the app to ensure picker can show
193+ NSApp . activate ( ignoringOtherApps: true )
194+
184195 let picker = SCContentSharingPicker . shared
185196
197+ // Remove old observer if any
198+ if let old = currentObserver {
199+ picker. remove ( old)
200+ }
201+
186202 let observer = PickerObserverWithResult ( callback: callback, userData: userData)
187203 currentObserver = observer
188204
You can’t perform that action at this time.
0 commit comments