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 Creating the User Interface Programmatically Making a Choice

Davide Callegari
Davide Callegari
5,360 Points

No teacher's notes

The video mentions teacher's notes at the beginning where we can copy/paste some code but nothing is there.

4 Answers

Will Matthews
Will Matthews
8,127 Points

Here's the snippet:

        view.addSubview(firstChoiceButton)
        firstChoiceButton.translatesAutoresizingMaskIntoConstraints = false

        NSLayoutConstraint.activate([
            firstChoiceButton.centerXAnchor.constraint(equalTo: view.centerXAnchor),
            firstChoiceButton.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -80.0)
        ])

        view.addSubview(secondChoiceButton)
        secondChoiceButton.translatesAutoresizingMaskIntoConstraints = false

        NSLayoutConstraint.activate([
            secondChoiceButton.centerXAnchor.constraint(equalTo: view.centerXAnchor),
            secondChoiceButton.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -32)
        ])
Davide Callegari
Davide Callegari
5,360 Points

Well, thanks but it's wrong, that's the whole package of the project, not only the code snippet.

Steven Parker
Steven Parker
231,269 Points

It looks like you've found a "bug". :beetle:

Since at time index 0:23 the video explicitly states "As always, look in the teacher's notes for a link...", the empty teacher's notes are clearly a bug. Report it to the staff following the instructions on the Support page. It might even get you the "special Exterminator badge".

The link to copy and paste code, in this case, isn't contained in the teacher's notes, rather under the downloads section.

http://treehouse-code-samples.s3.amazonaws.com/iOS10-Swift/InteractiveStory/InteractiveStory-S3.zip