# SwiftUI 14.0+ and Zoom SDK - AppDelegate issue

**URL:** <https://devforum.zoom.us/t/swiftui-14-0-and-zoom-sdk-appdelegate-issue/82030>\
**Category:** iOS\
**Created:** [January 24, 2023, 3:38pm UTC](https://devforum.zoom.us/t/swiftui-14-0-and-zoom-sdk-appdelegate-issue/82030 "2023-01-24T15:38:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![l.natali9](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/l.natali9/32/44717_2.png) [@l.natali9](https://devforum.zoom.us/u/l.natali9)\
**Post date:** [January 24, 2023, 3:38pm UTC](https://devforum.zoom.us/t/swiftui-14-0-and-zoom-sdk-appdelegate-issue/82030/1 "2023-01-24T15:38:19Z")

</div>

While Zoom SDK officially doesn’t support SwiftUI the way to use it is an example from [SwiftUI and Zoom SDK](https://devforum.zoom.us/t/swiftui-and-zoom-sdk/46078)

But the is a big problem with a `UIWindow` available from `AppDelegate`. It should be manually attached to `window` property.

> let scene = UIApplication.shared.connectedScenes.first  
> let windowSceneDelegate = scene?.delegate as? UIWindowSceneDelegate  
> let window = (windowSceneDelegate?.window)!  
> UIApplication.shared.delegate = MyAppDelegate.Shared  
> let delegate = UIApplication.shared.delegate as! MyAppDelegate  
> delegate.window = window

But from ios14.0 SwiftUI requires to set `AppDelegate` by `UIApplicationDelegateAdaptor`

> @UIApplicationDelegateAdaptor(MyAppDelegate.self) var myAppDelegate

In fact, the real AppDelegate will be SwiftUI.AppDelegate and propagating all actions to MyAppDelegate.

It is possible to set also `window` manually to `myAppDelegate` instance, and the correct `window` object is available by calling `UIApplication.shared.delegate.window`

But unfortunately, Zoom SDK is initialized and authorized but does not open/present the meeting screen. view.

Should anything else be prepared in AppDelegate to make it work?

```auto
class MyAppDelegate: NSObject, ObservableObject, UIApplicationDelegate {

static let Shared = ZoomAppDelegate()
var window: UIWindow?

}

```

```auto
struct StartZoomVC: UIViewControllerRepresentable {

@EnvironmentObject private var appDelegate: MyAppDelegate

[......]

func getMainWindowToShareWithAppDelegate() {
        DispatchQueue.main.async {
            let scene = UIApplication.shared.connectedScenes.first
            let windowSceneDelegate = scene?.delegate as? UIWindowSceneDelegate
            let window = (windowSceneDelegate?.window)!
            appDelegate.window = window //(UIApplication.shared.delegate?.window access is correct but doesn't work)
            UIApplication.shared.delegate = MyAppDlelegate.Shared()
            let delegate = UIApplication.shared.delegate as! MyAppDelegate
            delegate.window = window //(UIApplication.shared.delegate?.window access is correct and works)
        }

}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [February 24, 2023, 1:38am UTC](https://devforum.zoom.us/t/swiftui-14-0-and-zoom-sdk-appdelegate-issue/82030/2 "2023-02-24T01:38:26Z")

</div>

Closed on February 24, 2023, 1:38am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
