Now that @autoclosure
is part of the parameter declaration as opposed to type, how does one declare that a function takes a variadic amount of autoclosures?
Before:
public func coalesce<T>(all : @autoclosure () -> T? ...) -> T? {
for f : () -> T? in all {
if let x = f() { return x }
}
return nil
}
After: ???
I opened rdar://19782845, "Swift 1.2: Variadic auto-closures no longer supported," and was given the following response from Apple Developer Relations:
This issue behaves as intended based on the following:
@autoclosure is only allowed on parameters of function type, and varargs is an array. This is not expected to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With