How safe are Swift structs?

preview_player
Показать описание


Do you think Swift structs are safe? This video may change your mind.

“Structs should be the default choice” and “Only use classes when necessary” is common advice but might be misleading. We’d like to show you a different way of looking at the “Structs vs. Classes” debate.

★ Download our new app

★ Professional iOS Engineering S01

Connect with us on:

Рекомендации по теме
Комментарии
Автор

I feel enlightened after watching this video. Thank you for the explanation!

tityseptiani
Автор

try implementing closures in structs types

iMahesh
Автор

wow ...!blow up my mind completely, such a good content

budhabhooshanpatil
Автор

Perfect explanation. Was going through an existential crisis when I saw your use of classes in the lead essentials course lol. This makes perfect sense. The 'common knowledge' of using structs by default needs to come with an asterisk.

dill_n
Автор

Do you mean that using mutable struct function would also be inappropriate for a value type ?

raychen
Автор

Agree with the conclusion at the end of the video, but don't agree with the way you equate value type and immutability, the two are not the same thing. Value types can be either mutable or​ immutable, depending on how you write them.

byaruhaf
Автор

Is there any performance advantage for using Structs since it is stored in a stack memory and with reference types the object storage happens in a heap ? I am not sure about it just a thought. Anyways nice video. Thanks.

subinrevi
Автор

How many years of developing ios, just now i got the real answer 😮

indomitabletr
Автор

By holding a reference to a class in struct you proved, that using classes introduce errors, proving the point that structs are safer.

lieksu