pprevalon pprevalon - 1 month ago 7
Swift Question

Swift how to pass data to a UINavigation

Im trying to pass data to a

UINavigationController
I know how to do this with a regular view controller and it work fine but when I try to do it with a UINavigationController I get an error "Value of typ 'UINavigationController' has no member 'availaible users'" I checked online for this issue everything I found had to do with using segue. I'm using code only for this project.

func nearbyUsersWithArray(){
let vc = UINavigationController(rootViewController: NearByUsersViewController())

vc.availaibleUsers = ["item to passed here"]
self.present(vc, animated: true, completion: nil)

}

Answer
let vc = NearByUsersViewController()
vc.availableUsers = ["item to passed here"]
let nvc = UINavigationController(rootViewController: vc)
self.present(nvc, animated: true, completion: nil)