how to display a search bar with SwiftUI

后端 未结 4 1732
深忆病人
深忆病人 2020-12-04 07:02

The new SwiftUI framework does not seem to provide a built-in search bar component. Should I use a UISearchController and wrap it in some way, or should I use a simple textf

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 07:19

    Many UIKit components currently do not have SwiftUI equivalents. In order to use them, you can create a wrapper as in https://developer.apple.com/tutorials/swiftui/creating-and-combining-views.

    Basically, you make a SwiftUI class that conforms to UIViewRepresentable and implements makeUIView and updateUIView.

提交回复
热议问题