Я попытался реализовать свой собственный вид навигации в swiftui. Но статус выглядит не полупрозрачным, как панель навигации.
С .edgesIgnoringSafeArea(.top)
он работал как я ожидал.
.edgesIgnoringSafeArea">
Но мне интересно, что не так с моим пользовательским представлением, чтобы это произошло.
struct ExampleNavigationView<Content: View>: UIViewControllerRepresentable {
private var content: () -> Content
init(@ViewBuilder content: @escaping () -> Content){
self.content = content
}
func makeUIViewController(context: Context) -> UINavigationController {
let contentViewController = UIHostingController(rootView: content())
let navigationController = UINavigationController(rootViewController: contentViewController)
navigationController.navigationBar.prefersLargeTitles = false
contentViewController.navigationItem.title = "Search"
return navigationController
}
func updateUIViewController(_ uiViewController: UINavigationController, context: UIViewControllerRepresentableContext<ExampleNavigationView>) {}
}