Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Pass data with segue

Hi!

I just got my code to get to a new viewcontroller using this code:

if user != nil {

                self.performSegueWithIdentifier("nextSegue", sender: self)
            }

in the viewcontroller that is connected to the segue: "nextSegue", I have a variable named:

var testString = ""

I want to pass the testString a string saying hello, within my if segue statement. Can anyone help? :-)

1 Answer

I won't go into to much detail but calling the new view controller in the class method I believe is the key. Check out this post in stackoverflow its pretty much what you are aiming for and I don't want to just copy it again ahah

http://stackoverflow.com/questions/26207846/pass-data-through-segue-swift

Hope This Helps

Dom