Join Károly Nyisztor for an in-depth discussion in this video Adopting a protocol, part of Swift 4: Protocol-Oriented Programming.
- [Narrator] If we wish…to create the time conforming to increment protocol,…we must declare and define…the matching properties and methods.…So let's create the structured called TaggedData.…It is going to adopt the Binary Representable Protocol…but it doesn't conform to the protocol yet.…Autocomplete can add the missing stops for us.…So let's do that.…The stops have no increment data showing yet,…so let's adjust some code.…
I'm going to return false for now.…The Increment Counter should increment the counter's value.…Next I am going to implement the initializer.…So let's initialize our tag…and data properties.…Equals data.…Alright now…I have to provide the default value…for the static counter instance.…Let's initialize it to zero,…and the code should compile just fine.…
- 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?
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.