Created
May 23, 2019 22:12
-
-
Save jeremycochoy/144387a65f1496af5723ab7fd69f83b6 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
/// Select the left element if available | |
mutating func left() { | |
guard leftList.isNotEmpty else {return} | |
if let c = cursor {rightList.append(c)} | |
cursor = leftList.popLast() | |
} | |
/// Select the right element if available | |
mutating func right() { | |
guard rightList.isNotEmpty else {return} | |
if let c = cursor {leftList.append(c)} | |
cursor = rightList.popLast() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment