Is there any way to use storyboard and SwiftUI in same iOS Xcode project?

后端 未结 5 1257
有刺的猬
有刺的猬 2020-12-13 06:58

As Swift 5 introduces the SwiftUI framework for creating the views, but we are currently using the storyboard for UI design.

So I just wanted to know the procedure t

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-13 07:16

    You need to add a "Host View Controller" to the Storyboard. The SwiftUI form will be displayed in the Host View Controller and is callable from any Storyboard Form.

    Be advised, the Host View Controller does not display in the Library for Xcode 11 on Mohave, you must be on Catalina. This is a bug, because once you have a project with a Host View Controller created on Catalina, that same project will run fine on Mohave, in fact, you can even copy that Host View Controller to other Storyboards and it will wok fine.

提交回复
热议问题