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

Dah-Metrie Shaw
Dah-Metrie Shaw
284 Points

var todo = ["Learn Swift", "Build App", "Deploy App"] ? On the iOS track on my MacBook Air. The code "seems" correct.

The challenge is "Modifying an Array" under iOS Development with Swift.

3 Answers

This is what the final code should look like after finishing all three stages:

var todo = ["Learn Swift", "Build App", "Deploy App"]

todo.append("Debug App")
todo.append("Fix Bugs")
let item = todo.removeAtIndex(2)
todo.insert("Learn iOS", atIndex: 1)
Joseph Kandi
Joseph Kandi
2,640 Points

To add new contents to the array you would write code like this :

var todo = ["Learn Swift", "Build App", "Deploy App"] 

todo += ["Publish App"]

or you could use the the append function like this

var todo = ["Learn Swift", "Build App", "Deploy App"] 

todo.append("Publish to App Store")
var todo = ["Learn Swift", "Build App", "Deploy App"]

todo.append("Debug App")
todo.append("Fix Bugs")