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

Jeremy Medford
Courses Plus Student 16,096 PointsBest way to modify path in VenueEndpoint to include a dynamic path?
In FoursquareClient.swift, the existing path looks like this:
var path: String {
switch self {
case .Search: return "/v2/venues/search"
}
}
I'm trying to add a case for Tips that takes a VENUE_ID in order to build a path like this:
var path: String {
switch self {
case .Search: return "/v2/venues/search"
case .Tips: return "/v2/venues/<VENUE_ID>/tips"
}
}
At the moment I'm a bit stuck, but I'm going to keep at it and post an answer when I've got it. Thanks.

Jeremy Medford
Courses Plus Student 16,096 PointsOk, I think I found one solution. It's important to note that this is code taken directly from the FoursquareClient.swift file that is part of the the Course listed above.
I have a new case defined prior to the path...
case Tips(clientID: String, clientSecret: String, venueId: String, sort: SortType?, limit: Int?, offset: Int?)
Then my updated path declaration looks like this...
var path: String {
switch self {
case .Search: return "/v2/venues/search"
case .Tips( _, _, let venueId, _, _, _):
return "/v2/venues/\(venueId)/tips"
}
}
Pretty clean.
Reed Carson
8,306 PointsReed Carson
8,306 Pointswell right now you are trying to switch on a string as if it is an enum. "path" does not have any cases for you to switch on by calling .Search or .Tips
I dont have enough information to know if this will help you
this can probably be improved greatly but just off the top of my head I THINK this might accomplish what you want, but I cant be sure without a greater context. Maybe you can pick and choose and modify it to work for you. Or maybe this isnt what you were looking for. If its not what you meant, clarify your question a bit more