iOS Interview Questions and Answers Guide
1.1 Basics of Swift
Q: What is Swift, and what makes it different from Objective-C?
A: Swift is a powerful and intuitive programming language developed by Apple for iOS, macOS, watchOS,
and tvOS. It is safer, faster, and more concise than Objective-C. Swift offers modern language features such
as type inference, optionals, closures, and memory safety by default.
Q: Explain the concept of type inference in Swift.
A: Type inference allows Swift to deduce the type of a variable automatically based on the assigned value.
For example, `let number = 10` is inferred as an `Int`.
Q: How do you declare a constant in Swift, and when would you use it?
A: Constants are declared using the `let` keyword. You use them when the value should not change after
assignment, ensuring safety and predictability in your code.