[swift-users] Swift 4.0 forEach problem
Slava Pestov
spestov at apple.com
Fri May 19 18:20:05 CDT 2017
Thanks, do you mind filing a bug at bugs.swift.org <http://bugs.swift.org/>?
Slava
> On May 19, 2017, at 4:18 PM, Edward Connell via swift-users <swift-users at swift.org> wrote:
>
> In swift 3.1.1 I was able to have the function below, which "gets" an optional member collection of objects and calls their setModel member function. Simple and clean using the forEach method.
>
> public func setModel(model: Model) {
> get()?.forEach { $0.setModel(model: model) }
> }
>
> However it now fails with Swift 4.0 saying: Extraneous argument label 'model:' in call
>
> -------------------
> If I rewrite the function as follows, then it compiles with no errors.
>
> public func setModel(model: Model) {
> if let items = get() {
> for item in items {
> item.setModel(model: model)
> }
> }
> }
>
> Something is broken...
>
> Any ideas what is wrong?
>
> Thanks, Ed
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170519/07e9611a/attachment.html>
More information about the swift-users
mailing list