Тёмный

Copy on write & Copy on assignment in Swift | Hindi tutorial 

Code Cat
Подписаться 16 тыс.
Просмотров 6 тыс.
50% 1

Опубликовано:

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 45   
@emdutt4012
@emdutt4012 Год назад
Beacuse you are changing the name car in car 2 instance but you take variable let in car2which is constant that’s why it is showing error.
@narayanrautela5714
@narayanrautela5714 2 года назад
For let and var question, I think we have to change let to var because struct are immutable type so we need to change it. Like we use mutating in stuct for modifications. Thanks bro for this video 👍
@CodeCat15
@CodeCat15 2 года назад
Excellent explanation Narayan 👍 thank you for your answer
@pavanmanjani7583
@pavanmanjani7583 2 года назад
Hi Nice video but I have one query you told reference type doesn't support COW... but in video 9:58 you explained example of COW with class(reference type)
@CodeCat15
@CodeCat15 2 года назад
Good observation Pavan and thank you for asking this question. The memory address that you see on the console are of arr1 and arr2 variables which are arrays and arrays are value types not reference types The code change at the mentioned time was to prove that the behavior of COW is not dependent on the elements of the array but the array itself. Does that answer your question? If not please feel free to ask more questions.
@pavanmanjani7583
@pavanmanjani7583 2 года назад
@@CodeCat15 yes got it now Thank you for answering Keep posting
@CodeCat15
@CodeCat15 2 года назад
Hey there, I hope this video was helpful. The code shown in the video is uploaded on GitHub, given is the link for the same. GitHub link: github.com/codecat15/RU-vid-tutorial/tree/master/CopyOnWrite Here's the discord invite link to iOS Cafe: discord.gg/gB3mhP8DNq
@hafizmuhammadbilal4
@hafizmuhammadbilal4 2 года назад
@code Cat answer: we are making mutable to change value from structure if have calass then no need to do this because class already have refrence type.
@CodeCat15
@CodeCat15 2 года назад
Good answer Hafiz 😊
@aarukiapniduniya
@aarukiapniduniya 2 года назад
Amazing topic to discover.... Great work Ravi ....
@CodeCat15
@CodeCat15 2 года назад
Pretty interesting how such minor details are being taken care of when it comes to memory management, indeed this topic is very interesting and an interviewer favorite question.
@jayprakashsharma7
@jayprakashsharma7 2 года назад
Class use same memory address that's why they are mutable and value can be modified even we are using let. But in case of struct they share different memory address, it means if you are using let and assigned some value and again you are going to change value it will throw error because you cannot modify value because it share different memory address and it store the previous value also. I think that's why structure are immutable. But in case of class it is mutable because they share same memory address and if we modify the value it means the previous value will be replaced with updated value. It means that the previous value is no longer exist and it behaves like you have not assigned any value earlier. I hope I have explained clearly.
@CodeCat15
@CodeCat15 2 года назад
Thanks Jay for providing a detailed answer, good job.
@ranganathchenna4559
@ranganathchenna4559 2 года назад
Good explanation but the address after change in object is different in both types ... @9:05
@CodeCat15
@CodeCat15 2 года назад
And that’s what copy on write is, before change both will point to the same address and after the change the object that you changed will point to a different address
@naveenkumardugarbbachhrajd9682
Amazing work .truly very well explanations as well as the mind of teaching skill you have is just FANTASTIC !!! , would request please become the "Hacking with Swift " of INDIA , and maintain the same quality as well as the content >>> only love !!
@nripendrasingh7472
@nripendrasingh7472 2 года назад
Hi Bro, Amazing explanation, you are providing very valuable knowledge. Keep it up !
@CodeCat15
@CodeCat15 2 года назад
I am glad this was helpful, please feel free to ask questions on the topic and do share the channel with your iOS group
@JunaidKhan-ny8tu
@JunaidKhan-ny8tu 2 года назад
This is amazing Ravi Bhai ❤❤❤ very concise and to the point 👏
@CodeCat15
@CodeCat15 2 года назад
Thanks Junaid, I am glad this was helpful session.
@umairahmad4368
@umairahmad4368 2 года назад
Thank you for explaining the COW concept. 4:09 Answer (As per my understanding) "let" is used for constant only, as we are changing/modifying the "car2" property "name", so we need to use "var" there.
@CodeCat15
@CodeCat15 2 года назад
but the let did work when we were using a class so why did the compiler time error only arise during struct and not class?
@umairahmad4368
@umairahmad4368 2 года назад
@@CodeCat15 Class:- with let cause, "class" is considered as "constant of address". It can not be reassigned but can be changed. The property should be with "var" too. Like if we change "var name: String" with "let name: String" then it will not work with the class too. Struct:- with let cause, it's considered as "constant of value". It is immutable (not modifiable).
@CodeCat15
@CodeCat15 2 года назад
Thank you Umair for this explanation, and well said 👍
@umairahmad4368
@umairahmad4368 2 года назад
@@CodeCat15 Thanks Ravi for counter questions.You always respond to comment section of your video.👍👍💓
@PropertiesAI
@PropertiesAI 2 года назад
thanks much for sharing 🙏🏻
@CodeCat15
@CodeCat15 2 года назад
My pleasure, glad to know this video was helpful 😊 please feel free to ask questions on the topic and do share the video with your iOS group
@mushrankhanpathan
@mushrankhanpathan 2 года назад
Amazing knowledge sharing!👍
@CodeCat15
@CodeCat15 2 года назад
Glad it was helpful 😊
@mushrankhanpathan
@mushrankhanpathan 2 года назад
@@CodeCat15 yes definitely it is, and keep up the good work with quality, all the very best!👍
@arifashraf8342
@arifashraf8342 2 года назад
Great explanation as usual!
@CodeCat15
@CodeCat15 2 года назад
Thank you Arif, am glad it was helpful
@dharmendrasinha8806
@dharmendrasinha8806 2 года назад
Amazing explanation 🙏
@CodeCat15
@CodeCat15 2 года назад
glad it was helpful
@abhishekdhiman9771
@abhishekdhiman9771 2 года назад
Simple and straightforward! Thank you for this video.
@CodeCat15
@CodeCat15 2 года назад
Thank you Abhishek 😊 feel free to ask questions on the topic
@prataprana2963
@prataprana2963 2 года назад
I was waited for this.!! Thanks Brother for this easy context❤️
@CodeCat15
@CodeCat15 2 года назад
Hope the video answers all your doubts regarding the topic, if not please ask questions in comment or on iOS cafe 😊
@rahuljamba5846
@rahuljamba5846 Год назад
Thats great explanation Ravi, thanks you for sharing your quality knowledge !!
@CodeCat15
@CodeCat15 Год назад
Glad you liked it! please feel free to ask question on this topic and do share the content with your ios group
@rahuljamba5846
@rahuljamba5846 Год назад
@@CodeCat15 sure Ravi I will
@jayprakashsharma7
@jayprakashsharma7 2 года назад
You are doing great job sir. I have never seen any youtuber who is doing such a hard word to create quality videos. Thanks a lot for this channel, please keep it alive.
@CodeCat15
@CodeCat15 2 года назад
Thank you for your kind words Jay, I'll try my best to deliver more quality driven video. Thank you once again.
@jayprakashsharma7
@jayprakashsharma7 2 года назад
@@CodeCat15 Ab is se jyda bhi quality video ho sakta hai kya 😀
@CodeCat15
@CodeCat15 2 года назад
Koshish kar k dekhta hu, shayad thoda aur improve kar pau khud ko, there’s always room for improvement 😊
Далее
Lazy stored property in Swift Hindi tutorial
11:17
Просмотров 13 тыс.
ХОМЯК ВСЕХ КИНУЛ
10:23
Просмотров 635 тыс.
Difference between weak and unowned in Swift
16:20
Просмотров 15 тыс.
Copy on Write in Swift | iOS
8:11
Просмотров 7 тыс.
Copy on write in Swift || iOS interview Questions
8:09
What is Any and AnyObject in swift iOS Hindi Tutorial
10:57
KVO & KVC in iOS Swift
10:01
Просмотров 4,1 тыс.
async await with API example | Swift Hindi tutorial
22:03