var body: Self.Body
associatedtype Body : View
func modifier<T>(T) -> ModifiedContent <Self, T>
Availability 有効性
Technology
protocol View
You create custom views by declaring types that conform to the View
protocol. Implement the required body
computed property to provide the content for your custom view.
struct MyView: View {
var body: some View {
Text("Hello, World!")
}
}
Assemble the view’s body by combining one or more of the built-in views provided by SwiftUI, like the Text
instance in the example above, plus other custom views that you define, into a hierarchy of views. For more information about creating custom views, see Declaring a Custom View.
The View
protocol provides a set of modifiers — protocol methods with default implementations — that you use to configure views in the layout of your app. Modifiers work by wrapping the view instance on which you call them in another view with the specified characteristics, as described in Configuring Views. For example, adding the opacity(_:)
modifier to a text view returns a new view with some amount of transparency:
Text("Hello, World!")
.opacity(0.5) // Display partially transparent text.
The complete list of default modifiers provides a large set of controls for managing views. For example, you can fine tune Layout Modifiers, add Accessibility Modifiers information, and respond to Input and Event Modifiers. You can also collect groups of default modifiers into new, custom view modifiers for easy reuse.
var body: Self.Body
associatedtype Body : View
func modifier<T>(T) -> ModifiedContent <Self, T>
AngularGradient
AnyView
AsyncImage
Button
ButtonStyleConfiguration.Label
Canvas
Symbols
conforms to View
.Capsule
Circle
Color
ColorPicker
ContainerRelativeShape
ControlGroup
ControlGroupStyleConfiguration.Content
DatePicker
DisclosureGroup
Divider
EditButton
Ellipse
EllipticalGradient
EmptyView
EquatableView
ForEach
Data
conforms to RandomAccessCollection
, ID
conforms to Hashable
, and Content
conforms to View
.
Data
がRandomAccessCollection
に準拠する、ID
がHashable
に準拠する、そしてContent
がView
に準拠する時に準拠します。
Form
Gauge
GaugeStyleConfiguration.CurrentValueLabel
GaugeStyleConfiguration.Label
GaugeStyleConfiguration.MarkedValueLabel
GaugeStyleConfiguration.MaximumValueLabel
GaugeStyleConfiguration.MinimumValueLabel
GeometryReader
Group
Content
conforms to View
.GroupBox
GroupBoxStyleConfiguration.Content
GroupBoxStyleConfiguration.Label
HSplitView
HStack
Image
Label
LabelStyleConfiguration.Icon
LabelStyleConfiguration.Title
LazyHGrid
LazyHStack
LazyVGrid
LazyVStack
LinearGradient
Link
List
Menu
MenuButton
MenuStyleConfiguration.Content
MenuStyleConfiguration.Label
ModifiedContent
Content
conforms to View
and Modifier
conforms to ViewModifier
.NavigationLink
NavigationView
OffsetShape
OutlineGroup
Data
conforms to RandomAccessCollection
, ID
conforms to Hashable
, Parent
conforms to View
, Leaf
conforms to View
, and Subgroup
conforms to View
.OutlineSubgroupChildren
PasteButton
Path
Picker
PrimitiveButtonStyleConfiguration.Label
ProgressView
ProgressViewStyleConfiguration.CurrentValueLabel
ProgressViewStyleConfiguration.Label
RadialGradient
Rectangle
RotatedShape
RoundedRectangle
ScaledShape
ScrollView
ScrollViewReader
Section
Parent
conforms to View
, Content
conforms to View
, and Footer
conforms to View
.SecureField
Slider
Spacer
Stepper
SubscriptionView
TabView
Table
Text
テキスト
TextEditor
TextField
TimelineView
Schedule
conforms to TimelineSchedule
and Content
conforms to View
.Toggle
ToggleStyleConfiguration.Label
TransformedShape
TupleView
VSplitView
VStack
ZStack
struct ViewBuilder