Created
March 14, 2018 04:54
-
-
Save jakehawken/023ae48370a218095ab70e6510ab37b0 to your computer and use it in GitHub Desktop.
.asSet() and .asArray() -- Why don't these already exist?
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
| extension Array where Element: Hashable { | |
| func asSet() -> Set<Element> { | |
| return Set(self) | |
| } | |
| } | |
| extension Set { | |
| func asArray() -> [Element] { | |
| return Array(self) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why not just use the provided initializers?