I have a NSView controller called LOGIN
I have a NSTabViewController called LISTS and this has two tabs: playlistLists - associated with the class PlaylistLists, albums - associated with the class Albums
I need to pass a variable from login to playlistLists and i think something like this should work (its from another post), but this is for ios and I need it for macOS
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let barViewControllers = segue.destination as! UITabBarController
let destinationViewController = barViewControllers.viewControllers?[0] as! FirstViewController
destinationViewController.test = "Hello TabBar 1"
// access the second tab bar
let secondDes = barViewControllers.viewControllers?[1] as! SecondViewController
secondDes.test = "Hello TabBar 2" }
so I change it to this:
override func prepare(for segue: NSStoryboardSegue, sender: Any?) {
let barViewControllers = segue.destinationControlles as! NSTabViewController
let destinationViewController = barViewControllers.viewControllers?[0] as! playlistLists
destinationViewController.test = "Hello TabBar 1"
// access the second tab bar
let secondDes = barViewControllers.viewControllers?[1] as! SecondViewController
secondDes.test = "Hello TabBar 2" }
This line I can't figure out how to change it for macOS:
let destinationViewController = barViewControllers.viewControllers?[0] as! playlistListsts
or maybe is not the right way to do it.
Thanks for your help