Created
April 22, 2020 16:02
-
-
Save srstanic/a3b387e48cf868c620f55e6d5ecf0a36 to your computer and use it in GitHub Desktop.
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: Equatable { | |
| func distinctUntilChanged() -> Self { | |
| var resultArray = Self() | |
| for element in self { | |
| if resultArray.last != element { | |
| resultArray.append(element) | |
| } | |
| } | |
| return resultArray | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment