IOS Swift pass variables between viewControllers using Segue

I am trying to figure out how to pass variables between two views in an iOS app. My main goal is to learn this so that I can use it in my own project (hint calculator). The code I wrote is in the following github link:

http://bit.ly/1mVra4l

I did everything as described in the following tutorial: http://jamesleist.com/ios-swift-passing-data-between-viewcontrollers/

I faced two problems:

1) When I start the application and click the button, the breakpoint is automatically triggered at the line

       var svc = segue!.destinationViewController as secondViewController;

      

I'm pretty sure I haven't set any breakpoints anywhere.

2) When I click continue in lldb, I get a crash (EXC_BAD_ACCESS) on the same line.

This problem is driving me crazy. Any help would be appreciated.

I am using xcode6-beta6, Swift language

thank

+3


source to share


1 answer


I have checked your code. Throwing it failed Unknown class secondViewController in Interface Builder . Even though you gave the correct name in the interface builder, it doesn't recognize it for some reason (probably beta). You can just remove the Class name

secondViewController in IB and add it again so it autocompletes it. It will work



+3


source







All Articles