swift3 - Viewcontroller won't run after segue is performed, no errors -
i trying prepare , perform segue in xcode. there aren't errors in code , in simulator segue performs properly. can see segue happen in simulator when click on button.
but there simple test code on second viewcontroller, print statement see if code on next viewcontroller run, , doesn't.
i've spoken assistant instructor , when segue viewcontroller, code on should run..
here code segue on first viewcontroller:
func prepare(for segue: uistoryboardsegue, sender: any?) { let destinationvc = segue.destination as! albumsegue destinationvc.albumsongarray = selectedalbumarray } //performe segue performsegue(withidentifier: "albumsegue", sender: self)
and here second viewcontroller:
class albumsegue: uiviewcontroller { var albumsongarray: [array<string>] = [] // empty array hold songs album , file paths, etc override func viewdidload() { super.viewdidload() print("youve done captain",albumsongarray) } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } }
when put breakpoint on second viewcontroller never reached.
but, when put breakpoint under performsegue on first viewcontroller, reached...
so though segue happening, second viewcontroller's code never being run
i'm not sure why though, please explain why occurring , can fix it? thanks!
Comments
Post a Comment