Unable to change UINavigationBar titleTextAttributes using appearanceWhenContainedInInstancesOfClasses

A am using iOS 11 SDK and when I use appearance proxy everything works, including:

[[UINavigationBar appearance] setTitleTextAttributes: @{ NSFontAttributeName: [UIFont navigationBarFontWithSize:22.0f], NSForegroundColrAttributeName: [UIColor whiteColor] }];

To change navigationbar title font, but when i use appearance proxy as is to change navigation bar style - it messes up the navigationbar of the compose email / sms modal I get from the UIActivityViewController.


So instead I use appearanceWhenContainedInInstancesOfClasses which works for everything except for this:


[[UINavigationBar appearanceWhenContainedInInstancesOfClasses: @[[RootViewController class]]] setTitleTextAttributes: @{ NSFontAttributeName: [UIFont navigationBarFontWithSize:22.0f], NSForegroundColorAttributeName: [UIColor whiteColor] }];

I can't find any solution for this, is there a workaround for this bug?