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!
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
Juran-Perez Moodley2,018 Points
Need help on task 2 in the challenges. My code isn't working.
There's a few points to this challenge. First, you need to make the
treehouseBaseURL which you've already done.
Then you need to create a relative URL based on the given
courseID and a slightly modified URL. You need to append "course/" to the base URL and then ID at the end of it. You can do that with String Interpolation,
"course/\(courseID)" is the correct suffix to add to the existing URL.
You end up with:
let courseID = 25 let treehouseBaseURL = NSURL(string: "https://api.teamtreehouse.com/") let courseURL = NSURL(string: "course/\(courseID)" , relativeToURL:treehouseBaseURL)
That should get you through the challenge.