Swift语法是什么? .bar"叫? [英] What is the Swift syntax " .bar" called?
本文介绍了Swift语法是什么? .bar"叫?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Swift具有以下方便的语法:
Swift has this handy syntax:
enum Foo {
case bar
case baz
}
func hoge(foo: Foo) {
}
hoge(foo: .bar) // This
在enum
以外的其他地方被镜像:
Which is mirrored in places other than enum
s:
struct Qux {
static let `default` = Qux()
}
func hoge(qux: Qux) {
}
hoge(qux: .default) // This
我不确定在对话/票证中该怎么称呼.也许是类型推断的点语法"?我不确定此语法是否有正式名称?如果是,它是什么?
I am not sure what to call this in conversation / tickets. Maybe "type-inferred dot syntax"? I'm unsure. Does this syntax have an official name? If so, what is it?
推荐答案
查看全文