diff options
author | NicoleYarroch <nicole@livio.io> | 2020-08-11 10:39:54 -0400 |
---|---|---|
committer | NicoleYarroch <nicole@livio.io> | 2020-08-11 10:39:54 -0400 |
commit | a3700c8dc4bf4e66f107d21a8c9a356d39e2f34e (patch) | |
tree | 4c758777821a0f986f4fd6ada7e4918f2abb2d6b | |
parent | 0c53593bb8971728771089d9b59898f763323716 (diff) | |
download | sdl_ios-a3700c8dc4bf4e66f107d21a8c9a356d39e2f34e.tar.gz |
Fixed guard statemnt for soft button
Signed-off-by: NicoleYarroch <nicole@livio.io>
-rw-r--r-- | Example Apps/Example Swift/ButtonManager.swift | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Example Apps/Example Swift/ButtonManager.swift b/Example Apps/Example Swift/ButtonManager.swift index ec6276677..3cecd9f3c 100644 --- a/Example Apps/Example Swift/ButtonManager.swift +++ b/Example Apps/Example Swift/ButtonManager.swift @@ -95,13 +95,17 @@ extension ButtonManager { let imagesVisibleState = SDLSoftButtonState(stateName: ImagesVisibleSoftButtonImageOnState, text: ImagesVisibleSoftButtonImageOnText, image: nil) let imagesNotVisibleState = SDLSoftButtonState(stateName: ImagesVisibleSoftButtonImageOffState, text: ImagesVisibleSoftButtonImageOffText, image: nil) return SDLSoftButtonObject(name: ImagesVisibleSoftButton, states: [imagesVisibleState, imagesNotVisibleState], initialStateName: imagesVisibleState.name) { [weak self] (buttonPress, buttonEvent) in - guard let self = self, let manager = self.sdlManager, buttonPress != nil, let alertSoftButton = manager.screenManager.softButtonObjectNamed(AlertSoftButton) else { return } + guard let self = self, let sdlManager = self.sdlManager, buttonPress != nil else { return } + self.imagesEnabled = !self.imagesEnabled - let imagesVisibleSoftButton = self.sdlManager.screenManager.softButtonObjectNamed(ImagesVisibleSoftButton) - imagesVisibleSoftButton?.transitionToNextState() + if let imagesVisibleSoftButton = sdlManager.screenManager.softButtonObjectNamed(ImagesVisibleSoftButton) { + imagesVisibleSoftButton.transitionToNextState() + } - alertSoftButton.transitionToNextState() + if let alertSoftButton = sdlManager.screenManager.softButtonObjectNamed(AlertSoftButton) { + alertSoftButton.transitionToNextState() + } } } } |