Last active
March 6, 2019 17:30
-
-
Save abbottmg/1d6df49826cbf6233148 to your computer and use it in GitHub Desktop.
This file contains 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
protocol Named { | |
func GetName() -> String | |
} | |
protocol CasedNamed { // previously "NamedExtension" | |
func GetLowercaseName() -> String | |
func GetUppercaseName() -> String | |
} | |
extension CasedName where Self: Named { | |
func GetLowercaseName() -> String { | |
return self.GetName().lowercaseString | |
} | |
func GetUppercaseName() -> String { | |
return self.GetName().uppercaseString | |
} | |
} | |
extension Int : Named, CasedNamed { | |
func GetName() -> String { | |
return "Int" | |
} | |
} | |
1.GetName() // "Int" | |
1.GetLowercaseName() // "int" | |
1.GetUppercaseName() // "INT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment