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 a Simple iPhone App with Swift Creating a Data Model Creating a Data Collection

Michael Hanna
Michael Hanna
17,649 Points

Code will not compile in challenge, compiles ok in Xcode

It's a pretty simple challenge task (I think).

Create an array named shoppingList and add the following items as strings - "toothpaste", "bread", "eggs".

My code compiles ok in Xcode, and matches the formatting used in the previous exercise, but in the challenge I get a compiler error. It says "click preview to see compiler errors" but when I click preview it is totally blank.

data_collections.swift
var shoppingList = ["toothpaste", "bread", "eggs"]

2 Answers

Hey Michael and Jason,

We do apologize for any confusion! The reason the code returns as invalid because our code challenge engine doesn't support that version of swift anymore. This is an outdated course that was accidentally reactivated. We recommend checking out this course instead that is current. We hope this helps!

Best, Kara

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Michael,

Your code is correct. I believe there may be something wrong with the Challenges, as I've tried 2 other challenges in this course and all are failing. I've sent a message to Support, but it wouldn't hurt if you shoot them an email too.

:dizzy: