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

UITabBar is missing mixedBarStyle property? #8

@halleygen

Description

@halleygen

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions