Swift snippet #7 β Optional?
Published in
1 min readDec 7, 2016
Wednesday, 7th December, 2016
The above snippet creates a not
property on an optional variable which in case of a bool return its opposite value and otherwise it returns a false. You can relate this with my last snippet β swift-snippet#6.
Iβll share a code sample to show it usage..
It saves us from unnecessary if-lets
or guard-lets
to perform a simple reversal of a boolean value π
If you are wondering about the inception of Swift-Snippets or want to checkout more such snippets then you can find them here π