I try to read all changes that happened in Swift 6 before asking here, but I did not found an answer.
The following code works in Swift 5
extension UIView{
func addSubviews(_ views : [UIView]) {
views.forEach(self.addSubview(_:))
}
}
But for Swift 6 I get:
Call can throw, but it is not marked with 'try' and the error is not handled
The fix is easier
func addSubviews(_ views : [UIView]) {
views.forEach({ self.addSubview($0) })
}
But I would like to know what changed so I can avoid it in the future.
The only thing Im changing is the SWIFT_VERSION
setting in my project using Xcode 16.