There is one big thing that confuses me about view types in SwiftUI:
They don\'t seem to conform to the View
protocol, but somehow, they mysterious
As you know there are 2 types are Views..
Text
, Image
, Circle
etc List
, HStack
, VStack
etcThat said, below is an extension for Text
, Body is set to Never which means its not allowed to have a body because it is a primitive view that is meant for ending body cycle.
So,(per my understanding) at runtime SwiftUI wraps Text
inside a container view when it finds a primitive view not being inside a container view.
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
extension Text {
/// The type of view representing the body of this view.
///
/// When you create a custom view, Swift infers this type from your
/// implementation of the required `body` property.
public typealias Body = Never
}