In iOS 11 I'm currently changing the back button for my navigation controllers like this:
UINavigationBar.appearance().backIndicatorImage = whiteBackButtonImage!.withRenderingMode(.alwaysOriginal)
UINavigationBar.appearance().backIndicatorTransitionMaskImage = whiteBackButtonImage!.withRenderingMode(.alwaysOriginal)
That seems to work fine, the problem is when I want to differentiate between two kind of UINavigationControllers using different back images :
let whiteNavigationBarAppearance = UINavigationBar.appearance(whenContainedInInstancesOf: [WhiteNavigationController.self])
whiteNavigationBarAppearance.backIndicatorImage = greenBackButtonImage!.withRenderingMode(.alwaysOriginal)
whiteNavigationBarAppearance.backIndicatorTransitionMaskImage = greenBackButtonImage!.withRenderingMode(.alwaysOriginal)
let greenNavigationBarAppearance = UINavigationBar.appearance(whenContainedInInstancesOf: [GreenNavigationController.self])
greenNavigationBarAppearance.backIndicatorImage = whiteBackButtonImage!.withRenderingMode(.alwaysOriginal)
greenNavigationBarAppearance.backIndicatorTransitionMaskImage = whiteBackButtonImage!.withRenderingMode(.alwaysOriginal)
With the second approach, the regular back button is shown, so somehow it doesn't recognise the changes. Does anyone know what's wrong in my approach?