Join Károly Nyisztor for an in-depth discussion in this video Implement fallback logic, part of Swift 4: Protocol-Oriented Programming.
- [Instructor] To save us some time…I went ahead and created a second network controller.…This one relies on the APIXU web service.…Here's the web page.…As we did for the open weather map…you'll need to register for a free account…to get an free API key.…Now, let's go back to X code.…I'm going to add the net for controller…from the add-ons folder.…It's called APIXU Network Controller.…
So let's add it to our project.…The APIXU network controller…adopts the Network Controller protocol.…The Fetch current Weather data method is similar…to what is implemented for the other…network controller.…It relies on URL session…and it caused the URL session data task…in order to retrieve the weather data.…And, similarly we use a private method…to record the json data.…
The return payload is obviously different from what…we got here for the open weather map service.…I created the codeable structure…that match the return json payload.…Let me add that file also quickly to the project.…Add files.…Add-ons folder and APIXU data mapping dot swift.…
- 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.