<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP"
  },
  "title" : "View"
}
-->

# View

A type that represents part of your app’s user interface and provides
modifiers that you use to configure views.

```
@MainActor @preconcurrency protocol View
```

## Overview

You create custom views by declaring types that conform to the `View`
protocol. Implement the required [`body`](/documentation/SwiftUI/View/body-8kl5o) 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`](/documentation/SwiftUI/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](/documentation/SwiftUI/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](/documentation/SwiftUI/Configuring-Views).
For example, adding the [`opacity(_:)`](/documentation/SwiftUI/View/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](/documentation/SwiftUI/View-Layout),
add [Accessibility modifiers](/documentation/SwiftUI/View-Accessibility) information,
and respond to [Input and event modifiers](/documentation/SwiftUI/View-Input-and-Events).
You can also collect groups of default modifiers into new,
custom view modifiers for easy reuse.

A type conforming to this protocol inherits `@preconcurrency @MainActor`
isolation from the protocol if the conformance is declared in its original
declaration. Isolation to the main actor is the default, but it’s not
required. Declare the conformance in an extension to opt-out the isolation.

## Topics

### Implementing a custom view

[`body`](/documentation/SwiftUI/View/body-8kl5o)

The content and behavior of the view.

[`Body`](/documentation/SwiftUI/View/Body-swift.associatedtype)

The type of view representing the body of this view.

[`modifier(_:)`](/documentation/SwiftUI/View/modifier(_:))

Applies a modifier to a view and returns a new view.

[Previews in Xcode](/documentation/SwiftUI/Previews-in-Xcode)

Generate dynamic, interactive previews of your custom views.

### Configuring view elements

[Accessibility modifiers](/documentation/SwiftUI/View-Accessibility)

Make your SwiftUI apps accessible to everyone, including people with
disabilities.

[Appearance modifiers](/documentation/SwiftUI/View-Appearance)

Configure a view’s foreground and background styles, controls, and visibility.

[Text and symbol modifiers](/documentation/SwiftUI/View-Text-and-Symbols)

Manage the rendering, selection, and entry of text in your view.

[Auxiliary view modifiers](/documentation/SwiftUI/View-Auxiliary-Views)

Add and configure supporting views, like toolbars and context menus.

[Chart view modifiers](/documentation/SwiftUI/View-Chart-View)

Configure charts that you declare with Swift Charts.

### Drawing views

[Style modifiers](/documentation/SwiftUI/View-style-modifiers)

Apply built-in styles to different types of views.

[Layout modifiers](/documentation/SwiftUI/View-Layout)

Tell a view how to arrange itself within a view hierarchy by adjusting its size,
position, alignment, padding, and so on.

[Graphics and rendering modifiers](/documentation/SwiftUI/View-Graphics-and-Rendering)

Affect the way the system draws a view, for example by scaling or masking a view,
or by applying graphical effects.

### Providing interactivity

[Input and event modifiers](/documentation/SwiftUI/View-Input-and-Events)

Supply actions for a view to perform in response to user input and system events.

[Search modifiers](/documentation/SwiftUI/View-Search)

Enable people to search for content in your app.

[Presentation modifiers](/documentation/SwiftUI/View-Presentation)

Define additional views for the view to present under specified conditions.

[State modifiers](/documentation/SwiftUI/View-State)

Access storage and provide child views with configuration data.

### Modifying technology-specific views

[Technology-specific modifiers](/documentation/SwiftUI/View-Technology-modifiers)

Add modifiers to customize SwiftUI views that other Apple frameworks provide.

### Deprecated modifiers

[Deprecated modifiers](/documentation/SwiftUI/View-Deprecated)

Review unsupported modifiers and their replacements.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)