How to use Protocols in Swift | Advanced Learning #15

Поделиться
HTML-код
  • Опубликовано: 20 окт 2024

Комментарии • 59

  • @Pepe_the_raver
    @Pepe_the_raver 11 месяцев назад +1

    Probably the best Procotols video available on RUclips!

  • @KimbrellBrad
    @KimbrellBrad 3 года назад +12

    You are absolutely killing it with this advanced series Nick! Truly appreciate all of the time and effort that you have put into your channel. I have watched every plkaylist and every episode that you have posted. Thanks!

    • @SwiftfulThinking
      @SwiftfulThinking  3 года назад +4

      That is an in incredible thing to hear. Thank you for the comment Brad! I could not be happier to hear that someone is actually watching them in order and learning. This keeps me going 😎

  • @arkemal
    @arkemal Год назад +1

    That's how Polymorphism is done in Swift. Thanks for the tutorial, Nick! Very good as usual!

  • @Taras195
    @Taras195 18 минут назад

    So, basically, protocols are just a version of pure-virtual c++ classes?
    Awesome video!

  • @Khalid-fm2nh
    @Khalid-fm2nh 3 года назад +4

    your playlist was by far the best SwiftUi teaching I have ever watched, you don't just explains the concept you even chose to do it by the best practice.
    I hope to see a video explaining how to work with CoreLocation Kit inside MVVM SwiftUI Architecture
    Thank You A lot

    • @SwiftfulThinking
      @SwiftfulThinking  3 года назад +2

      I am going to add CoreLocation to my list. Maybe a mini-app project. Thanks for the suggestion!

  • @bbulliard
    @bbulliard 2 года назад

    Brad is so right. Nick is killing it with awesome well explained, easy to understand tutorials . A truly gifted teacher

  • @probe8668
    @probe8668 2 года назад

    this video is unique from other videos about protocol i ever watched on youtube. thanks man.

  • @andayismayilzade1897
    @andayismayilzade1897 3 года назад +3

    As always GREAT explanation. THANK YOU NICK!

  • @williamallen4607
    @williamallen4607 2 года назад +1

    Best explanation of protocols I have seen. Thanks, Nick!

    • @SwiftfulThinking
      @SwiftfulThinking  2 года назад +1

      Hey William! It's been a while! Thanks for the comment :)

  • @cruiseqe2
    @cruiseqe2 3 года назад +2

    That was a very clear introduction to an otherwise perplexing subject. Thanks.

    • @SwiftfulThinking
      @SwiftfulThinking  3 года назад +1

      Hey Mark! Glad to see you're watching these! Thanks for the comment 👍

  • @asigivati1382
    @asigivati1382 4 месяца назад

    Great video! instead of creating an empty protocol in order to combine 2 other protocols, you can do it via typealias like so:
    typealias CombinationProtocol = ButtonTextProtocol & ButtonPressedProtocol
    and create a variable that conform to it:
    var someVar: CombinationProtocol

  • @МихаилПеревозчиков-ц4р

    Awesome explanation! It was very easy to understand all benefits of it when you had show the usage in Preview. This is a moment when View becomes truly abstractive! Thanks

  • @lionsctn5053
    @lionsctn5053 2 года назад +1

    I love of these videos! Again they are all and I mean all of them very helpful when learning them for the first time and referencing them later on if I forget how to do something. Thank you very much for all your time and effort!

    • @SwiftfulThinking
      @SwiftfulThinking  2 года назад +1

      Comments like this are why I've continued posting to this channel. Thank you!!

  • @NastyHangover
    @NastyHangover 2 месяца назад

    so long story short we are taking the "how" and replace it by basic rules (get or set for var and existence of func) and type descriptions (var type), so we can inject the how in the beginning of the app, in order to be able to run dummy code. As usual, again big thanks, Nick.

  • @minimaster.10
    @minimaster.10 10 месяцев назад

    keep updating SwiftUI Advance Learning! you are good sensei

  • @BSharing09
    @BSharing09 Год назад

    Best explanation. Thanks a lot.

  • @magedmohmed4403
    @magedmohmed4403 Год назад

    Thank you Nick , your explanation is very very useful for us

  • @thahiraf1317
    @thahiraf1317 2 года назад +1

    Thank you so much....You are amazing teacher

  • @mrslana3049
    @mrslana3049 2 года назад +1

    The best in Swift

  • @BadArt-m7r
    @BadArt-m7r 3 месяца назад

    Super solid. Subscribed!

  • @ericweideman6626
    @ericweideman6626 2 года назад

    Really solid, clear explanation!

  • @cinquain0
    @cinquain0 3 года назад

    I actually didn't know protocols can inherit from other protocols. Pretty cool!

  • @indarsnab
    @indarsnab 8 месяцев назад

    Amazing, thanks!

  • @princeabyss4976
    @princeabyss4976 3 года назад +2

    I can't wait to learn projects from advanced learning, how many learning videos are in this playlist,sir?

  • @jameskayten6563
    @jameskayten6563 Год назад +1

    Man . . . You're really good!

    • @SwiftfulThinking
      @SwiftfulThinking  Год назад

      Thanks James!! I’ve been following you’re comments I can’t believe you’re up to this level already 🚀🚀🚀 congrats!

    • @jameskayten6563
      @jameskayten6563 Год назад

      Wow! I wouldn't think you'd any time to read these. Ahh, to be young again!
      I've purchased a bigger keyboard so I can access the arrow keys more easily but the auto completion feature is often confusing me in any case. I must say, I feel a bit sad when you delete all the nice code you've typed - but of course I can always rewind... I was trying to create a color scheme to match the vids but also help me identify the various types in the code. Sorry - I'm starting to ramble. Thanks for the reply Nick!
      @@SwiftfulThinking

  • @KanoKendama
    @KanoKendama 3 года назад

    Now we’re getting to the juicy part!

  • @kerryferguson8267
    @kerryferguson8267 3 года назад +2

    Love your videos, thank you for the great explanation! You've briefly mentioned Dependency Injections. Will you be covering Dependency Injection methods like creating Factory classes and/or Dependency Containers in the future? Or is that even relevant in SwiftUI because of EnvironmentObjects, I'm not too sure :/

    • @SwiftfulThinking
      @SwiftfulThinking  3 года назад +1

      Haha don't worry, the Dependency Injection video is next!

    • @kerryferguson8267
      @kerryferguson8267 3 года назад

      @@SwiftfulThinking well would you look at that, my dream came true :’)

  • @kuldeepbhandari7276
    @kuldeepbhandari7276 2 года назад

    It's nice explanation about protocols , But i have one concern we can also make our Protocols optional for the buttonPressed() function , I think it's good way to reduce the no of lines of code if we make that Protocol optional.please suggest it's a good way or not.

  • @chrisstromberg6527
    @chrisstromberg6527 Год назад +1

    So big picture would it be correct to say that protocols help with making sure I'm not making "breaking changes" within my app!?

    • @SwiftfulThinking
      @SwiftfulThinking  Год назад

      Yea it definitely helps for that, but writing tests will also do that (covered later in this course)

  • @jameskayten6563
    @jameskayten6563 Год назад

    One thing . . . All I can ever find regarding Xcode education is about the iOS. I'm actually more interested in the MacOS and creating desktop applications. There's a demographic that will be increasing of folks who'd rather sit down with a mouse than be fickly-Fudging with thumbs and virtual keyboards. Have any content that you'd recommend or advice on how to proceed most efficiently towards the goal?

  • @ushadesai6306
    @ushadesai6306 3 года назад +1

    For the computed properties in the protocol definition in this video example, does 'SET' become implicit property because color is set in the struct?

    • @SwiftfulThinking
      @SwiftfulThinking  3 года назад

      Hi Usha! Computed properties would be "get" only properties. It wont compile if you set it to get and set.

    • @ushadesai6306
      @ushadesai6306 3 года назад

      @@SwiftfulThinking It compiled with 'set'.Can you check that and explain please.

  • @tbg6nb
    @tbg6nb 2 года назад

    14:15 after using the autofix from XCode, the AnotherColorTheme has primary/secondary/tertiary colors as a var. But DefaultColorTheme and AlternativeColorTheme define them using let. What would be the best practise here ? Make them all three use var or make them all three use let ?

    • @SwiftfulThinking
      @SwiftfulThinking  2 года назад

      The protocol must be a var, but if your value is a constant, best practice is to keep it a let.

  • @mhfs61
    @mhfs61 2 года назад +1

    👍🏼👍🏼👍🏼

  • @ekinyil
    @ekinyil 24 дня назад

    awesome

  • @abelhancco4349
    @abelhancco4349 8 месяцев назад

    ty

  • @nickfloussov185
    @nickfloussov185 9 месяцев назад

    There is some confusion about { get }, i.e. why is it possible to 'set' the value of property if it is 'get' only?!
    Why, say, / let primary: Color = .red / generates no error?
    P.S. after some research I've got the answer: protocol "functionality" is applied AFTER struct is initialized,
    i.e. 'primary' property belongs to struct and initialized when related object is already created,
    and protocol's get/set functionality for this (primary) property is invoked/applied later on 😁

    • @SwiftfulThinking
      @SwiftfulThinking  9 месяцев назад

      “Get only” means after the initial value is set, you can only get it.
      let primary = .red
      Here you are setting an initial value but the “setter” is disable. Meaning you cannot update / change the value within the protocol

  • @SiamakAshrafi
    @SiamakAshrafi 2 года назад +1

    Swift is a protocol oriented langage