SwiftUI State Management
@State, @Binding, @ObservedObject, @EnvironmentObject, @StateObject, data flow
1Which property wrapper to use for managing local state in a SwiftUI view?
Which property wrapper to use for managing local state in a SwiftUI view?
Antwoord
@State creates a source of truth for mutable data within a view. SwiftUI automatically manages the lifecycle and redraws when the value changes. This is the fundamental mechanism for local state modifications in a single view.
2What is the purpose of the @Binding property wrapper in SwiftUI?
What is the purpose of the @Binding property wrapper in SwiftUI?
Antwoord
@Binding creates a bidirectional reference to an existing source of truth. It allows a child view to modify parent data without owning the source itself. This is essential for parent-child communication while maintaining a single source of authority.
3What is the role of @Published in SwiftUI state management?
What is the role of @Published in SwiftUI state management?
Antwoord
@Published marks properties of an ObservableObject class as observable. When a @Published property changes, the class notifies all observers, triggering view redraws. It bridges classes with SwiftUI's reactive system.
How to access a parent's @State property in a child view?
When to use @AppStorage instead of @State?
+19 gespreksvragen
Andere iOS-sollicitatieonderwerpen
Swift Basics
Swift Language Essentials
UIKit Fundamentals
UIViewController Lifecycle
UserDefaults & Keychain
Application Lifecycle
Auto Layout & Constraints
UITableView & UICollectionView
SwiftUI Basics
SwiftUI Navigation
Networking & URLSession
Codable & JSON Parsing
Core Data
Protocol Oriented Programming
MVVM Architecture
Push Notifications
Unit Testing & XCTest
UI Testing
Xcode & Build System
Swift Package Manager
Memory Management & ARC
Combine Framework
Concurrency & async/await
iOS Design Patterns
Performance Optimization
Security & Encryption
SwiftUI Advanced
iOS Application Architecture
Beheers iOS voor je volgende gesprek
Krijg toegang tot alle vragen, flashcards, technische tests, code review-oefeningen en gespreksimulatoren.
Begin gratis