iOS Development IOS App Development Fundamentals 3 — Questions and Answers
Question 1: Which property wrapper creates a source of truth for mutable state owned by a SwiftUI view?
- @Binding
- @State (Correct answer)
- @Environment
- @FetchRequest
Correct answer: @State
@State manages local, view-owned mutable state and triggers view updates when changed.
Question 2: What is the recommended language for new iOS development by Apple?
- Objective-C
- Swift (Correct answer)
- C++
- Java
Correct answer: Swift
Swift is Apple's modern, type-safe language and the recommended choice for new iOS apps.
Question 3: Which IDE is used to develop, build, and submit iOS apps?
- Android Studio
- Visual Studio
- Xcode (Correct answer)
- Eclipse
Correct answer: Xcode
Xcode is Apple's official integrated development environment for building and submitting iOS apps.
Question 4: What does a closure capture when it references variables from its surrounding scope?
- A copy of the entire app state
- References to those variables (a capture list controls semantics) (Correct answer)
- Only constants
- Nothing
Correct answer: References to those variables (a capture list controls semantics)
Closures capture references to variables in their surrounding context, and capture lists let you control strong/weak capture.
Question 5: Which design pattern does UIKit heavily rely on for view controller communication?
- Singleton only
- Delegation (Correct answer)
- Observer only
- Factory
Correct answer: Delegation
Delegation lets one object act on behalf of, or in coordination with, another via a protocol.
Question 6: What is the purpose of the viewDidLoad() method in a UIViewController?
- Called every time the view appears
- Called once after the view is loaded into memory (Correct answer)
- Called when memory is low
- Called when the app terminates
Correct answer: Called once after the view is loaded into memory
viewDidLoad() runs once after the controller's view is loaded, ideal for one-time setup.
Question 7: Which tool manages third-party Swift dependencies and is built into Xcode?
- CocoaPods
- Swift Package Manager (Correct answer)
- Carthage
- npm
Correct answer: Swift Package Manager
Swift Package Manager (SPM) is Apple's native dependency manager integrated directly into Xcode.
Which property wrapper creates a source of truth for mutable state owned by a SwiftUI view?