Content deleted Content added
and I got the wrong link, so much for double checking. See previous edit summary. |
|||
(10 intermediate revisions by 8 users not shown) | |||
Line 10:
| genre = [[Software framework]]
| license = [[proprietary software|Proprietary]]
| website = https://developer.apple.com
}}
'''SwiftUI''' is a [[Declarative programming|declarative
== Overview ==
SwiftUI is [[Declarative programming|declarative]], contrasting with the [[Imperative programming|imperative syntax]] used in other Apple development frameworks such as [[UIKit]] and [[AppKit]]. SwiftUI allows for 2D drawing, animations, [[Event (computing)|event handling]], widgets, and [[data binding]]. SwiftUI automatically synchronizes between UI views and data.<ref>{{Cite web |title=SwiftUI |url=https://docs.developer.apple.com/documentation/swiftui |access-date=2024-01-10 |website=Apple Developer Documentation |language=en-US}}</ref>
SwiftUI integrates with other Apple
SwiftUI allows for interoperability with UIKit and AppKit views via the <code>UIViewRepresentable</code>
== History ==
Line 34:
== Examples ==
The following is an example of a simple [["Hello, World!" program|Hello World]] program. The {{code|@main}} 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|Model–View–ViewModel]] (MVVM) architectural pattern.<ref>{{Cite book |last=Hudson |first=Paul |title=Swift Design Patterns |publisher=Paul Hudson |year=2018 |language=English}}
<syntaxhighlight lang="swift">
import SwiftUI
Line 46:
}
}
struct ContentView: View {
var body: some View {
Text("Hello, World!")
}
</syntaxhighlight>
|