1. What is iOS?
Answer:
iOS is Apple's mobile operating system used in iPhone, iPad, and iPod Touch devices. It provides the platform for developing mobile applications using Swift or Objective-C.
2. What programming languages are used for iOS development?
Answer:
- Swift (recommended by Apple)
- Objective-C (legacy language)
Swift is modern, safe, and easier to learn compared to Objective-C.
3. What is Xcode?
Answer:
Xcode is Apple's official Integrated Development Environment (IDE) used for developing iOS, macOS, watchOS, and tvOS applications.
Features:
- Code editor
- Interface Builder
- Simulator
- Debugging tools
- App Store deployment support
4. What is Swift?
Answer:
Swift is a powerful and modern programming language developed by Apple for building iOS applications.
Example:
let name = "John"
print(name)
5. What is UIKit?
Answer:
UIKit is a framework used to build user interfaces for iOS applications.
It provides:
- Buttons
- Labels
- Text Fields
- Table Views
- Navigation Controllers
6. What is SwiftUI?
Answer:
SwiftUI is Apple's modern UI framework that allows developers to build interfaces using a declarative syntax.
Example:
struct ContentView: View {
var body: some View {
Text("Hello World")
}
}
7. What is the difference between UIKit and SwiftUI?
| UIKit | SwiftUI |
|---|---|
| Imperative | Declarative |
| Older framework | Modern framework |
| More code | Less code |
| Uses Storyboards | Uses Swift code |
8. What is a ViewController?
Answer:
A ViewController manages the lifecycle of a screen and handles interactions between the UI and business logic.
Example:
class HomeViewController: UIViewController {
}
9. What is Storyboard?
Answer:
Storyboard is a visual interface design tool in Xcode used to create application screens and navigation flows.
10. What is Auto Layout?
Answer:
Auto Layout helps create responsive UIs that adapt to different screen sizes and orientations.
Benefits:
- Supports multiple devices
- Dynamic layouts
- Better UI consistency
11. What are Optionals in Swift?
Answer:
Optionals represent variables that may contain a value or nil.
Example:
var name: String?
Safe unwrapping:
if let username = name {
print(username)
}
12. What is the difference between var and let?
var
Mutable value.
var age = 25
age = 30
let
Constant value.
let country = “India”
13. What is an Array in Swift?
Answer:
var fruits = ["Apple", "Banana", "Orange"]
Arrays store multiple values of the same type.
14. What is a Dictionary in Swift?
Answer:
var student = [
"name": "John",
"city": "New York"
]
Stores data as key-value pairs.
15. What is a Class?
Answer:
A class is a blueprint for creating objects.
class Person {
var name = ""
}
16. What is a Struct?
Answer:
Struct is a value type used to create custom data models.
struct User {
var name: String
}
17. Difference Between Class and Struct?
| Class | Struct |
|---|---|
| Reference Type | Value Type |
| Supports Inheritance | No Inheritance |
| Stored in Heap | Stored in Stack |
18. What is Inheritance?
Answer:
Inheritance allows a class to inherit properties and methods from another class.
class Animal {
func sound() {}
}
class Dog: Animal {
}
19. What is Polymorphism?
Answer:
Polymorphism allows methods to behave differently based on the object calling them.
20. What is Encapsulation?
Answer:
Encapsulation means hiding internal implementation details and exposing only necessary functionality.
21. What is MVC Architecture?
Answer:
MVC stands for:
- Model → Data
- View → UI
- Controller → Logic
It is the traditional architecture pattern used in iOS development.
22. What is MVVM?
Answer:
MVVM stands for:
- Model
- View
- ViewModel
It separates UI and business logic more effectively than MVC.
23. What is a Delegate?
Answer:
Delegation is a design pattern used for communication between objects.
Example:
tableView.delegate = self
24. What is UITableView?
Answer:
UITableView displays a scrollable list of rows.
Examples:
- Contact list
- Chat list
- Settings screen
25. What is UICollectionView?
Answer:
UICollectionView displays items in a grid or custom layouts.
Examples:
- Gallery apps
- E-commerce product listings
26. What is Navigation Controller?
Answer:
Navigation Controller manages navigation between screens using a stack.
navigationController?.pushViewController(nextVC, animated: true)
27. What is UserDefaults?
Answer:
UserDefaults is used to store small amounts of data locally.
Example:
UserDefaults.standard.set("John", forKey: "username")
28. What is Core Data?
Answer:
Core Data is Apple's framework for local database storage.
Used for:
- Offline apps
- Data persistence
- Large datasets
29. What is AppDelegate?
Answer:
AppDelegate handles application lifecycle events.
Examples:
- App launch
- Backgrounding
- Notifications
30. What is SceneDelegate?
Answer:
SceneDelegate manages app windows and UI lifecycle introduced in iOS 13.
31. What is ARC?
Answer:
ARC (Automatic Reference Counting) automatically manages memory by releasing objects that are no longer used.
32. What is Memory Leak?
Answer:
A memory leak occurs when allocated memory is not released, causing increased memory usage.
33. What is a Closure?
Answer:
Closures are self-contained blocks of code that can be passed around.
Example:
let greet = {
print("Hello")
}
34. What is URLSession?
Answer:
URLSession is used to make network requests.
Example:
URLSession.shared.dataTask(with: url) { data, response, error in
}
35. What is JSON?
Answer:
JSON (JavaScript Object Notation) is a lightweight format used for API communication.
Example:
{
"name": "John",
"age": 25
}
36. What is Codable?
Answer:
Codable is a Swift protocol used for JSON parsing.
struct User: Codable {
let name: String
}
37. What is an API?
Answer:
API (Application Programming Interface) allows communication between the app and a server.
Examples:
- Login API
- Product API
- Weather API
38. What is Push Notification?
Answer:
Push notifications are messages sent from a server to users even when the app is not open.
39. What is CocoaPods?
Answer:
CocoaPods is a dependency manager used to integrate third-party libraries into iOS projects.
40. What is Swift Package Manager (SPM)?
Answer:
SPM is Apple's built-in dependency management tool.
Advantages:
- Native support in Xcode
- Faster integration
- Easier maintenance
41. What is Git?
Answer:
Git is a version control system used to track source code changes.
Common Commands:
git clone
git commit
git push
git pull
42. What is the iOS App Lifecycle?
Answer:
Typical states:
- Not Running
- Inactive
- Active
- Background
- Suspended
43. What is an IPA File?
Answer:
IPA (iOS App Archive) is the package file used to distribute iOS applications.
44. What is TestFlight?
Answer:
TestFlight is Apple's platform for beta testing iOS applications before App Store release.
45. How do you publish an app to the App Store?
Answer:
- Create Apple Developer Account.
- Archive app in Xcode.
- Upload using Xcode.
- Configure App Store Connect.
- Submit for review.
- Apple reviews the application.
- App becomes available on the App Store after approval.
46. What is an IBOutlet?
Answer:
IBOutlet connects UI components from Storyboard to Swift code.
@IBOutlet weak var nameLabel: UILabel!
47. What is an IBAction?
Answer:
IBAction handles user interactions such as button clicks.
@IBAction func buttonTapped(_ sender: UIButton) {
}
48. What is a Frame and Bounds?
Answer:
- Frame → Position and size in parent view.
- Bounds → Internal coordinate system of the view.
49. What is the difference between synchronous and asynchronous tasks?
- Synchronous
- Executes one task at a time.
- Asynchronous
- Executes tasks without blocking the main thread.
50. Why should network calls not be made on the main thread?
Answer:
Network operations can take time. Running them on the main thread can freeze the UI and create a poor user experience.