Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
210,130 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