Skip to content

Instantly share code, notes, and snippets.

@srstanic
Created September 27, 2019 14:07
Show Gist options
  • Save srstanic/bf7a4bdeb0ac0e617550924da6865fe8 to your computer and use it in GitHub Desktop.
Save srstanic/bf7a4bdeb0ac0e617550924da6865fe8 to your computer and use it in GitHub Desktop.
extension Optional where Wrapped == String {
var orEmpty: String {
switch self {
case .some(let value):
return value
case .none:
return ""
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment