Created
March 19, 2020 20:40
-
-
Save twittemb/eca98b4e7dfd1fb3c2dbeeffc6c8dfec 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
func leftEffect(inputLevels: Levels) -> Observable<Event> { | |
// this is the stop condition to our Spin | |
guard inputLevels.left != inputLevels.right else { return .empty() } | |
// this is the regulation for the left level | |
if inputLevels.left < inputLevels.right { | |
return .just(.increaseLeft) | |
} else { | |
return .just(.decreaseLeft) | |
} | |
} | |
func rightEffect(inputLevels: Levels) -> Observable<Event> { | |
// this is the stop condition to our Spin | |
guard inputLevels.left != inputLevels.right else { return .empty() } | |
// this is the regulation for the right level | |
if inputLevels.right < inputLevels.left { | |
return .just(.increaseRight) | |
} else { | |
return .just(.decreaseRight) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment