After migrating the project to swift 5, I'm getting a lot of errors such as
Expression implicitly coerced from 'UIButton?' to 'Any'
I'm not sure what's causing this. One example where this is happening(there are a bunch) is when I'm setting the view.accessibilityElements. The array is supposed to contain : [Any]?... Any idea what's causing this?
Here is an example:
@IBOutlet weak var shareButton: UIButton!
@IBOutlet weak var shareTitleLabel: UILabel!
view.accessibilityElements = [shareButton, shareTitleLabel]
Here is another example:
@IBOutlet weak var titleLabel: UILabel!
let titleConstraints = [
NSLayoutConstraint(item: titleLabel, attribute: .leading, relatedBy: .equal, toItem: otherView, attribute: .leading, multiplier: 1, constant: horizontalTextInset),
NSLayoutConstraint(item: titleLabel, attribute: .trailing, relatedBy: .equal, toItem: otherView, attribute: .trailing, multiplier: 1, constant: -horizontalTextInset)
]
When setting the elements above like this, it causes the mentioned error