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"?
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 {}
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.
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()".
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.
Your topics Selection is good where developers get lot of confusions.
crystal clear explanation . Really appreciate the way you are teaching others
You really cleared all the doubts related to the topics..🙌
Glad to hear that
Your channel covers very useful topics. keep up the good work 👍👍👍
Thanks Piyush 🙂
Very well explained.👍Thanks for sharing your knowledge !!
Worth watching on Monday with breakfast :), keep up the good work.
Thanks Shubham 🙂
All of your videos are very informative. Especially for Senior or Mid-Senior level iOS devs like me.
Glad that you liked the videos 🙂
Your selection of topics is so good.
Thanks Keshu 🙂
I have learnt a lot from your channel even possess lot of experience in Swift. Keep up the good work
is it build error because associated Type is protocol or it can be give build error even if associated type is string.
well done Pallav . crystal clear explanation . Really appreciate the way you are teaching others.
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"?
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 {}
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.
Thank you, It's very helpful
Please do videos on SOLID principles and xcode instruments usage
Thanks for the suggestion Shanti. I'll try covering it 🙂
very well explained.👍
Very good content, Please keep this up. Thanks.
Just perfect 🔥🔥🔥🔥🔥
it would be very great if you make a video on web socket.
Thanks for the suggestion Dhaval. I'll try covering it 🙂
Thanks a bunch man! This was an excellent explanation.
Super videos, please upload in 1080p.. its good in UHD monitor.
Thanks for the feedback Vinoth, I’ll look for it 🙂
Great information. I have small doubt how to decide struct vs class
Thanks for the suggestion Anantha 🙂. I’ll try to cover class vs struct in detail (including usage).
@@iCode_Happy_Coding thank you.
Superb Keep posting🙂
You should consider uploading 2-3 videos @pallav. Nice topic covered very easily. Thanks and keep it up.
Sure Abhijit, I'll try covering theses topics in detail. 👍🏼
superb videos please keep uploading.
Just amazing🙌🏻
Thanks 🙂
Indeed useful video!!
It was awesome... Thank you so much :) 😊
You're so welcome! 🙂
thanks for sharing
Love you man
nice explanation bro.
Thanks 🙂
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()".
Thank you so much sir
it was awesome
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.
Thanks for the kind words Keshav.
Did a video on Bezier Curves after your suggestion 🙂
Amazing
Thanks 🙂
👍👍
🔥