- [Instructor] As per API documentation,…we expect JSON data in the payload.…I'm going to rely on the JSON parsing capabilities…introduced with Sys4.…We can map JSON payloads to objects…that have a similar structure…without writing a single line of code.…All we have to do is define the objects…that match the JSON structure.…So I went ahead and created the structures…for the OpenWeatherMap service payload…to save us some time.…Let's add this file to the project.…
So I select the Networking group, right-click on it,…and choose Add Files to "Weather App".…From the AddOn folders, I pick up the mappings file,…and add it to our project.…As you can see, so these are the structures…that match the JSON payload.…The property names and their type…must match the corresponding keys and values…in the JSON structure.…Now, let's get back to our NetworkController.…
To decode the response,…I'm going to rely on the private helper method,…so let's uncomment it.…Next, I need to make sure that the return data is not nil.…If the payload is nil, I'm going to return an error…
- Comparing object-oriented programming with protocol-oriented programming
- Methods and class-bound protocols
- Adopting a protocol
- Declaring asynchronous behavior
- Preparing and implementing fallback logic
- Implementing an app using protocol-oriented programming
Skill Level Intermediate
1. Protocol-Oriented Programming
4. Implement the Weather App Using POP
- 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.