Skip to content

Instantly share code, notes, and snippets.

@SURYAKANTSHARMA
Last active April 2, 2021 09:13
Show Gist options
  • Save SURYAKANTSHARMA/ad570e0b25d0d27b85fcdb46c482b4c4 to your computer and use it in GitHub Desktop.
Save SURYAKANTSHARMA/ad570e0b25d0d27b85fcdb46c482b4c4 to your computer and use it in GitHub Desktop.
@propertyWrapper struct Currency {
var projectedValue: Bool
// This is must stored property in every property wrapper
var wrappedValue: String {
didSet {
wrappedValue = "₹ " + wrappedValue
projectedValue = wrappedValue.contains(",")
}
}
init(wrappedValue: String) {
projectedValue = wrappedValue.contains(",")
self.wrappedValue = "₹ " + wrappedValue
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment