I'm getting this warning which is showing fairly randomly in XCode14.1, mainly at build but then disappears.
My code is :
let attributes = [NSAttributedString.Key.font:UIFont(name: "HelveticaNeue-Bold", size: 14)]
profile.tabBarItem.setTitleTextAttributes(attributes, for: UIControl.State.normal)
I have followed this SO thread :
Swift Expression implicitly coerced from 'Any??' to 'Any?'
but had no luck removing the error. I have tried:
let attributes:[NSAttributedString.Key:UIFont?] = [NSAttributedString.Key.font:UIFont(name: "HelveticaNeue-Bold", size: 14)]
profile.tabBarItem.setTitleTextAttributes(attributes, for: UIControl.State.normal)
and
let attributes:[NSAttributedString.Key:UIFont?]? = [NSAttributedString.Key.font:UIFont(name: "HelveticaNeue-Bold", size: 14)] profile.tabBarItem.setTitleTextAttributes(attributes, for: UIControl.State.normal)
But the warning persists.
Any help appreciated.
Thanks