Skip to content

Instantly share code, notes, and snippets.

@Anatoli-Petrosyants
Created May 4, 2018 12:09
Show Gist options
  • Save Anatoli-Petrosyants/cdd913d48204871f833a6899c1b8aa7b to your computer and use it in GitHub Desktop.
Save Anatoli-Petrosyants/cdd913d48204871f833a6899c1b8aa7b to your computer and use it in GitHub Desktop.
extension Int {
func toString() -> String {
return "\(self)"
}
func toObjCString() -> NSString {
return NSString(format: "%d", self)
}
func toDouble() -> Double {
return Double(self)
}
func postiveValue() -> Int {
return (self > 0) ? self : 0
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment