Content deleted Content added
→Examples: The assertion that it's standard practice to separate app struct and view structs is common knowledge in the SwiftUI developer world but is difficult to cite. The assertion that the main view is called "ContentView" however is pure preference and personal style. I removed the assertion of preference as fact while leaving the assertion of broad convention in the hopes we can find a style guide to reference. |
reference to MVVM |
||
Line 13:
}}
'''SwiftUI''' is a declarative user interface framework<ref name="announcement">{{Cite web |last=Mayo |first=Benjamin |date=June 3, 2019 |title=Apple announces SwiftUI, a modern declarative user interface framework for Apple platforms |url=https://9to5mac.com/2019/06/03/apple-announces-swiftui-a-modern-declarative-user-interface-framework-for-apple-platforms/ |access-date=January 22, 2024 |website=9to5mac.com}}</ref> for building [[user interface]]s for [[iOS]], [[iPadOS]], [[watchOS]], [[tvOS]], [[visionOS]] and [[macOS]], developed by [[Apple Inc.]] for the [[Swift (programming language)|Swift]] programming language.
== Overview ==
Line 34:
== Examples ==
The following is an example of a simple [["Hello, World!" program|Hello World]] program. 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{{citation needed|date=January 2024}}.
<syntaxhighlight lang="swift">
import SwiftUI
|