0

I am trying to call a view that has been designed by UIKit and this page has a custom navigation bar with bar buttons and a search text field on it ( designed by Storyboard), but when I try to call it from a swiftUI page the navigationBar is changed to the default navigation bar ( with a back button)

the ViewControllerRepresentable struct:

import Foundation
import SwiftUI

struct ExploreViewControllerRepresentable: UIViewControllerRepresentable {
    typealias UIViewControllerType = ExploreViewController
    let category: StoreCategory?
    func makeUIViewController(context: Context) -> ExploreViewController {
        
        let viewController = ExploreViewController.instance()
        if let category = category {
            viewController.storeCategory = category
        }
        return viewController
    }
    
    func updateUIViewController(_ uiViewController: ExploreViewController, context: Context) {
        
    }
    
}

and the SwiftUI code is:

VStack {
        ForEach(items) { item in               
             NavigationLink {
                 ExploreViewControllerRepresentable(category: item)
             } label: {
                 CategoryCollectionItemView(item: item)
             }
        }//: FOREACH
}//: VSTACK Main
mohsen
  • 4,698
  • 1
  • 33
  • 54

0 Answers0