Sturct View

Hi
When creating new SwiftUI App we get the struct below in the ContentView.Swift file, but as I know sturct can't inherit or I missed something here ? and whats the word some means ? its not the struct name or the parent struct so whats its used for ?

struct ContentView: view {

ver body: some view {
Text ( "Hello World" )
}

}



View is actually a protocol that ContentView is implementing and not inheriting. You can read about in the Swift Book:

https://docs.swift.org/swift-book/LanguageGuide/Protocols.html

Regarding the some word, it's something called Opaque Type and it's a way to hide the actually type of whatever you return from the body. Also worth reading in the book:

https://docs.swift.org/swift-book/LanguageGuide/OpaqueTypes.html
Thank you very much
Sturct View
 
 
Q