I am trying to present a GroupActivitySharingController using SwiftUI. I am using a NSViewControllerRepresentable:
@State var event : Event
func makeNSViewController(context: NSViewControllerRepresentableContext<MeetingGroupActivitySharingRepresentableView>) -> GroupActivitySharingController {
return try! GroupActivitySharingController(MeetingGroupActivity(event: event))
}
func updateNSViewController(_ nsViewController: GroupActivitySharingController , context: NSViewControllerRepresentableContext<MeetingGroupActivitySharingRepresentableView>) {
print("Updating VC")
}
}
I present it as following :
.sheet(isPresented: $showGroupActivitySharingView) {
MeetingGroupActivitySharingRepresentableView(event: observedEvent.event)
}
It works fine on iOS, however on MacOS, I cannot dismiss the view. I see the following error:
dismissViewController:: Error: maybe this view controller was not presented?
(
0 CoreFoundation 0x000000019d75accc __exceptionPreprocess + 176
1 libobjc.A.dylib 0x000000019d242788 objc_exception_throw + 60
2 Foundation 0x000000019e8cbc6c -[NSCalendarDate initWithCoder:] + 0
3 AppKit 0x00000001a145a77c -[NSViewController dismissViewController:] + 224
4 _GroupActivities_AppKit 0x0000000232d65cf0 $s23_GroupActivities_AppKit0A25ActivitySharingControllerC011dismissViewG06resultyAA0aeF6ResultO_tFyyYaYbScMYccfU_TY0_ + 444
5 _GroupActivities_AppKit 0x0000000232d67b65 $s23_GroupActivities_AppKit0A25ActivitySharingControllerC011dismissViewG06resultyAA0aeF6ResultO_tFyyYaYbScMYccfU_TATQ0_ + 1
6 _GroupActivities_AppKit 0x0000000232d68bd9 $sIeghH_ytIeghHr_TRTQ0_ + 1
7 _GroupActivities_AppKit 0x0000000232d68bdd $sIeghH_ytIeghHr_TRTATQ0_ + 1
8 _GroupActivities_AppKit 0x0000000232d66931 $sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRyt_Tg5TQ0_ + 1
9 _GroupActivities_AppKit 0x0000000232d68ba5 $sxIeghHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRyt_Tg5TATQ0_ + 1
10 libswift_Concurrency.dylib 0x0000000263cfb0f9 _ZL23completeTaskWithClosurePN5swift12AsyncContextEPNS_10SwiftErrorE + 1
)
Any idea what is going on?