Swift Delegate Protocol Pattern Tutorial - iOS Communication Patterns Part 1

  Переглядів 165,997

Sean Allen

Sean Allen

6 років тому

The next topic in my series on iOS Interview questions explains the Delegate Protocol Communication Pattern in Swift. This is a fundamental question in iOS development and I was asked about it a lot during my interviews. In this tutorial I'll walk you through how the delegate protocol pattern in Swift works, using Xcode.
iOS Dev Courses - seanallen.teachable.com/
This is part of a series of videos about iOS interview questions in Swift. Check out the overview where I list and briefly discuss all the topics that are in this series:
• iOS Interview Question...
Project Source Code:
www.dropbox.com/sh/eamlgg3hk5...
iOS Dev Courses:
seanallen.teachable.com/
Twitter:
Sean Allen - / seanallen_dev
Hired.com:
hired.com/x/1n01g
Book and learning recommendations that help out the channel if you decide to purchase (Affiliate Links):
Paul Hudson's Hacking With Swift:
gumroad.com/a/762098803
Donny Wals - Combine:
gumroad.com/a/909014131
Mark Moeyken’s SwiftUI Books:
www.bigmountainstudio.com/swiftui-views-book/fzc51
Objc.io Books (Thinking in SwiftUI & Advanced Swift):
gumroad.com/a/656585843
Ray Wenderlich Books:
store.raywenderlich.com/a/208...
#swift #softwaredeveloper #iosdeveloper

