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

I'm work with lists in arrays, and I need to add an item.

This is a 3 part question I got the other 2 parts correct, its just the last part I wrote I couldn't get correct, I wrote what I thought it should be, here is a screen shot, tell me what you think. Thanks Imgur

2 Answers

If you want to add more items to an array, you just need to call .insert method for example

      var name = [String]()
      name.insert("My_Name", atIndex: 0)

So now the name array has a new item at index 0. Hope that helps

I just tried what you mentioned and I it did't take that. I think its a simple solution, but I can't figure out how to solve it. Any more suggestions let me know. Thanks

I gave you an example not the answer.But the answer is todo.insert("Learn Ios", atIndex: 1)

Thanks, this is what I came up with, I still didn't get it, but i think I may have forgotten a period. I'm going to look at it again in a second. Imgur

I didn't see what you just wrote until I did the work myself I got the same thing you wrote, but it didn't accept it. Hmmm, maybe its a small typo that I'm not seeing. I believe it is a minor mistake and think I will move on and look at it again in more detail later. Nice meeting you I'm from Ct. Have a good day.

Glad to help you if anything just tag my name into a post .. if you are having problem

I just re-typed it and it worked the first time. I must have had a typo or something. How do I tag your name as you mentioned if I have a question in the future.

This "@" + type my name .. And also vote this post as the best answer if it helps you.

ok I tried that another question I had which I solved let me know if you got it.

Ok I voted it the best answer. So I write "@"MeekD and where where exactly do I write this. Plus did I write it correctly??

in the comment box type @ then type the person name