HOME

TheInfoList



OR:

SwiftUI is a declarative framework for building
user interface In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine fro ...
s for
iOS Ios, Io or Nio (, ; ; locally Nios, Νιός) is a Greek island in the Cyclades group in the Aegean Sea. Ios is a hilly island with cliffs down to the sea on most sides. It is situated halfway between Naxos and Santorini. It is about long an ...
,
iPadOS iPadOS is a mobile operating system developed by Apple for its iPad line of tablet computers. It was given a name distinct from iOS, the operating system used by Apple's iPhones to reflect the diverging features of the two product lines, suc ...
,
watchOS watchOS is the operating system of the Apple Watch, developed by Apple Inc., Apple. It is based on iOS, the operating system used by the iPhone, and has many similar features. It was released on April 24, 2015, along with the Apple Watch, the o ...
,
tvOS tvOS (formerly Apple TV Software) is an operating system developed by Apple for the Apple TV, a digital media player. In the first-generation Apple TV, Apple TV Software was based on Mac OS X. The software for the second-generation and later ...
,
visionOS visionOS is a mixed reality operating system derived primarily from iPadOS and its core frameworks (including UIKit, SwiftUI, ARKit and RealityKit), and MR-specific frameworks for foveated rendering and real-time interaction. It was develope ...
and
macOS macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
, developed by
Apple Inc. Apple Inc. is an American multinational corporation and technology company headquartered in Cupertino, California, in Silicon Valley. It is best known for its consumer electronics, software, and services. Founded in 1976 as Apple Comput ...
for the
Swift Swift or SWIFT most commonly refers to: * SWIFT, an international organization facilitating transactions between banks ** SWIFT code * Swift (programming language) * Swift (bird), a family of birds It may also refer to: Organizations * SWIF ...
programming language.


Overview

SwiftUI is declarative, contrasting with the imperative syntax used in other Apple development frameworks such as
UIKit UIKit is an application development environment and graphical user interface toolkit from Apple Inc. used to build apps for the iOS, iPadOS, watchOS, tvOS, and visionOS operating systems. UIKit provides an abstraction layer of iOS, the operati ...
and AppKit. SwiftUI allows for 2D drawing, animations,
event handling In computing, an event is a detectable occurrence or change in the system's state, such as user input, hardware interrupts, system notifications, or changes in data or conditions, that the system is designed to monitor. Events trigger responses or ...
, widgets, and data binding. SwiftUI automatically synchronizes between UI views and data. SwiftUI integrates with other Apple technologies, such as
Xcode Xcode is a suite of developer tools for building apps on Apple devices. It includes an integrated development environment (IDE) of the same name for macOS, used to develop software for macOS, iOS, iPadOS, watchOS, tvOS, and visionOS. It w ...
and Swift Playgrounds to provide for real-time previews during editing, alongside support for debugging and other development features. SwiftUI allows for interoperability with UIKit and AppKit views via the UIViewRepresentable and NSViewRepresentable protocols respectively.


History

SwiftUI was announced at the company's
Worldwide Developers Conference The Worldwide Developers Conference (WWDC) is an information technology conference held annually by Apple Inc. The conference is currently held at Apple Park in California. The event is used to showcase new software and technologies in the macO ...
(WWDC) on June 3, 2019, and was added in
iOS 13 iOS 13 is the thirteenth major release of the iOS mobile operating system developed by Apple for the iPhone, iPod Touch and HomePod. The successor to iOS 12, it was announced at the company's Worldwide Developers Conference (WWDC) on June ...
and
macOS Catalina macOS Catalina (version 10.15) is the sixteenth software versioning, major release of macOS, Apple Inc.'s desktop operating system for Macintosh computers. It is the successor to macOS Mojave and was announced at WWDC 2019 on June 3, 2019 and ...
. During WWDC 2020 and the
iOS 14 iOS 14 is the fourteenth major release of the iOS mobile operating system developed by Apple for the iPhone and iPod touch lines. Announced at the company's Worldwide Developers Conference on June 22, 2020 as the successor to iOS 13, it was rel ...
release cycle, Apple natively added support for maps with the Map view, with an interface based on
Apple Maps Apple Maps is a web mapping service developed by Apple Inc. As the default map system of iOS, iPadOS, macOS, tvOS, visionOS, and watchOS, it provides directions and estimated times of arrival for driving, walking, cycling, and public trans ...
via MapKit. MapKit allows for map annotation and satellite imagery. During WWDC 2021 and the
iOS 15 iOS 15 is the fifteenth major release of the iOS mobile operating system developed by Apple for its iPhone and iPod Touch lines of products. It was announced at the company's Worldwide Developers Conference on June 7, 2021, as the successor to i ...
release cycle, Apple added the Canvas element, adding support for Immediate mode drawing and performant 2D drawing. During WWDC 2022 and the
iOS 16 iOS 16 is the iOS version history, sixteenth major release of Apple Inc., Apple's iOS mobile operating system for the iPhone. It is the successor of iOS 15, and was announced at the company's Worldwide Developers Conference (WWDC) on June 6, 202 ...
release cycle, Apple released Swift Charts, a framework for making customizable and accessible charts. During WWDC 2023, Apple announced the
Apple Vision Pro The Apple Vision Pro is a mixed reality, mixed-reality headset developed by Apple Inc., Apple. It was announced on June 5, 2023, at Apple's Worldwide Developers Conference (WWDC) and was released first in the US, then in global territories thr ...
, and support for the device was added to SwiftUI, alongside new views for AR content such as RealityView and ImmersiveSpace.


Examples

The following is an example of a simple
Hello World Hello World may refer to: * "Hello, World!" program, a computer program that outputs or displays the message "Hello, World!" Music * "Hello World!" (composition), song by the Iamus computer * "Hello World" (Tremeloes song), 1969 * "Hello World" ...
program. The attribute defines the entry point into the app. It is standard practice in SwiftUI to separate the application struct and views into different structs, according to the Model–View–ViewModel (MVVM) architectural pattern. import SwiftUI @main struct AnApp: App struct ContentView: View


References


External links


SwiftUI
at
Apple Developer Apple Developer (formerly Apple Developer Connection) is Apple Inc.'s website for software development tools, application programming interfaces (APIs), and technical resources. It contains resources to help software developers write software for ...


Further reading

* * * {{iOS Gesture recognition IOS IPhone Proprietary software