Swift snippet #7β€Šβ€”β€ŠOptional?

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 😊