With location services enabled you can now use the user’s location to retrieve weather forecast data from the OpenWeatherMap API. To make API calls, you need to make some adjustments to the Info.plist file. Thanks to the provided helper classes and structs, it is very easy to store the information received efficiently to later populate the user interface of your Apple TV app.
- [Instructor] So far, we can already…get the user's current location and display this location,…but what we cannot do…is give a weather forecast for this location…that is going to change right now.…So in our properties section right above viewDidLoad…I've created a new section for weather properties.…And here I'm going to add a weatherArray which is…going to store objects of type Forecast,…and I'm going to initialize that right here.…
And if we have a look at our Forecast struct,…this stores temperature, condition name…and condition description.…This is what we are looking for,…and this is also what we get from our Web API.…So back in your location ViewController,…I'm going to jump down to a Weather section,…this is right below all the code that we're written…for that update location.…So in line 143, I'm going to define a new function…which I'm going to call getWeatherForLocation…and this going to get the parameter called location…which is of type CLLocation and a ForecastIndex…which I'm going to call Index of type integer.…
- The Siri remote
- The focus model
- Adding video assets and imagery
- UIKit components
- Location services
- Accessing a Web API
- Enabling the top shelf and layered images
- Setting up shortcuts
- Communicating with URL schemes
- Adding a layered app icon
Skill Level Beginner
1. Introducing tvOS Development
2. Your First tvOS App: Build the UI
3. Your First tvOS App: Add the Logic
4. Multipeer Connectivity
5. Final Touches
Next steps1m 18s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.