Created
March 26, 2020 18:00
-
-
Save Exey/681cac404d4617cb8b06af67f95c5860 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
extension UITabBar { | |
/// // TabBar Hide Mechanism | |
/// @Published var hideTabBar = false | |
/// var tabBarSubscriberCancellable: AnyCancellable? | |
open override func setNeedsDisplay() { | |
super.setNeedsDisplay() | |
// tricky subscribe | |
let coreApp: CoreAppService = ServiceLocator.shared.inject() | |
if coreApp.tabBarSubscriberCancellable == nil { | |
coreApp.tabBarSubscriberCancellable = coreApp.$hideTabBar.sink(receiveValue: { hide in | |
self.alpha = hide ? 0 : 1.0 | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment