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
how do u do this
Stone Preston42,016 Points
you need to use string interpolation to interpolate the course ID onto the end of the string.
since the full url used to access a course looks something like "https://api.teamtreehouse.com/course/COURSE_ID", you can see that /course/COURSE_ID is the part of the url thats going to be relative to the base URL, which is "https://api.teamtreehouse.com/".
so interpolate the value of courseID onto the end of the string "course/" and use that as the string parameter.
import Foundation let courseID = 25 let treehouseBaseURL = NSURL(string:"https://api.teamtreehouse.com/"); let courseURL = NSURL(string: "course/\(courseID)", relativeToURL: treehouseBaseURL);