Skip to content

Instantly share code, notes, and snippets.

@pushkarnk
Last active July 19, 2018 16:27
Show Gist options
  • Save pushkarnk/a9f88723e81d4d605ec7b017f75e355c to your computer and use it in GitHub Desktop.
Save pushkarnk/a9f88723e81d4d605ec7b017f75e355c to your computer and use it in GitHub Desktop.
This is a cool way to replace `x == nil` checks
extension Optional {
var isNil: Bool {
switch self {
case .none: return true
case .some: return false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment