Explore how to implement the networking/weather data access layer first.
- [Instructor] So let's start defining our…network access layer.…First, I create a new group, I call it Networking.…Then, I add the new Swift file.…New file, Swift.…I call it NetworkController.…Let's remove the header, we don't need it.…Now, instead of creating a base class,…I start by defining a protocol.…Let's call it NetworkController.…
I make it public so that it can be accessed…from everywhere else,…and call it NetworkController.…We need a method for fetching the weather information.…Let's call it fetchCurrentWeatherData.…The method needs at least one parameter,…the name of the city, which is of type string.…The method should return a meaningful set of data,…which describes the weather.…Let's call it weatherData.…
I'm going to make the return value optional.…We may not always be able to return valid information…since we're relying on networking.…The method takes a single argument, the name of the city,…and returns this weather data instance,…but we haven't defined the weather data type yet.…We're typically interested in the temperature…
- 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.