What is the “some” keyword in Swift(UI)?

The new SwiftUI tutorial has the following code:

struct ContentView: View {
    var body: some View {
        Text("Hello World")
    }
}

The second line the word some, and on their site is highlighted as if it were a keyword.

Swift 5.1 does not appear to have some as a keyword, and I don’t see what else the word some could be doing there, since it goes where the type usually goes. Is there a new, unannounced version of Swift? Is it a function that’s being used on a type in a way I didn’t know about?

What does the keyword some do?

13 Answers
13

Leave a Comment