IOS Developer
100+ IOS Developer Interview Questions and Answers
Q1. 1 - MVC PATTERN 2- CLOUSERS & it's type 3- Google SDK like Google maps 3- How u manage the constraints of any label , stick at every corner & center of view controller, when getting data from json.
Questions related to iOS development, including MVC pattern, closures, Google SDK, and managing constraints for labels.
MVC pattern is a design pattern used in iOS development to separate the application logic into three components: model, view, and controller.
Closures are self-contained blocks of functionality that can be passed around and used in code. Types include escaping and non-escaping closures.
Google SDKs like Google Maps provide pre-built functionality for developers...read more
Q2. What will be the output of the following Swift code: \n\nstruct s1Struct {\n var abc = "Hello"\n \n func change() {\n abc = "bye"\n }\n}\n\nvar a = s1Struct()\na.change()\nprint(a.abc)
The output will be 'bye'.
The code defines a struct 's1Struct' with a property 'abc' initialized to 'Hello'.
It also has a method 'change()' that changes the value of 'abc' to 'bye'.
An instance 'a' of 's1Struct' is created and its 'change()' method is called.
Finally, the value of 'abc' in the instance 'a' is printed, which will be 'bye'.
IOS Developer Interview Questions and Answers for Freshers
Q3. What is the difference between the Liskov Substitution Principle and the Interface Segregation Principle?
Liskov Substitution Principle focuses on inheritance while Interface Segregation Principle focuses on interfaces.
Liskov Substitution Principle states that objects of a superclass should be replaceable with objects of its subclasses without affecting the program's correctness.
Interface Segregation Principle states that a client should not be forced to implement interfaces they do not use.
Liskov Substitution Principle is related to inheritance hierarchy, while Interface Segrega...read more
Q4. What is the time complexity for finding the longest common prefix in a given array of strings? (to be done in playground)
The time complexity for finding the longest common prefix in an array of strings is O(n*m), where n is the number of strings and m is the length of the longest string.
Iterate through the characters of the first string and compare them with the corresponding characters of the other strings.
The worst-case scenario is when all strings have the same prefix, resulting in O(n*m) time complexity.
Example: For strings ['apple', 'app', 'apricot'], the longest common prefix is 'ap'.
Q5. What’s difference between class and structure
Classes and structures are both used to define custom data types, but they have some key differences.
Classes are reference types, while structures are value types.
Classes support inheritance, while structures do not.
Classes have deinitializers, while structures do not.
Classes have reference counting for memory management, while structures do not.
Classes can have optional property types, while structures cannot.
Q6. What is optional, difference between struct and class?
Optional is a type in Swift that can hold a value or be nil. Struct and class are both used to define custom data types.
Optional is denoted by a question mark (?) and is used to handle nil values.
Structs are value types and are passed by value, while classes are reference types and are passed by reference.
Structs have a default memberwise initializer, while classes do not.
Classes can inherit from other classes, while structs cannot.
Examples of optional usage include declaring...read more
Share interview questions and help millions of jobseekers 🌟
Q7. How to upload/download files or fetch requests for API?
To upload/download files or fetch requests for API in iOS, you can use URLSession and its related classes.
Use URLSession to create a URLSessionDataTask for making API requests.
For file upload, use URLSessionUploadTask and provide the file URL.
For file download, use URLSessionDownloadTask and specify the destination URL.
Handle the response and errors using completion handlers.
Example: URLSession.shared.dataTask(with: url) { (data, response, error) in ... }
Q8. What are the benefits of using Structs over Classes in SwiftUI?
Structs are value types, leading to better performance and memory management in SwiftUI.
Structs are value types, meaning they are copied when passed around, leading to better performance compared to reference types like classes.
Structs are immutable by default, making it easier to reason about the state of your app and preventing unexpected changes.
Structs are more lightweight than classes, which can lead to better memory management in SwiftUI applications.
Structs are preferr...read more
IOS Developer Jobs
Q9. What is the difference between frame and bounds?
The frame represents the view's position and size in its superview's coordinate system, while the bounds represents the view's position and size in its own coordinate system.
Frame is relative to the superview, bounds is relative to the view itself
Frame includes any transformations applied to the view, bounds does not
Frame's origin is the top-left corner of the view, bounds' origin is always (0,0)
Q10. How to integrate Push Notification in IOS?
To integrate Push Notification in iOS, you need to register for remote notifications, handle the registration token, and implement the necessary delegate methods.
Register for remote notifications using the UIApplication.shared.registerForRemoteNotifications() method.
Implement the AppDelegate's didRegisterForRemoteNotificationsWithDeviceToken method to handle the registration token.
Implement the AppDelegate's didReceiveRemoteNotification method to handle incoming notifications...read more
Q11. What is the difference between swift & objective c?
Swift is a modern programming language while Objective-C is an older language used for iOS development.
Swift is easier to read and write than Objective-C.
Swift is faster than Objective-C.
Objective-C is still used in legacy codebases.
Swift has a simpler syntax and is more concise.
Swift has better memory management than Objective-C.
Q12. What’s retain cycle how you can avoid
Retain cycle is a memory management issue where objects reference each other and cannot be released. It can be avoided by using weak or unowned references.
Retain cycle occurs when two or more objects hold strong references to each other.
To avoid retain cycle, use weak or unowned references instead of strong references.
Weak references do not increase the reference count of an object and automatically become nil when the object is deallocated.
Unowned references are similar to w...read more
Q13. What is closure? Life cycle of escaping closure?
A closure is a self-contained block of code that can be passed around and used in your code. An escaping closure is a closure that is called after the function it was passed to has returned.
Closure is a block of code that can be passed around and used in your code.
Escaping closure is called after the function it was passed to has returned.
Example: Using a completion handler in a network request to handle the response after the request has finished.
Q14. What are the SOLID principles in software development?
SOLID principles are a set of five design principles in object-oriented programming to make software more maintainable, flexible, and scalable.
Single Responsibility Principle (SRP) - A class should have only one reason to change.
Open/Closed Principle (OCP) - Software entities should be open for extension but closed for modification.
Liskov Substitution Principle (LSP) - Objects of a superclass should be replaceable with objects of its subclasses without affecting the functiona...read more
Q15. What is Automatic Reference Counting, and how does it work?
Automatic Reference Counting (ARC) is a memory management feature in iOS development that automatically manages memory by keeping track of references to objects.
ARC automatically adds and removes retain/release calls to manage memory for objects.
It helps prevent memory leaks by deallocating objects when they are no longer needed.
ARC is the default memory management model in Swift and Objective-C.
Example: var myObject = MyObject() // ARC automatically retains myObject
Example: ...read more
Q16. What's the difference between reference types and value types?
Reference types store a reference to the actual data in memory, while value types store the actual data directly.
Reference types are stored on the heap and passed by reference, while value types are stored on the stack and passed by value.
Changing the value of a reference type will affect all references to that object, while changing the value of a value type will not affect other instances.
Examples of reference types in iOS development include classes, while examples of valu...read more
Q17. what is the bridge between swiftui and uikit
The bridge between SwiftUI and UIKit is represented by the UIViewRepresentable and UIViewControllerRepresentable protocols.
UIViewRepresentable and UIViewControllerRepresentable protocols allow SwiftUI views to interact with UIKit views and controllers respectively.
UIViewRepresentable is used to wrap a UIKit view and make it available to SwiftUI.
UIViewControllerRepresentable is used to wrap a UIKit view controller and make it available to SwiftUI.
These protocols enable develop...read more
Q18. How to create a perticular mobile screen
To create a particular mobile screen, you need to design the layout using Interface Builder or programmatically in Swift.
Design the UI layout using Interface Builder in Xcode
Add necessary UI elements like labels, buttons, text fields, etc.
Customize the appearance using constraints, auto layout, and size classes
Implement functionality using Swift code to handle user interactions and data processing
Q19. what are Access Controls/modifiers? public vs open?
Access controls/modifiers determine the visibility and accessibility of classes, methods, and properties in object-oriented programming.
public access control allows a class, method, or property to be accessed from anywhere in the code
open access control allows a class to be subclassed outside of the module where it is defined
public is commonly used in Swift for most cases, while open is used when you want to allow subclassing from external modules
Q20. What is retain , weak, strong, atomic etc in Objective C
Retain, weak, strong, atomic are property attributes in Objective-C for memory management and thread safety.
Retain: Increases the reference count of an object.
Weak: Does not increase the reference count, used to avoid retain cycles.
Strong: Increases the reference count and keeps the object in memory until all references are removed.
Atomic: Guarantees that the value is always fully retrieved or set in a multi-threaded environment.
Q21. What is the difference between MVC and MVP?
MVC focuses on separation of concerns, while MVP focuses on the interaction between components.
MVC stands for Model-View-Controller, where the controller handles user input, the model manages the data, and the view displays the data.
MVP stands for Model-View-Presenter, where the presenter acts as an intermediary between the model and the view, handling user input and updating the view.
In MVC, the view has direct access to the model, while in MVP, the presenter mediates the co...read more
Q22. What is the race condition and data race?
Race condition occurs when multiple threads access shared data and try to change it at the same time. Data race is a type of race condition where two or more threads access shared data and at least one of them modifies it.
Race condition occurs when multiple threads access shared data and try to change it at the same time.
Data race is a type of race condition where two or more threads access shared data and at least one of them modifies it.
Race conditions can lead to unpredict...read more
Q23. What types of property wrappers do you know?
Property wrappers in Swift are used to add extra functionality to properties.
Some types of property wrappers include @State, @Binding, @ObservedObject, @EnvironmentObject, @Published, @FetchRequest, @NSManaged, etc.
Property wrappers help in managing the state of UI components, data flow, and data persistence in iOS apps.
They provide a convenient way to encapsulate common behavior and logic for properties.
Q24. How you use GIT, How to manage conflicts?
I use GIT for version control and manage conflicts by resolving them through communication and collaboration.
Regularly commit changes to keep track of progress
Pull latest changes before making any updates to avoid conflicts
Communicate with team members to resolve conflicts efficiently
Use tools like Git merge or Git rebase to resolve conflicts
Document resolution process for future reference
Q25. Difference between GCD and operation Queues
GCD and Operation Queues are both used for concurrent programming in iOS, but differ in their approach.
GCD is a C-based API that uses a thread pool model for concurrency.
Operation Queues are built on top of GCD and provide a higher-level abstraction for concurrency.
GCD is best for simple, lightweight tasks, while Operation Queues are better for more complex tasks with dependencies.
GCD uses blocks for task execution, while Operation Queues use Operation objects.
GCD has a lower...read more
Q26. Explain the Life cycle of iOS applications
The life cycle of iOS applications refers to the stages an app goes through from launch to termination.
The app is launched by the user or system
The app enters the foreground and becomes active
The app can be sent to the background or suspended
The app can be terminated by the user or system
The app can be resumed from the background or suspended state
The app can receive memory warnings and handle them appropriately
Q27. Explain the life cycle of UIviewController
The UIViewController life cycle consists of several stages that occur when the view controller is loaded and unloaded.
viewDidLoad() - called when the view controller's view is loaded into memory
viewWillAppear() - called just before the view appears on the screen
viewDidAppear() - called just after the view appears on the screen
viewWillDisappear() - called just before the view disappears from the screen
viewDidDisappear() - called just after the view disappears from the screen
de...read more
Q28. 1.Difference between class and struct?
Classes are reference types while structs are value types.
Classes are passed by reference while structs are passed by value.
Classes support inheritance while structs do not.
Classes have a default initializer while structs do not.
Classes can be deinitialized while structs cannot.
Examples of classes include UIView and UIViewController while examples of structs include CGRect and CGPoint.
Q29. What are delegates, notification center in iOS?
Delegates and notification center are key components in iOS development for communication between objects and broadcasting events.
Delegates are used for one-to-one communication between objects, allowing one object to act on behalf of another.
Notification center is used for broadcasting events to multiple objects, allowing for loosely coupled communication.
Delegates are commonly used in UITableView and UICollectionView to handle data and user interactions.
Notification center ...read more
Q30. two sums from leetcode, NSOperation vs GCD, View life cycle, tuple
The interview question covers topics like solving two sum problems, NSOperation vs GCD, view life cycle, and tuples.
Two sum problems involve finding two numbers in an array that add up to a specific target. Example: [2, 7, 11, 15], target = 9
NSOperation and GCD are both used for concurrent programming in iOS. NSOperation provides more control and features, while GCD is lower level and more lightweight.
View life cycle in iOS involves methods like viewDidLoad, viewWillAppear, v...read more
Q31. Linked list sum in reverse order (Leetcode #2. Add two numbers)
Add two numbers represented by linked lists in reverse order.
Traverse both linked lists simultaneously, adding corresponding nodes and carrying over the sum if necessary.
Handle cases where one linked list is longer than the other.
Create a dummy head node to simplify the code.
Consider edge cases like carry over at the end of the addition.
Q32. What is a retain cycle in programming?
A retain cycle in programming occurs when two objects hold a strong reference to each other, preventing them from being deallocated.
Retain cycles can lead to memory leaks in iOS development.
To break a retain cycle, one of the objects involved needs to have a weak reference to the other.
An example of a retain cycle is when a parent object holds a strong reference to a child object, and the child object holds a strong reference back to the parent.
Q33. What are the types of access controls in iOS
Types of access controls in iOS include public, internal, private, and fileprivate.
Public: Accessible from anywhere, both within the module and outside.
Internal: Accessible from anywhere within the module.
Private: Accessible only within the defining type.
Fileprivate: Accessible only within the same file.
Q34. How can you create dynamic UI like amazon?
Dynamic UI like Amazon can be created using a combination of responsive design, data-driven content, and user personalization.
Utilize responsive design principles to ensure the UI adapts to different screen sizes and devices.
Implement data-driven content to display relevant information based on user preferences and behavior.
Use user personalization techniques such as recommendations, personalized product suggestions, and targeted promotions.
Incorporate interactive elements li...read more
Q35. New features added in Swift5 comparing Swift 4?
Swift 5 introduced ABI stability, improved performance, and new language features.
ABI stability ensures compatibility between future Swift versions
Improved performance with faster build times and reduced app size
New language features include Result type, Raw strings, and Property wrappers
Q36. Do sorting without higher order functions, Remote notifications
Sorting without higher order functions and remote notifications
Implement sorting algorithm like bubble sort, selection sort, or insertion sort without using built-in sort functions
For remote notifications, use Apple Push Notification Service (APNs) to send notifications to users' devices
Q37. How ARC mechanism works in Swift?
ARC (Automatic Reference Counting) is a memory management mechanism in Swift that automatically manages memory by keeping track of references to objects.
ARC automatically deallocates objects when they are no longer referenced
Retain cycles can occur if two objects hold strong references to each other
Weak and unowned references are used to prevent retain cycles
Q38. What frameworks do you use in projects?
I primarily use UIKit and SwiftUI frameworks for iOS development projects.
Primary frameworks: UIKit, SwiftUI
Additional frameworks: Core Data, Core Animation
Examples: UIKit for building user interfaces, SwiftUI for declarative UI design
Q39. Write code to get distinct members in array with same sequence
Use a Set to get distinct members in array while maintaining sequence.
Iterate through the array and add each element to a Set to automatically remove duplicates.
Create a new array by iterating through the Set to maintain the original sequence.
Q40. make api flow and create with help of design pattern for ui and ux testing
The answer to the question is provided below.
To create an API flow, start by identifying the endpoints and their functionalities.
Design the UI and UX testing by using appropriate design patterns like MVC or MVVM.
Implement the API calls and handle the responses using networking libraries like Alamofire.
Use XCTest or UI Testing frameworks for automated UI and UX testing.
Mock the API responses for testing purposes using tools like OHHTTPStubs or Swifter.
Ensure proper error handl...read more
Q41. What is difference between class and struct?
Classes are reference types, while structs are value types in Swift.
Classes are reference types, meaning they are passed by reference, while structs are value types, passed by value.
Classes support inheritance, while structs do not.
Classes have deinitializers, while structs do not.
Classes can have reference counting for memory management, while structs do not.
Example: class Person {} vs struct Point {}
Q42. What are types of memory management in iOS
Types of memory management in iOS include Automatic Reference Counting (ARC) and Manual Reference Counting (MRC).
Automatic Reference Counting (ARC) - manages memory automatically by keeping track of object references.
Manual Reference Counting (MRC) - requires developers to manually manage memory by retaining and releasing objects.
ARC is the default memory management system in iOS, while MRC is used in older codebases or when developers need more control over memory management...read more
Q43. What is ARC in Swift?
ARC stands for Automatic Reference Counting. It is a memory management system used in Swift to automatically manage memory allocation and deallocation.
ARC automatically tracks and manages the memory used by objects in Swift.
It keeps track of how many references to an object exist and deallocates the object when there are no more references to it.
ARC eliminates the need for manual memory management, reducing the risk of memory leaks and crashes.
Developers don't need to explici...read more
Q44. What’s opinion binding
Opinion binding is a legal doctrine that requires judges to follow the decisions of higher courts in similar cases.
Opinion binding is also known as stare decisis.
It helps to ensure consistency and predictability in the legal system.
For example, if a higher court has already ruled that a certain law is unconstitutional, lower courts must follow that ruling in similar cases.
Opinion binding can be controversial, as it can prevent judges from correcting past mistakes or adapting ...read more
Q45. What's the difference between Class and Struct
Classes are reference types, while structs are value types in Swift.
Classes are reference types, meaning they are passed by reference, while structs are value types, passed by value.
Classes support inheritance, while structs do not.
Classes have deinitializers, while structs do not.
Classes can have reference counting for memory management, while structs do not.
Example: Class - Person, Struct - Point
Q46. What is the app life cycle in iOS?
The app life cycle in iOS refers to the sequence of events that occur from the time an app is launched to when it is terminated.
The app is launched by the user or system.
The app enters the foreground and becomes active.
The app can enter the background when the user switches to another app or the device locks.
The app can be terminated by the user or system.
The app can also be suspended, where it remains in memory but does not execute code.
Examples: launching an app, switching ...read more
Q47. What is multi threading?
Multi threading is the ability of a CPU to execute multiple threads concurrently, allowing for improved performance and responsiveness in applications.
Allows for parallel execution of tasks, improving performance
Enables applications to remain responsive while performing intensive tasks
Can lead to synchronization issues if not managed properly
Q48. How to identify memory leaks in the entire project
Use Instruments tool to identify memory leaks in iOS projects
Use Instruments tool provided by Xcode to run the app and analyze memory usage
Look for memory leaks in the Allocations and Leaks instruments
Check for any objects that are not being deallocated properly, causing memory leaks
Q49. what is mvvm architecture in ios
MVVM is a design pattern that separates UI code from business logic and data models.
MVVM stands for Model-View-ViewModel
Model represents the data and business logic
View displays the UI and user interactions
ViewModel acts as a mediator between Model and View
ViewModel exposes data and commands to View
MVVM helps in testability, maintainability and scalability of code
Q50. Steps in adding collection view in Swift.
Steps to add collection view in Swift.
Create a UICollectionView instance
Set the delegate and data source of the collection view
Implement the required methods of UICollectionViewDataSource and UICollectionViewDelegate protocols
Register the cell class or nib file for the collection view
Return the number of items and configure the cell in the data source methods
Implement any additional delegate methods as needed
Interview Questions of Similar Designations
Top Interview Questions for IOS Developer Related Skills
Interview experiences of popular companies
Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary
Reviews
Interviews
Salaries
Users/Month