КОМЕНТАРІ: 575
@seanallen
@seanallen 4 роки тому
Watch Next - iOS Take Home Project - Job Interview Practice - Free Preview - ukposts.info/have/v-deo/hYN6mWiwbXyWxmw.html
@mrmillmill
@mrmillmill 3 роки тому
Hey Sean, I bought your iOS Dev course from your site and man I really wish I would’ve bought it sooner. I am a firm believer in the pay to play mentality and your course is just one more reason for that. I’ve just gone through the first five videos and you are very thorough, clear, and straight to the point giving the student everything they will need. I also like that the whole course is done programmatically without a storyboard. I honestly cannot say enough great things about what I’ve experienced so far.
@lamdbich
@lamdbich 6 років тому
Finally someone who values my time so that I don't have to speed up the videos. Keep it up.
@gianluigidautilia6417
@gianluigidautilia6417 3 роки тому
i have watched all youtube videos on this topic on youtube. Most of them you fall asleep, or you have some guy trying to give sense to his thoughts. 99,99 % of the times are just pure confusion. Here Sean in 13 minutes goes so straight and clear to the point that even you are a total beginner you will understand it. Impressive. He speaks fast, but i have noticed that you need to keep this peace and speed of words not to get too lost in thoughts. Amazing job man. thanks.
@ericamillado
@ericamillado 6 років тому
The "intern" and "boss" analogy is so helpful, keep these videos coming!
@seanallen
@seanallen 6 років тому
Glad you enjoyed it, Erica! I've always been pretty good at coming up with analogies to explain things... it's a fun way to teach.
@samrakkaus8178
@samrakkaus8178 5 років тому
this is the first analogy for protocols/delegates that finally made me understand the concept. Thank you Mr. Allen.
@mryup6100
@mryup6100 5 років тому
agree
@AmitThakur-eg8kb
@AmitThakur-eg8kb 3 роки тому
one of the best iOS teacher on this planet. Good job Sean.
@seanallen
@seanallen 3 роки тому
Thanks for the kind words, Amit.
@ebubeawachie
@ebubeawachie 2 роки тому
Oh my goodness!!! This is the absolute best explanation of Delegates and protocol I have seen on the internet. Thanks so much Seal Allen. You be doing so much for us Swift noobs.
@seanallen
@seanallen 2 роки тому
Glad it was helpful, Mark!
@ebubeawachie
@ebubeawachie 2 роки тому
@@seanallen Sean, I’m having this issue of lack of confidence. I just started this journey some months ago band I’m switching from a career in medicine (I’m a Veterinary Doctor with an MSc in Veterinary Physiology but I’ve always loved technology). Sometimes it feels like I can’t just cut it. I’ve always been good academically graduating best in high school and college but coding is just a different ball game. I’ve always been able to understand things really really quickly but some things here just take a while to grasp. Is this normal for everyone? Are there any insights you can share for dealing with this? Sorry for the long read.
@seanallen
@seanallen 2 роки тому
Yes, this is normal. Coding is hard to learn at first, but just like any skill, the more you do it the more comfortable you get. I don't have any secret tip or anything. It's all about putting in the time and repetitions (just like any other skill). Then one day, things just start clicking.
@thomasgarayua4979
@thomasgarayua4979 2 роки тому
Thank you, thank you, thank you... It's amazing how great your analogies are. It really helped me understand the flow of data and how everything works. I was having a moment a few days ago thinking "Maybe Software Engineering isn't for me. I don't understand this stuff and I can't do it. I should honestly give up." Its great to see that there's people out there like you that can articulate in non-technical terms to make understanding this stuff that much easier. Thanks again, you've earned one more subscriber!
@snebold
@snebold 6 років тому
Hey, I love your tutorials! I think the speed is fine, but I especially appreciate the fact that you don't waste time launching Xcode and setting up the UI like so many other tutorials out there. You just get to the meat of the matter. Thanks!
@seanallen
@seanallen 6 років тому
+Bill Snebold Thanks, Bill. I hear ya on that. I remember learning myself, and I always hated all the setup on EVERY video. As you've seen, i just do a quick review of my starter project, then on to he good stuff.
@mashfique
@mashfique 6 років тому
This whole video was a "Aha" moment for me! Your videos are really good for reviewing concepts! Please keep uploading them :)
@seanallen
@seanallen 6 років тому
+Mashfique Anwar Thanks! More on the way!
@thomasdermaris4984
@thomasdermaris4984 6 років тому
You have to declare your delegate var as weak to avoid reference cycles. This is one common question to interviews too..
@seanallen
@seanallen 6 років тому
Hey Thomas, thanks for the feedback! I appreciate you guys keeping me honest. Anytime you put your code out there for the world to see, there's bound to be some missteps. To your point, you are correct if you declare your protocol as a class protocol, like `protocol SideSelectionDelegate: class', then you need to declare the delegate variable as 'weak' to avoid retain cycles. However, if don't declare your protocol as 'class' you're allowing your protocol to be adopted by structs, which are value types, and therefore don't really work with reference counting. This blog post provides a good explanation: useyourloaf.com/blog/quick-guide-to-swift-delegates/ . It's a clarification I neglected point out in my video. Thanks for bringing it up!
@thomasdermaris4984
@thomasdermaris4984 6 років тому
Thanks for your answer Sean. To tell you the truth I wasn't aware of that..
@anupdsouza
@anupdsouza 6 років тому
I had the exact same question when I began watching this video, glad I scrolled through the comments to find your reply Sean :)
@wilsonbalderrama
@wilsonbalderrama 6 років тому
My first thought (I need to test it, will do it tonight) about this is that we are dealing with class instances and that's why I think there are memory leaks.
@wilsonbalderrama
@wilsonbalderrama 6 років тому
OK I tested and I didn't find a strong reference cycle I believe that's because BaseScreen instance doesn't have a property that's referring to the SelectionScreen instance.
@GameAssetsGarden
@GameAssetsGarden 2 роки тому
Thank you so much for making this tutorial! I was struggling for hours but then I watched your video and got my code working shortly after.
@seanallen
@seanallen 2 роки тому
Happy to hear it was helpful to you project!
@JamesEtallaz
@JamesEtallaz 2 роки тому
I love your pacing. Straight to the point. And fast. Every time. Well done.
@lilyshevchenko7048
@lilyshevchenko7048 6 років тому
You, Sir, are my hero! I am going through a coding bootcamp and our platform laid out info about protocols and delegates in such dry, confusing manner that I was struggling to understand what goes where until I saw your demo. In less than 10 minutes, everything snapped into place for me! Love the easy to understand and engaging example and love boss/intern analogy. Thank you for sharing your know-how.
@seanallen
@seanallen 6 років тому
Happy to hear it helped you, Lily. I struggled with Delegates/Protocols for the first 6 months of my career, so I know how ya feel!
@atheros07
@atheros07 3 роки тому
Clearest explanation of delegates in Swift I’ve ever found. Thanks Sean!
@seanallen
@seanallen 3 роки тому
Thanks! Glad you enjoyed it 😀
@stomachcontentz
@stomachcontentz 5 років тому
Sean - love your stuff. It's great when you find someone who thinks in a similar way to you which makes the information transfer fast and effective. Maximum respect so much for taking your time to make these videos.
@seanallen
@seanallen 5 років тому
Thanks for the kind words, Christian! Motivates me to keep going!
@dorianbrown1588
@dorianbrown1588 5 років тому
One of the best iOS instructor! This tutorial helped me understand after countless hours understanding protocols and delegates!
@seanallen
@seanallen 5 років тому
I appreciate the kind words, Dorian 🙌
@arnavgaur9034
@arnavgaur9034 2 роки тому
The best explanation I have seen so far. Great content Sean!
@seanallen
@seanallen 2 роки тому
Thanks for the kind words, Arnav 😀
@djskywalkerremix
@djskywalkerremix 6 років тому
I have been struggling with this for about two months now and you just made it so clear for me and I now understand it !! Thank you so much, you sir are a gent and a scholar !!
@seanallen
@seanallen 6 років тому
That's awesome to hear, Neil. Happy to help!
@BodhiMoosa
@BodhiMoosa 5 років тому
I spent the entire afternoon (and now night) tackling the problem of understanding delegates and their application. I've read article after article, downloaded and attempted to analyze projects provided by others, and read official documentation, but everything I've read and seen thus far seems to attempt to explain this concept to people who already understand this concept. Your video here actually explains the concept and relationships very well to someone like myself who is trying to get into coding.
@seanallen
@seanallen 5 років тому
Happy to hear you found it helpful, M 👍
@hanzularaza4564
@hanzularaza4564 5 років тому
Sean you are unfolding the most difficult topics of iOS development with so much ease , after your videos everything makes more sense to me .. Thanks Buddy
@seanallen
@seanallen 5 років тому
Glad you found it useful, Hanzula. I've got a lot more videos 😀
@syedmahmudahmed8921
@syedmahmudahmed8921 2 роки тому
Short, simple and precise. This is the best tutorial on delegate protocol communication pattern I've found as a beginner. Bonus points for referencing Star Wars. Thanks man.
@stevefreed3646
@stevefreed3646 6 років тому
Thank you so much! I could not find any helpful videos explaining protocols. Everyone elses videos weren't clear on how to use them in different situations, your video really helped me understand how to use them in all types of situations.
@seanallen
@seanallen 6 років тому
Happy to hear it helped, Steve!
@PhontaineJudd
@PhontaineJudd 6 років тому
Enjoy watching your videos. They're presented in a clear, logical way that makes it easy for me to understand. Thank you!
@seanallen
@seanallen 6 років тому
Glad you enjoy them, Phontaine!
@ryanjin8343
@ryanjin8343 4 роки тому
I was using a static variable to pass data back and forth yesterday. I knew there had to be a better way, and after watching this video, I immediately went back to my project and changed it to a delegate-protocol pattern. The code is so much cleaner. Thank you so much Sean!
@seanallen
@seanallen 4 роки тому
Happy to clear that up, Ryan!
@chrism8943
@chrism8943 Рік тому
Why is this a better way than passing a variable? I just don't understand... it doesn't seem straight forward, like "beating around the bush." I just don't get, WHY use delegates? Isn't there a simpler way?
@firstjamesryu
@firstjamesryu 2 роки тому
So close to 100k subscribers. Congratulations in advance, Sean!
@seanallen
@seanallen 2 роки тому
Thanks James!
@mauricio2099
@mauricio2099 6 років тому
Thanks Sean, This is the best explanation of delegates by far. The Boss/Intern analogy is exactly what I needed to fully understand the concept. Great Stuff!
@seanallen
@seanallen 6 років тому
Thanks Mauricio! Glad it helped. Appreciate you sharing via tweet as well.
@trevorduersch2278
@trevorduersch2278 5 років тому
Sean, I always appreciate these videos that you produce. They are very enlightening and have helped me a lot in my iOS development. I'm in the process of switching my career from a PeopleSoft HCM developer to an iOS developer and your videos have pushed me further than I could imagine! Thanks for what you do and keep it up!
@seanallen
@seanallen 5 років тому
That's awesome to hear, Trevor! Thanks for the motivating words. Happy to hear I can help. Keep at it!
@TreyCox1
@TreyCox1 5 років тому
I just had my "aha!" moment while watching this video. Super helpful, Sean. Thanks for these videos and for the great podcast.
@seanallen
@seanallen 5 років тому
Awesome! Love those moments 😀
@timharris72
@timharris72 6 років тому
This is the best explanation I have seen so far of what delegates do. I do Qt programming (Python) and use delegates all the time for table views but it was always difficult for me to explain the Swift syntax to other people or understand the Swift syntax using delegates as it is a little bit different although the concept is the same. Thanks for the help.
@seanallen
@seanallen 6 років тому
Glad to hear the video helped out, Tim!
@amdizle28
@amdizle28 5 років тому
Keep making Tutorials Sean, you helped me choose my career path and your videos are extremely efficient for learning! Started with your iOS interviews video and now I work as an iOS Developer, dreams do come true and your videos continue to help every time I need to learn!!!
@seanallen
@seanallen 5 років тому
That's awesome to hear Adam! Congrats on the new job!
@blackjaquar
@blackjaquar 6 років тому
One of the best Delegates/Protocol tutorials I've seen. Thanks
@seanallen
@seanallen 6 років тому
Much appreciated Bahe! Happy to hear the video helped!
@faiz.mohammed
@faiz.mohammed 5 років тому
HIGHLY RECOMMENDED VIDEO! Just had a question regarding Communication Protocols in my technical interview with a large company today. I knew the whole concept but couldn't put it into words, wish I had watched the whole series earlier. Thanks for the video, Sean.
@seanallen
@seanallen 5 років тому
Glad it was helpful... although a little too late it sounds like. 😀
@MikhailFederov
@MikhailFederov 2 роки тому
10:44 My heart sank when you said “This function is automatically getting called”. That’s the one part I don’t understand about delegates but it was hand-waved away. Every video so far o delegates does this
@infinite5837
@infinite5837 4 роки тому
Great video! I'm currently building an application and this has made my life way easier. I was using notifications and observers. However, I started to notice that my code was getting messy. So I took the time to learn how protocols work and restructured my application. Great decision and good learning experience. Thank you!
@seanallen
@seanallen 4 роки тому
Happy to hear you found the video helpful, Sergio 😀
@MarcosVicente0
@MarcosVicente0 4 роки тому
Hey, Sean! I was really struggling to understand Communication patterns with Delegate protocol. This example and explanation just made very simple to understand. Im definitely a video learner. Thank you! Take care!
@seanallen
@seanallen 4 роки тому
Glad the video helped you out, Marcos!
@hiba60164
@hiba60164 Рік тому
Your teaching method is amazing, loved the video.
@seanallen
@seanallen Рік тому
Thanks for the kind words, Hiba 😀
@chrispy104k
@chrispy104k 4 роки тому
It's an oldie but a goodie. Great stuff Sean.
@seanallen
@seanallen 4 роки тому
Always fun to go back and revisit 😀
@chrispy104k
@chrispy104k 4 роки тому
Sean Allen Truth is that the content was something that I didn’t fully understand despite the courses I have done. Your description gelled immediately so my hats off to you. Happy to have filed that one away for the future.
@seanallen
@seanallen 4 роки тому
Many of the topics in programming and iOS development will take repeated study. Glad it was helpful!
@petermattheisen9856
@petermattheisen9856 2 роки тому
Perfect!!! Sean, thanks a lot for making this mechanism so clear and easy to understand. Your code and explanations are straightforward and bring it to the point.
@sravk245
@sravk245 3 роки тому
Your video tutorials and the comments left by viewers are very informative. I attended an in person iOS course and couldn't really follow my instructors explanation of this topic. Thank you for such a straight forward explanation, very easy to follow.
@seanallen
@seanallen 3 роки тому
Thanks Srav! Glad you are enjoying the content!
@nusretalikzlaslan8063
@nusretalikzlaslan8063 2 роки тому
Great video! I finally get the idea of the protocols and delegates. Analogy worked really well. Thank you.
@satyam3993
@satyam3993 5 років тому
Thank you so much!! Even after reading bunch of Medium posts, I wasn't clear with the concept of delegates. Thank god I found your life saving video :) Keep making videos, coz you are really good at it!!
@seanallen
@seanallen 5 років тому
Thanks Satyam! Glad it helped you out! I know this is a tricky topic.
@Tenly2009
@Tenly2009 3 роки тому
I’ve watched a video about delegates/protocols every 3 months for the past 2 years and have always tuned out with glazed eyes about halfway through and walked away more confused than when I started. It was always difficult for me to envision the demo use case - but this time, I think I finally get it! (Probably because I was using Singletons and didn’t need to pass data between viewcontrollers - I just updated the global object and then had each VC “refresh” when something else changed a value) But in my current project, I’ve tried to avoid using singletons and instead I’ve been adding a variable named parentVC to all of my selection screens and then having the callingVC set it equal to “self” right before I present it - that way I have a link to the callingVC. But then in the selection screen class, I’d have to attempt to unwrap the parentVC against 2 or 3 different viewcontrollers to figure out which one it was called by and then call a function in it called “didTapWhatever()”. It was messy and felt wrong - but I didn’t know any other way. Now I see how using a delegate simplifies that and makes it much cleaner! Thanks Sean!!!
@nileshjdarji
@nileshjdarji 3 роки тому
Man I still sometimes don't get my head to wrap around delegates and protocols concept. But luckily I have this video of yours bookmarked so I always go back to watch it again to make myself clear. Awesome boss and internal anology. Thank you.
@aldovernando4395
@aldovernando4395 3 роки тому
Really great analogy and easy to understand! Love ur channel! I am your observer now 😄
@seanallen
@seanallen 3 роки тому
Glad you enjoyed it, Aldo!
@rollingchamp
@rollingchamp 2 роки тому
Best video on this topic by far. Thank you
@vuduong4
@vuduong4 5 років тому
Been struggling with this for a while now, finally makes sense. Thanks Sean!
@seanallen
@seanallen 5 років тому
Happy to help, Vu 👍
@JasonMitchellAZ
@JasonMitchellAZ 4 роки тому
Just came across this video again... Wow, just over 2 years since you posted it! Still love the "intern and boss" analogy! 💯
@seanallen
@seanallen 4 роки тому
It's a classic... I talk insanely fast... but other than that, I like it.
@rebeloper
@rebeloper 4 роки тому
Yes, these things are evergreen
@TourGuideFTW
@TourGuideFTW 6 років тому
Love the way you explain, please keep it up!
@seanallen
@seanallen 6 років тому
Thanks Simon! More videos on the way!
@shoebmoin10
@shoebmoin10 6 років тому
This was the first time i read all the comments of a video , they were very informative thanks for replying all the questions sir :-)
@seanallen
@seanallen 6 років тому
I can't always get to all of them (some comments are very detailed questions), but I try to get to as many as I can. Happy you appreciate it!
@michaelszabo3071
@michaelszabo3071 2 роки тому
As soon as I see its a video made by Sean it gets the like.
@LaurentShala
@LaurentShala 6 років тому
Such a great video. Very informative and fast paced (in a good way).
@seanallen
@seanallen 6 років тому
Thanks Laurent! Glad you enjoyed the video and pace!
@Guapoaggie
@Guapoaggie 5 років тому
Your videos are so helpful Sean! Just wanted to say thank you
@seanallen
@seanallen 5 років тому
Thanks! Glad you enjoy them 👍
@ChrisHolschuh
@ChrisHolschuh 4 роки тому
Another one of your videos helping me out of a bind!! Thank you!
@seanallen
@seanallen 4 роки тому
Happy to help, Chris 😀
@3ilz
@3ilz 3 роки тому
The boss vs intern analogy is genius!
@cometmace
@cometmace 6 років тому
Nice, concise explanation. In the boss code, "we're safe to force unwrap that because we know we have the UIImage..." @7:35. Someone else taught me "Protect yourself against mistyping a UIImage you know you have by safely unwrapping it..." You would hope you'd catch a runtime error like that during testing, but stuff happens. p.s. I just noticed Ben Sullivan's comment. That would solve this issue.
@MrEcsplorer
@MrEcsplorer 6 років тому
Very nice videos. I like your speed. Very logically explained and very supportive analogies.
@seanallen
@seanallen 6 років тому
Thanks Timo! Glad you enjoyed the video!
@mutasemwahbeh6954
@mutasemwahbeh6954 3 роки тому
Thank you Sean, your explanation was great !
@seanallen
@seanallen 3 роки тому
Glad it was helpful!
@farahmassuh7323
@farahmassuh7323 3 роки тому
Thank you boss (Sean Allen). I (intern/delegate) will implement this lesson right away!
@foocux
@foocux 6 років тому
Great video bro, you're such a good teacher!
@seanallen
@seanallen 6 років тому
+Leonardo Emilio Thanks for the kind words! Glad you enjoyed the video.
@pavanbhupatiraju6653
@pavanbhupatiraju6653 6 років тому
Great analogy that clears the air on how delegates work.
@seanallen
@seanallen 6 років тому
Happy it helped, Pavan!
@codewithmusto
@codewithmusto 4 роки тому
You explain really well, Sean. Great video, thanks a lot.
@seanallen
@seanallen 4 роки тому
Glad you liked it!
@ucmasshankar
@ucmasshankar 4 роки тому
Thanks for the clear and crispy explaining protocol.
@seanallen
@seanallen 4 роки тому
Glad you liked it!
@DavidNoyMusic
@DavidNoyMusic 2 роки тому
Very useful, simple and easy to understand video, thanks!
@govindsuryawanshi9052
@govindsuryawanshi9052 5 років тому
Simply great explanation with rapid speed and a good example(intern - boss)
@seanallen
@seanallen 5 років тому
Thanks Govind! Glad it was helpful👍
@shiliangzhang5172
@shiliangzhang5172 6 років тому
i dont usually comment but when i do it's because its a great video!
@seanallen
@seanallen 6 років тому
Glad you enjoyed it!
@valentinzech8800
@valentinzech8800 3 роки тому
Best video on this topic I've seen so far. Thank you!
@seanallen
@seanallen 3 роки тому
Glad it was helpful!
@YummyHealthyCookingShow
@YummyHealthyCookingShow 6 років тому
One day i asked god to teach me iOS and he had sent you... Stay blessed @Sean Allen
@seanallen
@seanallen 6 років тому
Thanks Lalitha!
@AnHoKuka
@AnHoKuka 3 роки тому
Man you are rocks! Thank you for your video an explanation, it was helpful
@seanallen
@seanallen 3 роки тому
Happy to help, Anton!
@s.d.1091
@s.d.1091 3 роки тому
Great video! how would I apply this to enabling a button on the first/intern view controller? I keep trying different things with no luck
@thestophewatts6689
@thestophewatts6689 6 років тому
Hey Sean I found this isolated example super helpful. Great video, thanks!
@seanallen
@seanallen 6 років тому
Happy to hear it helped, Christophe!
@TheHy6xD
@TheHy6xD 6 років тому
omg, I finally understood how it works, thank you very much!
@seanallen
@seanallen 6 років тому
Glad to help, Dosbol!
@wordpressmagics2613
@wordpressmagics2613 Рік тому
Thank you for such clear and understandable video! But I'm still a bit confused of what is happening after rebel/imperial logo tapped. Where is the place in the Intern code which is triggering changes? Was it just because Intern screen is a delegate for "commands" of Boss screen and because of conformation to the protocol?
@charmisolanki2891
@charmisolanki2891 6 років тому
great tutorial ... i am new in IOS development .. your tutorials are really helpful , keep making videos for beginners
@seanallen
@seanallen 6 років тому
Thanks Charmi! Glad you enjoyed it.
@jachuonbass
@jachuonbass 5 років тому
Dude, you speak so fast sometimes is hard to keep up but great stuff, finally it's all making more sense to me now! Thanks for sharing your knowledge!!
@seanallen
@seanallen 5 років тому
Yeah, these are my older videos. I’ve worked on that in my new ones. It’s much better. See on the comments in this video... this was probably the worst one, lol
@jachuonbass
@jachuonbass 5 років тому
I've seen this kind of stuff declare in this fashion right in the middle of a delegate file: @objc protocol DataDelegate : class { @objc optional func newPrices() @objc optional func newHistory() } does it make any big difference or would you say is pretty much the same principle?
@seanallen
@seanallen 5 років тому
This is declaring the functions as optional. Which means that if you conform to the protocol, you don't HAVE to implement the functions. Where as if you didn't make them optional, and you conformed to the protocol, then implementing the functions would be required.
@Globalhorns
@Globalhorns 6 років тому
Love how you explain code, good job!
@seanallen
@seanallen 6 років тому
Thanks!
@javadbacker481
@javadbacker481 4 роки тому
Love your to the point coding videos
@seanallen
@seanallen 4 роки тому
Thanks Javad! I do my best to eliminate all the irrelevant stuff.
@DaDJCat
@DaDJCat 6 років тому
Could I ask how you would compare delegation to callbacks, when you would use one over the other and an example? Love how you explained delegation vs notifications so easily. Great channel btw, just subbed for your clear explanations and outside of coding advice.
@ryankanno2562
@ryankanno2562 3 роки тому
Awesome video! Thank you so much for explaining this!
@seanallen
@seanallen 3 роки тому
Glad it was helpful!
@Mo__Hazz
@Mo__Hazz 5 років тому
Thanks dude. It helped me understanding it much better. I just had an exam in Swift where I was asked about delegates and couldn't answer.🙁
@seanallen
@seanallen 5 років тому
Happy to help Mohammed!
@CASMANWHAT
@CASMANWHAT 5 років тому
How do you use delegates for the initial screen? where let's say my home screen is a tableview and the moment they click on the cell, the data shows on the next screen? This ex. works for me for second screen binding to first but what about first binding to second? I tried it and I got nil for unwrapping the delegate. Thx for the tutorials they're really good! Gonna support your book!
@GuitarreroDaniel
@GuitarreroDaniel 3 роки тому
Terrific explanation, you made it a hard concept so easy! Thank you very much :)
@akashskumar6389
@akashskumar6389 Рік тому
the tutorial was too good, watched a couple before this one, but only this made sense to me:)
@seanallen
@seanallen Рік тому
Glad it finally makes sense now, Akash!
@cosmoCobra
@cosmoCobra 4 роки тому
Great explanation and demo! This cleared a lot up, thanks
@seanallen
@seanallen 4 роки тому
Glad it helped, Vincent!
@klausjakobsen3160
@klausjakobsen3160 6 років тому
Hi Sean. Thanks you made it very clear. Keep it up
@seanallen
@seanallen 6 років тому
+Klaus Jakobsen Glad you enjoyed it, Klaus!
@johntamch
@johntamch 6 років тому
This is by far the best video I found explaining protocols. Thanks Sean and love your interview question videos.
@seanallen
@seanallen 6 років тому
That's awesome to hear, John! Glad you're enjoying the interview question videos series.
@julianfrank1646
@julianfrank1646 2 роки тому
Really great explanation, but I followed along closely with you and when running the code my equivalent to your selectionDelegate variable was unable to be unwrapped when the function was called in the IBAction. The code said the value of that delegate variable was nil, even though i clearly have the protocol created above and it looks identical to yours, only conformed to my code. Any ideas why this could happen. Thanks again.
@dhruvhexaview1923
@dhruvhexaview1923 4 роки тому
Thanks for the wonderful tutorial, this tutorial saved my day. God bless u
@MrHyde-kc3dv
@MrHyde-kc3dv 4 роки тому
really good explanation thanks Sean!
@seanallen
@seanallen 4 роки тому
Thanks Max!
@wilsonbalderrama
@wilsonbalderrama 6 років тому
great example Sean! I noted that you have a strong reference cycle because of selectionDelegate property but other than the example is very clear thanks!
@seanallen
@seanallen 6 років тому
Hey Wilson, thanks for the kind words! Glad you enjoyed the video. As for the strong reference cycle, there has been some discussion about this in the comments. (Look for Thomas Demaris comment). We discuss if we should declare the selectionDelegate as "weak" or not, and even link to some blog posts on the topic. This is the way I understand it, but I'd love to hear your take and if maybe I'm misinterpreting it. After all, this is all about helping each other learn!
@TheSukhreetSingh
@TheSukhreetSingh 3 роки тому
Great tutorial, thank you very much. How do I use protocol-delegate to send data 2 ViewControllers back ??..
@ashiquepuliyakkode5584
@ashiquepuliyakkode5584 5 років тому
Superb.. You just put an end to my 3 weeks of stress...! Thanks...
@seanallen
@seanallen 5 років тому
Happy to hear it helped, Kristoffer 👍
@user-tv1ms3uv1n
@user-tv1ms3uv1n 4 роки тому
Hey Sean, thanks for the video! Super helpful. Question - is it ok to set the "intern" vc as the boss delegate with self in ViewDidLoad? My code is not working and i thing it might be because of it
@caminaydime
@caminaydime 3 роки тому
Excellent explained, thank you.
@seanallen
@seanallen 3 роки тому
Happy to help, Tantas.
@mauricejulesm
@mauricejulesm 4 роки тому
Still helpful in 2020! Thanks Sean.
@seanallen
@seanallen 4 роки тому
Happy to help 😀
@sumitbaneedits2721
@sumitbaneedits2721 3 роки тому
I am actually an intern learning swift. I am here after my Trainer sent me to learn communication patterns.
@Traoreee
@Traoreee 6 років тому
Everytime i start to watching your video, i think the video speed is 1.25... Every single time i fall in this mistake haha
@seanallen
@seanallen 6 років тому
Haha, I've been working on slowing down a bit. Thanks for watching!
@coalwood6901
@coalwood6901 6 років тому
yea, no more Sean vids for me....sounds like a gravel hauler droning down the road.
@roygalaasen
@roygalaasen 4 роки тому
Putting 50% playback speed makes him sound drunk lol
@michaelkarbasch7619
@michaelkarbasch7619 3 роки тому
I am struggling too haha and on top of that i am a german native speaker which makes it even tougher but great video - thanks for explaning 👍🏻
@mohammadgz4546
@mohammadgz4546 8 місяців тому
best explaintion of delegate and protocols 👌👌👌❤❤❤
@seanallen
@seanallen 8 місяців тому
I have an updated better version on my channel here - ukposts.info/have/v-deo/qZmAf4Vvq5diz2g.html
@mohammadgz4546
@mohammadgz4546 8 місяців тому
@@seanallen thanks but i have already watched that, but didn't got the point before i'll watch that again. ✌
@swiftlandacademy3193
@swiftlandacademy3193 4 роки тому
Nice video! Easy to understand
@seanallen
@seanallen 4 роки тому
Glad you enjoyed it, Alan!
@WhatIsThisAllAbout
@WhatIsThisAllAbout 5 років тому
watching all the videos, got three interview this Saturday.
@seanallen
@seanallen 5 років тому
Good luck! Hope they help.
@WhatIsThisAllAbout
@WhatIsThisAllAbout 5 років тому
Thanks Sean. Your videos are amazing. Took a dose of your videos and went high to interview.
@marioguerrero1311
@marioguerrero1311 3 роки тому
Sean, I really want to thank you for sharing this kinda videos I am a huge fan of you. The video was so clear and understandable, just I have a bit doubt, how could I know where to place SelectionVC.selectionDelegate = self. I meant why I do not place it in the viewDidLoad instead?. how do you know it?. Thanks in advance dude!. you rock!
Swift Classes and Structures Explained
7:35
Sean Allen
Переглядів 75 тис.
have you already done this?😭🙏❓
00:19
LOL
Переглядів 6 млн
DIY Vertical Garden
01:00
Totally Handy Shorts
Переглядів 9 млн
How to create and use protocols - Swift for Complete Beginners
17:23
Paul Hudson
Переглядів 13 тис.
iOS Interview Questions and Answers 2017 - Swift  - Series Overview
11:42
Swift Error Handling - Do, Try, Catch - iOS Interview Question Series
14:58
Two-Sum Problem - Swift Tutorial - iOS Interview Coding Challenge
17:33
Merge Sort - Swift Tutorial - iOS Interview Coding Challenge
12:42
Sean Allen
Переглядів 23 тис.
How to use the Coordinator pattern in iOS
18:12
Paul Hudson
Переглядів 69 тис.
iOS Dev Job Interview - Must Know Topics
2:27:40
Sean Allen
Переглядів 58 тис.
Neuralink full send... Elon's brain chips actually work on humans
4:26
Как исправить!? #tools #usa #энерголикбез #секрет
0:54
Александр Мальков
Переглядів 597 тис.
Самая тупая покупка
1:00
ЖЕЛЕЗНЫЙ КОРОЛЬ
Переглядів 2,3 млн