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 Network Programming with Swift 2 Implementing a Forecast Client Endpoint Enum

Kevin Murphy
Kevin Murphy
24,380 Points

Question about endpoint relative to forecast.io API docs

The forecast.io api docs say there are two types of requests:

  1. - A forecast request: https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE
  2. - A time machine request: https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE,TIME

Want to ensure I am understanding clearly what is meant by endpoint relative to a request. Would adding a second endpoint member to the the Forecast enum look like this?:

enum Forecast: Endpoint {
    case ForecastCurrent(apiKey: String, coordinate: Coordinate)
    case TimeMachine(apiKey: String, coordinate: Coordinate, time: NSTimeInterval) 

Yes thats right, if you are planning to use unix time.

2 Answers

Anthony Boutinov
Anthony Boutinov
13,844 Points

You've answered your question yourself)

Kevin Murphy
Kevin Murphy
24,380 Points

Ok good to know, Thanks for the feedback guys