iOS Tutorial: Protocols and Delegates Explained Part 1

preview_player
Показать описание

--
50% off my iOS Development Fundamentals Course on Udemy:

or use CODEPRO999 for 50% off the course price.

--
iOS Development Fundamentals Course on Skillshare:

--

In part 1 of this iOS tutorial we will be learning about protocols and protocol oriented programming in Swift. We will understand what a protocol is and how to write one. We will learn how to have a class or a struct conform to a protocol. We will cover how to implement protocol extensions and discuss the benefits of protocol oriented programming and the value it can add to your code. Be sure to stick around for part 2 where we will learn how to implement a custom delegate and get a deeper understanding of the delegation design pattern. This tutorial uses Swift 4 and Xcode 9.

--

Useful Learning Resources

--

Be sure to download some of the apps I've built:

--

Social Media:

If you found this tutorial helpful please like the video, share the video, and consider subscribing to CodePro to help this channel grow and help others. You can follow CodePro on Twitter and Facebook, for the latest channel news and updates.
Рекомендации по теме
Комментарии
Автор

Learn how to adopt protocol oriented programming patterns into your app to promote code reusability, testability, and many other benefits discussed in this video.

CodePro
Автор

Absolutely amazing explanation) Thank you!

Anya
Автор

Brilliant tutorial. Thank you so much for posting this. It's hard to grasp the idea of protocols in relation to structures / classes and why that is even a useful relationship by just following through syntax tutorials like Hacking with Swift. This example is really articulated well with the bigger picture on how protocols can tie together types of objects.

AlexHannemanVFX
Автор

Hey! Very well prepared video, really learned a lot. It is a little difficult to wrap your head around the protocol business as a learner, but you did an awesome job with your game analogy! Much clearer now. Thx! Keep ‘em coming :)

michaelandersen
Автор

Like u teach protocol awesome I now don't have any question about it after seeing your this tutorial thank you sir 😇😇😇😇

valuegaptrader
Автор

Hey! On xcode, I have this problem: Type '()' cannot conform to 'View'; only struct/enum/class types can conform to protocols how do I fix it? Thanks!

aarna
Автор

I have a few questions about this video.

1. Is there any logic behind what you choose to be a struct and what you choose to be a class? I cant really see why the Mini-Boss SHOULD be a struct and the Final-Boss should be a class.

2. You explain that extensions on Protocols are something we can use to make every instance that conforms to the Boss-Protocol and the Boss-Protocol-Extension have the function "tauntPlayer". You use this in your example.

But what I dont understand is that, if you just put that function INSIDE the protocol. Every class or struct that conforms to that function MUST implement that function... Which is the same thing? So... why use an protocol extension?

OR, is it that a Protocol CANT have LOGIC (or code) in their functions. Which means that an extension on a protocol have a usefulness. You can use extensions on protocols to have an fully implemented function on all entities that conform to the protocol.

I will try this myself in a playground, but for the value of teaching others in the comments this could be valuable. :)

Thank you for the video!

Siniom_swe
visit shbcf.ru