Opaque Type vs Protocol in Swift | Associated Type | Generics | iOS

Поділитися
Вставка
  • Опубліковано 2 сер 2024
  • In this video, I’ve discussed Opaque Type, Associated Type, Generics and Protocols in detail.
    Protocols and Opaque Types are often confused with each other, and I’ve tried to clear that confusion through an example. Considering that all these are closely related with each other, I’ve discussed all four of them (Opaque Type in detail, and a glance at rest three).
    Associated Type (SwiftLee Article 👇🏼)
    www.avanderlee.com/swift/asso....

КОМЕНТАРІ • 54

  • @arunbenjamin8278
    @arunbenjamin8278 2 роки тому +4

    Your topics Selection is good where developers get lot of confusions.

  • @bapathimallikadevi9601
    @bapathimallikadevi9601 2 роки тому +3

    crystal clear explanation . Really appreciate the way you are teaching others

  • @nitishnayak8664
    @nitishnayak8664 2 роки тому

    well done Pallav . crystal clear explanation . Really appreciate the way you are teaching others.

  • @piyushgeorge1847
    @piyushgeorge1847 2 роки тому +6

    Your channel covers very useful topics. keep up the good work 👍👍👍

  • @shanmugamsekar4044
    @shanmugamsekar4044 15 днів тому

    very well explained.👍

  • @vinayakpaul2251
    @vinayakpaul2251 2 роки тому

    I have learnt a lot from your channel even possess lot of experience in Swift. Keep up the good work

  • @jeevank8550
    @jeevank8550 2 роки тому +1

    All of your videos are very informative. Especially for Senior or Mid-Senior level iOS devs like me.

  • @seunolalekan8987
    @seunolalekan8987 2 роки тому

    Thanks a bunch man! This was an excellent explanation.

  • @ShubhamGupta-qo2pt
    @ShubhamGupta-qo2pt 2 роки тому +1

    Worth watching on Monday with breakfast :), keep up the good work.

  • @junglee-bee
    @junglee-bee 2 роки тому +1

    Your content is awesome!
    Please also cover Opaque Type & Type Erasure.

  • @keshurai2700
    @keshurai2700 2 роки тому

    Your selection of topics is so good.

  • @pr1tham
    @pr1tham 2 роки тому +2

    Very good content, Please keep this up. Thanks.

  • @shantibhatt4867
    @shantibhatt4867 2 роки тому +5

    Thank you, It's very helpful
    Please do videos on SOLID principles and xcode instruments usage

    • @iCode_Happy_Coding
      @iCode_Happy_Coding  2 роки тому +2

      Thanks for the suggestion Shanti. I'll try covering it 🙂

  • @maheshparmar5647
    @maheshparmar5647 5 місяців тому

    You really cleared all the doubts related to the topics..🙌

  • @mariumhassan4048
    @mariumhassan4048 2 роки тому

    superb videos please keep uploading.

  • @dhivyavenkatachalam7724
    @dhivyavenkatachalam7724 2 роки тому

    Indeed useful video!!

  • @vickywang5049
    @vickywang5049 Рік тому

    My takeaways:
    Generics is the placeholder of types used in functions signatures (like a template). It allows the caller to decide the actual type whereas the function doesn't care about it at implementation. Syntax: func function -> [T] {}
    Opaque type is a placeholder in function returns. It hides the concrete type from the caller, but the function's implementation and compiler knows exactly what it is. Syntax: with keyword "func function() -> some Protocol{}"
    Associated type is the type placeholder inside of protocols. It makes protocols more generic. Anyone who adopts from protocols with associatedtype must specify the actual type first. Syntax: associatedtype typename
    Protocol is the "blueprint" of a set of properties and functions that must be implemented if a structure, class, protocol wants to conform to it. Syntax: protocol protocolName {}

    • @vickywang5049
      @vickywang5049 Рік тому

      An example that can be solved by opaque type: If you have a generic protocol with associatedtype, and you don't want to reveal the concrete type of the function returns to the caller, you can use "some" keyword to return an opaque type instead.

  • @pawanmanjani1298
    @pawanmanjani1298 2 роки тому +1

    Superb Keep posting🙂

  • @puneetpal1466
    @puneetpal1466 2 роки тому +1

    It was awesome... Thank you so much :) 😊

  • @ankitbhana9852
    @ankitbhana9852 2 роки тому +1

    Just amazing🙌🏻

  • @dhavalumraliya2307
    @dhavalumraliya2307 2 роки тому +1

    Just perfect 🔥🔥🔥🔥🔥
    it would be very great if you make a video on web socket.

    • @iCode_Happy_Coding
      @iCode_Happy_Coding  2 роки тому

      Thanks for the suggestion Dhaval. I'll try covering it 🙂

  • @otniel2663
    @otniel2663 2 роки тому +1

    thanks for sharing

  • @reshmaunni7017
    @reshmaunni7017 2 роки тому

    Thank you so much sir

  • @krishnachowdary8447
    @krishnachowdary8447 2 роки тому

    Love you man

  • @ANILKUMAR-vv1fz
    @ANILKUMAR-vv1fz 2 роки тому +1

    it was awesome

  • @MrAbhijithadkar
    @MrAbhijithadkar 2 роки тому

    You should consider uploading 2-3 videos @pallav. Nice topic covered very easily. Thanks and keep it up.

    • @iCode_Happy_Coding
      @iCode_Happy_Coding  2 роки тому +1

      Sure Abhijit, I'll try covering theses topics in detail. 👍🏼

  • @deveshtyagi
    @deveshtyagi 2 роки тому

    🔥

  • @VinothKumar-zl2ht
    @VinothKumar-zl2ht 2 роки тому +1

    Super videos, please upload in 1080p.. its good in UHD monitor.

  • @abymathew575
    @abymathew575 2 роки тому

    nice explanation bro.

  • @King_Slayer_06
    @King_Slayer_06 5 місяців тому

    Thanks for the great explaination Pallav!
    At 11:57 i was getting suggestion to change the return type to "any Card" instead of "some Card" (Im using Xcode 15.0.1). What is the difference between "any" and "some"?

  • @deveshtyagi
    @deveshtyagi 2 роки тому

    Amazing

  • @iamarorarishabh
    @iamarorarishabh 2 роки тому

    👍👍

  • @ananthakrishna9672
    @ananthakrishna9672 2 роки тому +1

    Great information. I have small doubt how to decide struct vs class

    • @iCode_Happy_Coding
      @iCode_Happy_Coding  2 роки тому +1

      Thanks for the suggestion Anantha 🙂. I’ll try to cover class vs struct in detail (including usage).

    • @ananthakrishna9672
      @ananthakrishna9672 2 роки тому

      @@iCode_Happy_Coding thank you.

  • @yourgflikesit
    @yourgflikesit Рік тому

    I’m even more confused. Is a generic and associated type the same lol. It seems that way. Just used it two different areas.

  • @keshavkumar1522
    @keshavkumar1522 2 роки тому

    Thank you so much for your effort in delivering such kind of valuable content on youtube. All your videos are so informative with a practical example. Wishing you and our channel great success. Keep doing a lot. Kindly do videos on MVVM-C, MVP, VIPER Patterns. Most of the developers struggle with animation stuff. So, please do a tutorial series on CoreAnimation, BezziarPath, Custom Layouts, etc. Thanks again.

    • @iCode_Happy_Coding
      @iCode_Happy_Coding  2 роки тому +1

      Thanks for the kind words Keshav.
      Did a video on Bezier Curves after your suggestion 🙂

  • @victorriurean
    @victorriurean 7 місяців тому

  • @maqusss
    @maqusss Рік тому

    I saw much better example on hackingwithswift. Consider functions makeInt and makeString that both return "some Equatable". Compiler will allow comparison "makeInt() == makeInt()" or "makeString() == makeString()" but won't allow "makeInt() == makeString()".