In swift you can unwrap optional values with a guard statement
guard let foo = foo else { return nil }
Is this statement making a copy of foo
? In other words, could this statement be potentially expensive if foo
is very large?
Actually this depends on type of foo
e.x class
type won't create a copy unlike struct
type
guard
isn't a magic keyword it simply if not
presented in 1 word
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With