title: How to set @EnvironmentObject in an existing Storyboard based project?
body: <p>I have an iOS project built with <strong>Storyboard</strong> and <strong>UIKit</strong>. Now I want to develop the new screens using <strong>SwiftUI</strong>. I added a Hosting View Controller to the existing <strong>Storyboard</strong> and used it to show my newly created <strong>SwiftUI</strong> view.</p>
  <p>But I couldn't figure out how to create an <strong>@EnvironmenetObject</strong> that can be used anywhere throughout the application. I should be able to access/set it in any of my UIKit based ViewController as well as my <strong>SwiftUI</strong> views.</p>
  <p>Is this possible? If so how to do it? In a pure <strong>SwiftUI</strong> app, we set the environment object like below,</p>
  <pre><code>@main
  struct myApp: App {
      @StateObject var item = Item()
  
      var body: some Scene {
          WindowGroup {
              MainView()
                  .environmentObject(item)
          }
      }
  }
  </code></pre>
  <p>But in my case, there is no function like this since it is an existing iOS project with <strong>AppDelegate</strong> and <strong>SceneDelegate</strong>. And the initial view controller is marked in Storyboard.
  How to set this and access the object anywhere in the app?</p>