Set UINavigationController Title when presenting UIHostingController

You returning settingsView as rootviewcontroller which has viewModel as a object but its empty like you declared to first let viewModel = SettingsViewModel() So below List has zero item.

var body: some View {
List(viewModel.settingItems) { item in

On the other hand , you declare controller but it never used

let controller = UIHostingController(rootView: settingsView)
controller.title = "Settings"

I have a really smaller information about swiftUI but your problem must be one of these

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top