user763410
user763410

Reputation: 562

iOS Swift passing variables between viewControllers using Segue

I am trying to understand how to pass variables between two views in a iOS application. My main aim is learn this so I can use it in my own project (a tip calculator). The code I wrote is at the following github link:

http://bit.ly/1mVra4l

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

I am running into two problems:

1) When I run the app and click on the button, a breakpoint automatically triggers at the line

       var svc = segue!.destinationViewController as secondViewController;

I am pretty sure I did not set any breakpoints anywhere.

2) When I press continue in lldb, I get the crash (EXC_BAD_ACCESS) at the same line.

This problem is driving me nuts. Any help will be appreciated.

I am using xcode6-beta6, Swift language

Thanks

Upvotes: 3

Views: 1765

Answers (1)

Anil Varghese
Anil Varghese

Reputation: 42977

I checked your code. Its throwing error Unknown class secondViewController in Interface Builder . Even though you have given the right name in the interface builder it is not recognising it due to some reason(probably a beta issue). You can just remove the Class name of secondViewController in IB and add it again, let it autocomplete it. It will works

Upvotes: 3

Related Questions