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 Swift Basics (retired) Collections Modifying an Array

Finally, we forgot to add that we need to learn iOS devlpmnt prior to buildng an app. Insrt a new item titled"Learn ios"

i have been trying this queston and not able to slove, i have done as it is and it shows error,but it seems there is no error in my program

arrays.swift
var todo = ["Learn Swift", "Build App", "Deploy App","Debug App","Fix Bugs"]
let item = todo.removeAtIndex(2)
todo.insert("Learn ios",atIndex: 2)

1 Answer

Jhoan Arango
Jhoan Arango
14,575 Points

Hello:

Everything seems to be Ok with your code, but you are inserting the item in the wrong position (index). The challenge says to place it in the second position which is index 1, but you have it in index 2, which is the 3rd position.

Good luck