How to Merge SwiftUI and UIKit in Xcode?

  1. Create a button in viewController presented in mainStoryBoard and import SwiftUI inside ViewController Class.
  2. Add a hostingViewController in mainStoryboard and Drag a Segue (show Segue) from button to hostingViewController.Add segueAction form segue presented in mainStoryBoard to viewController.
Control Drag Segue form button to HostingController
SwiftUI File

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
UsamaDev

UsamaDev

iOS Developer🧑‍💻.Love to Code.♥️Life has not ctrl+ Z , So learn from mistakes and move on🥰