Skip to content
This repository has been archived by the owner on Jan 5, 2020. It is now read-only.

UITabBar is missing mixedBarStyle property? #8

Open
halleygen opened this issue Nov 21, 2016 · 0 comments
Open

UITabBar is missing mixedBarStyle property? #8

halleygen opened this issue Nov 21, 2016 · 0 comments

Comments

@halleygen
Copy link

Not sure if I'm missing something but I think that UITabBars don't have a mixedBarStyle property. The only way I can get this to work is by adding the following code (taken from NightNight's UINavigationBar extension) to the Classes/UIKit/UITabBar+Mixed.swift file.

public extension UITabBar {
    fileprivate struct AssociatedKeys {
        static var mixedBarStyleKey = "mixedBarStyleKey"
    }
    
    public var mixedBarStyle: MixedBarStyle? {
        get {
            return objc_getAssociatedObject(self, &AssociatedKeys.mixedBarStyleKey) as? MixedBarStyle
        }
        set {
            objc_setAssociatedObject(self, &AssociatedKeys.mixedBarStyleKey, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
            
            addNightObserver(#selector(_updateBarStyle))
        }
    }
    
    func _updateBarStyle() {
        if let mixedBarStyle = mixedBarStyle {
            barStyle = mixedBarStyle.unfold()
        }
    }
    
}

Is there another way of giving a MixedBarStyle to a UITabBar or was it accidentally left out of the code?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant