Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStats

Categories

🤖 Artificial Intelligence
☁️ Cloud and Infrastructure
💾 Data and Databases
💼 Professional Skills
🎯 Programming and Development
🔒 Security and Networking
📚 Specialized Topics
HomeAboutTopicsPricingMy VaultStats
LEVEL 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-03-17
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. Master property wrappers and you've mastered 80% of SwiftUI.

What This Cheat Sheet Covers

This topic spans 25 focused tables and 166 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 and MaterialsTable 16: Text and TypographyTable 17: Images and MediaTable 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 Patterns

Table 1: Core Property Wrappers

WrapperExampleDescription
@State
@State private var count = 0
• View-owned mutable state for simple value types
• SwiftUI automatically rerenders when the value changes.
@Binding
@Binding var isOn: Bool
• Two-way connection to a parent's @State
• changes propagate both up and down the view 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 view hierarchy
• skips intermediate views.
@Observable (iOS 17+)
@Observable class Model { var name = "" }
• Modern macro-based observation
• no property wrappers needed in view—SwiftUI tracks 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