Created
February 10, 2017 06:54
-
-
Save ukitaka/31052b46c44dd08257dc010a4fd1beeb to your computer and use it in GitHub Desktop.
percentage postfix operator
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
postfix operator % | |
public postfix func %(int: Int) -> CGFloat { | |
return CGFloat(int) / 100.0 | |
} | |
public postfix func %(int: Int8) -> CGFloat { | |
return CGFloat(int) / 100.0 | |
} | |
public postfix func %(int: Int16) -> CGFloat { | |
return CGFloat(int) / 100.0 | |
} | |
public postfix func %(int: Int32) -> CGFloat { | |
return CGFloat(int) / 100.0 | |
} | |
public postfix func %(int: Int64) -> CGFloat { | |
return CGFloat(int) / 100.0 | |
} | |
public postfix func %(int: UInt) -> CGFloat { | |
return CGFloat(int) / 100.0 | |
} | |
public postfix func %(int: UInt8) -> CGFloat { | |
return CGFloat(int) / 100.0 | |
} | |
public postfix func %(int: UInt16) -> CGFloat { | |
return CGFloat(int) / 100.0 | |
} | |
public postfix func %(int: UInt32) -> CGFloat { | |
return CGFloat(int) / 100.0 | |
} | |
public postfix func %(int: UInt64) -> CGFloat { | |
return CGFloat(int) / 100.0 | |
} |
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
100% // 1.0 | |
0% // 0.0 | |
80% // 0.8 | |
UIColor(white: 0%, alpha: 80%) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment