What is the `some` keyword in Swift(UI)?

后端 未结 11 647
庸人自扰
庸人自扰 2020-12-04 04:54

The new SwiftUI tutorial has the following code:

struct ContentView: View {
    var body: some View {
        Text(         


        
11条回答
  •  没有蜡笔的小新
    2020-12-04 05:52

    to simplify, if you know the difference between

    var x = 5
    

    vs

    int x =5
    

    Then you'll know some. The compiler knows it, and you know it. Minimal effort for saying you comply to something without specifying the specifics (the generic types that it uses)

提交回复
热议问题