SwiftER
SwiftER

Reputation: 1255

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)

    }

Upvotes: 0

Views: 42

Answers (1)

Tom Knapen
Tom Knapen

Reputation: 2277

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

Upvotes: 2

Related Questions