SwiftUI: Difference between revisions

Content deleted Content added
added examples (to be added)
No edit summary
Line 17:
SwiftUI integrates with other Apple services, such as [[Xcode]] to provide for real-time previews during editing,<ref name=":0">{{Cite web |title=Previews in Xcode |url=https://developer.apple.com/documentation/swiftui/previews-in-xcode |access-date=2023-11-07 |website=Previews in Xcode – Apple Developer Documentation |language=en |archive-url=https://web.archive.org/web/20231107221047/https://developer.apple.com/documentation/swiftui/previews-in-xcode |archive-date=2023-11-07}}</ref> and support for maps with [[Apple Maps]].<ref>{{Cite web |title=MapKit for SwiftUI |url=https://docs.developer.apple.com/documentation/mapkit/mapkit_for_swiftui |access-date=2024-01-10 |website=Apple Developer Documentation |language=en-US}}</ref>
== Examples ==
The following is an example of a simple [[Hello World]] program. It is standard practice in SwiftUI to separate the Applicationapplication struct and Viewsviews into different classesstructs, with the main view named ContentView{{citation needed}}.
<syntaxhighlight lang="swift">
import SwiftUI
 
@main
struct AnApp: App {