Xcode 8:函数类型不能让参数标签破坏我的构建 [英] Xcode 8 :function types cannot have argument label breaking my build

查看:312
本文介绍了Xcode 8:函数类型不能让参数标签破坏我的构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎由于某种原因,Swift选择通过强制用户删除完成处理程序参数标签来降低编码。我已经阅读过Swift的讨论,仍然认为这是一个错误。至少他们可以让它成为可选的。

It seems that for some reason Swift have chosen to make coding in it less readable by forcing users to remove completion handler parameter labels. I have read the Swift discussion and still think it's a mistake. At least they could have made it optional.

使用Xcode 8构建时 - 有没有办法强制编译器使用Swift 2.3,所以我不再会遇到这些错误了?
我已经更新了使用旧版Swift的选项(在构建设置下)

但我似乎仍然收到此错误:

When building using Xcode 8 - is there a way to force the compiler to use Swift 2.3 so I don't get these errors anymore? I have updated the option to use legacy Swift (under build settings) but I still seem to get this error:


函数类型不能有参数标签'isloggedIn';使用'_'
而不是

Function types cannot have argument label 'isloggedIn'; use '_' instead

如何在完成处理程序中保留标签?

How can I keep my labels in my completion handlers?

推荐答案

Swift设计者决定禁止函数类型的参数标签。

The Swift designers decided to prohibit argument labels for function types.

这里解释了推理: https://github.com/apple/swift-evolution/blob/master/proposals/0111-remove-arg-label-type-significance.md

这是一个令人沮丧和可疑的选择,因为禁止参数标签使得更容易错误地调用闭包,这似乎比简化语言的类型系统更重要。

This is a frustrating and questionable choice, as prohibiting argument labels makes it much easier to incorrectly invoke closures, which seems more important than simplifying the language's type system.

可用性>意识形态。

这篇关于Xcode 8:函数类型不能让参数标签破坏我的构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