Skip to content

Instantly share code, notes, and snippets.

@wendyliga
Created October 10, 2020 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wendyliga/bf0f9ba8f1860c240f70c98170b51e79 to your computer and use it in GitHub Desktop.
Save wendyliga/bf0f9ba8f1860c240f70c98170b51e79 to your computer and use it in GitHub Desktop.
@propertyWrapper
struct NonEmptyString {
var wrappedValue: String?
init(wrappedValue: String?) {
if wrappedValue?.isEmpty == true {
self.wrappedValue = nil
} else {
self.wrappedValue = wrappedValue
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment