Framework

SwiftUI

Declare the user interface and behavior for your app on every platform.

Overview

SwiftUI provides views, controls, and layout structures for declaring your app's user interface. The framework provides event handlers for delivering taps, gestures, and other types of input to your app, and tools to manage the flow of data from your app's models down to the views and controls that users will see and interact with.

Create your own custom views that conform to the View protocol, and compose them with SwiftUI views for displaying text, images, and custom shapes using stacks, lists, and more. Apply powerful modifiers to built-in views and your own views to customize their rendering and interactivity. Share code between apps on multiple platforms with views and controls that adapt to their context and presentation.

An image showing an app built using SwiftUI running on the Mac, iPhone, and Apple Watch.

You can integrate SwiftUI views with objects from the UIKit, AppKit, and WatchKit frameworks to take further advantage of platform-specific functionality. You can also customize accessibility support in SwiftUI, and localize your app’s interface for different languages, countries, or cultural regions.

Topics

Essentials

Learn to Make Apps with SwiftUI

Follow a series of guided tutorials to learn to make apps using SwiftUI and Xcode.

User Interface

Views and Controls

Present your content onscreen and handle user interactions.

View Layout and Presentation

Combine views in stacks, generate groups and lists of views dynamically, and define view presentations and hierarchy.

Drawing and Animation

Enhance your views with colors, shapes, and shadows, and customize animated transitions between view states.

Framework Integration

Integrate SwiftUI views into existing apps, and embed AppKit, UIKit, and WatchKit views and controllers into SwiftUI view hierarchies.

Data and Events

State and Data Flow

Control and respond to the flow of data and changes within your app’s models.

Gestures

Define interactions from taps, clicks, and swipes to fine-grained gestures.

Previews in Xcode

Previews

Generate dynamic, interactive previews of your custom views.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software