Dive into our extensive collection of 51 theory-based JavaScript interview questions.
Enhance your problem-solving skills with our 44 console-based input/output questions.
Explore our curated selection of JavaScript programs designed to test your coding abilities.
Answer: @State is used for local state management. It allows views to update dynamically when the state changes.
Answer: @State is for local state, while @Binding allows a child view to modify state owned by its parent.
Answer: @ObservedObject allows a view to observe an external object conforming to the ObservableObject protocol.
Answer: NavigationView provides a container that enables navigation between views using NavigationLink.
Answer: VStack arranges its child views vertically in a stack.
Answer: ZStack overlays its child views on top of each other.
Answer: The .onAppear() modifier executes a closure when the view appears on the screen.
Answer: - .frame() specifies the size of a view. - .padding() adds space around the view's content.
Answer: Declarative syntax simplifies UI code, reduces bugs, and improves readability.
Answer: ForEach iterates over a collection and creates views for each element.
Answer: GeometryReader provides access to the size and position of a view's container, enabling dynamic layouts.
Answer: ViewModifiers allow you to encapsulate reusable configurations for views, such as custom padding or backgrounds.
Answer: .animation() adds implicit animations to view property changes.
Answer: @EnvironmentObject allows sharing data across multiple views without explicit passing, while @ObservedObject requires direct injection.
Answer: The .clipShape() modifier clips a view to a specified shape, such as Circle or RoundedRectangle.
Answer: SwiftUI uses property wrappers like @State, @Binding, and @EnvironmentObject to manage data flow.
Answer: .sheet() displays a modal view, while .popover() shows a popover anchored to a specific view.
Answer: AppStorage persists data using UserDefaults, while SceneStorage is used for temporary state restoration.
Answer: @Published notifies observers when a property changes, often used in ObservableObject.
Answer: Combine powers SwiftUI's reactive data flow, enabling asynchronous programming with Observables.