init()
Creates an empty view.
Availability 有効性
Technology
@frozen struct EmptyView
You will rarely, if ever, need to create an Empty
directly. Instead, Empty
represents the absence of a view.
SwiftUI uses Empty
in situations where a SwiftUI view type defines one or more child views with generic parameters, and allows the child views to be absent. When absent, the child view’s type in the generic type parameter is Empty
.
The following example creates an indeterminate Progress
without a label. The Progress
type declares two generic parameters, Label
and Current
, for the types used by its subviews. When both subviews are absent, like they are here, the resulting type is Progress
, as indicated by the example’s output:
let progressView = ProgressView()
print("\(type(of:progressView))")
// Prints: ProgressView<EmptyView, EmptyView>
init()
typealias Body
struct AnyView
struct EquatableView
struct SubscriptionView
struct TupleView