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 Build an Interactive Story App with Swift 2 Creating the User Interface Programmatically Prepare For Segue

Error editor placeholder in source file

extension Page {

func addChoice(title:String, story: Story) -> Page
{
    let page = Page(story: story)
    return addChoice(title, page: page)
}

func addChoice(title: String, page :Page) -> Page {
    switch (firstChoice ,secondChoice) {
    case (.Some, .Some): break
    case (.None, .None), (.None, .Some):
        firstChoice = (title, page)
    case(.Some, .None):
        secondChoice = (title, page)
    }
    return page

m getting error in line return addChoice(title, page: page) }

3 Answers

What does it say ?

Boris Likhobabin
Boris Likhobabin
3,581 Points

Found on stackoverflow:

Try to delete that line of code and type it again on a new line (not just copy and paste) Worked for me!

Abdulwahab Alansari
Abdulwahab Alansari
15,151 Points

Your code works fine here, all I had to do is adding two close curly brackets at the end }}