Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStatsPractice TestsCertifications

Categories

🎓 Certifications
🤖 Artificial Intelligence
☁️ Cloud and Infrastructure
💾 Data and Databases
💼 Professional Skills
🎯 Programming and Development
🔒 Security and Networking
📚 Specialized Topics
CheatGrid
HomeAboutTopicsPricingMy VaultStatsPractice TestsCertifications
LVLEVEL 0
0/5 XP
GitHub
© 2026 CheatGrid™. All rights reserved.
Privacy PolicyTerms of UseAboutContact

SwiftUI Cheat Sheet

SwiftUI Cheat Sheet

Back to Mobile Development
Updated 2026-05-25
Next Topic: UIKit Cheat Sheet

SwiftUI is Apple's declarative framework for building user interfaces across iOS, iPadOS, macOS, watchOS, and tvOS, introduced in 2019. Unlike imperative UIKit, SwiftUI describes what the UI should look like at any given state, and the framework handles the rendering and updates automatically. It uses a reactive data flow model where UI components automatically update when underlying data changes, eliminating manual view controller management. The key mental model: views are cheap, ephemeral structs that SwiftUI recreates frequently—state lives elsewhere (in property wrappers like @State or @Observable models), and SwiftUI diffs the view tree to render only what changed. iOS 26 (WWDC25) introduced Liquid Glass, WebView, rich-text editing in TextEditor, and the @Animatable macro—master property wrappers and the Observation framework and you've mastered 80% of SwiftUI.

What This Cheat Sheet Covers

This topic spans 27 focused tables and 206 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: Core Property WrappersTable 2: Stack LayoutsTable 3: Grid and ListTable 4: NavigationTable 5: Tabs and ToolbarsTable 6: Forms and Input ControlsTable 7: Presentation ModifiersTable 8: Scrolling and Lazy LoadingTable 9: AnimationTable 10: GesturesTable 11: Modifiers – Layout and PositioningTable 12: Modifiers – Visual AppearanceTable 13: Modifiers – TransformationTable 14: Shapes and DrawingTable 15: Gradients, Materials and EffectsTable 16: Text and TypographyTable 17: Images, Media and WebTable 18: List CustomizationTable 19: State and LifecycleTable 20: Layout and SizingTable 21: Advanced ModifiersTable 22: Buttons and Interactive ControlsTable 23: Environment and SettingsTable 24: Custom Views and ModifiersTable 25: Data Flow PatternsTable 26: SwiftData IntegrationTable 27: Accessibility Modifiers

Table 1: Core Property Wrappers

Property wrappers are the backbone of SwiftUI's reactive data model. Choosing the right wrapper—@State vs @StateObject vs @Observable—determines ownership, lifetime, and when views re-render.

WrapperExampleDescription
@State
@State private var count = 0
• View-owned mutable state for simple value types
• SwiftUI rerenders when value changes
@Binding
@Binding var isOn: Bool
Two-way connection to a parent's @State—changes propagate both up and down the hierarchy.
@StateObject
@StateObject var vm = ViewModel()
View-owned reference type conforming to ObservableObject—survives view recreation and owns the object's lifetime.
@ObservedObject
@ObservedObject var vm: ViewModel
Externally-owned reference type—does not own the object, receives it from parent or environment.
@EnvironmentObject
@EnvironmentObject var settings: Settings
Dependency injection for shared objects passed down the hierarchy, skipping intermediate views.
@Observable (iOS 17+)
@Observable class Model { var name = "" }
• Modern macro-based observation—no @Published needed
• views auto-track only accessed properties

More in Mobile Development

  • Swift Cheat Sheet
  • UIKit Cheat Sheet
  • .NET MAUI Cross-Platform Framework Cheat Sheet
  • Cross-Platform Mobile UI Component Libraries Cheat Sheet
  • Jetpack Compose Cheat Sheet
  • Mobile App Navigation Patterns Cheat Sheet_v1_references
View all 40 topics in Mobile Development