Skip to content

Instantly share code, notes, and snippets.

@IhwanID
Created March 15, 2021 01:16
Show Gist options
  • Save IhwanID/aeb446f426059c97c226b03bff79649b to your computer and use it in GitHub Desktop.
Save IhwanID/aeb446f426059c97c226b03bff79649b to your computer and use it in GitHub Desktop.
String OrEmpty Optional Extension
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