Created
November 23, 2016 06:52
-
-
Save Cee/b0c7188ad868f5a249722a12a0563aa5 to your computer and use it in GitHub Desktop.
Value Transformer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IsNotEmpty: ValueTransformer { | |
override class func transformedValueClass() -> Swift.AnyClass { | |
return Int.self as! AnyClass | |
} | |
override class func allowsReverseTransformation() -> Bool { | |
return false | |
} | |
override func transformedValue(_ value: Any?) -> Any? { | |
guard let value = value as? Int else { | |
return false | |
} | |
return value > 0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment