Latest Post

SwiftUI interview questions and answer How to display SwiftUI sheet Half screen SwiftUI CollectionView using Vgrid

1. What is difference between override and overload?

overloading : When two or more method in the same class have same name but different parameter its called overloading
override : when the method (name and parameter) are the same in the super class  and the child class. its called  override

2.What are the design pattern used in swift? 

3: How could we get device token ?

Ans: There are two steps to get device token. First, we must show the user’s permission screen, after we can register for remote notifications. If these steps go well, the system will provide device token. If we uninstall or reinstall the app, the device token would change.

4:  What format code is used to print a formatted message with NSString?

Ans: You would use the following:

NSLog(@”Message == %@”,msg);

6 What is a protocol, how do you define your own, and when is it used?

Ans: Protocols are a way to specify a set of methods you want a class to implement if it wants to work with one of your classes. Delegates and data sources such as UITableViewDelegate and UITableViewDataSource are indeed protocols.

7: What is your process for tracing and fixing a memory leak?

Ans: The best approach to this question is to provide the candidate with an existing project and a known memory leak and ask him/her to debug it.

8: What are “strong” and “weak” references? Why are they important,and how can they be used to help control memory management and avoid memory leaks?

Ans: A strong reference is one that occurs by default anytime that a variable is being created. There is an important property with reciprocal strong references, and it is that when this happens, a retain cycle occurs. In this situation, ARC will never be able to destroy the objects. This is described as being a memory leak.

These types of reciprocal and strong references should always be avoided. When this is not possible, using weak references can come to the rescue. If one of these references is declared as weak, the retain cycle will be broken, and, therefore, the memory leak will be avoided.

9: What is NSUserDefaults?

Ans: NSUserDefaults is a class that allows a developer to save settings, properties, and information that is related to the application or the user data. NSUserDefaults stores keys and their associated value. The following types can be stored with NSUserDefaults:

  1. NSData
  2. NSString
  3. NSNumber
  4. NSDate
  5. NSArray
  6. NSDictionary

In general, the candidate should be prompted to discuss the benefits and disadvantages of using NSUserDefaults as opposed to other storage types.

`10 What is Auto Layout?

Ans: Auto Layout is a means by which developers can create user interfaces, by defining relationships between elements. It provides a flexible and powerful system that describes how views and the UI controls relate to each other. By using Auto Layout, you can get an incredible degree of control over layout, with a wide range of customization, and yield the perfect interface.

 `11What design patterns are commonly used in iOS apps?

Ans: Typical commonly used patterns when building iOS applications are those that Apple advocates for in their Cocoa, Cocoa Touch, Objective-C, and Swift documentation. These are the patterns that every iOS developer learns. They include MVC, Singleton, Delegate, and Observer.


12.Does singleton  allows multiple instance? 

No singleton does not allow multiple instance

13. What is Completion Handler?

14. What are properties and types of properties?

Properties are the object which are associated with Struct, classes and enums

There are two types of properties

  • Stored Properties
  • Computed Properties

Stored Properties are the variable which are stored at the instant of class or Struct

struct classStrength {

    var girls: Int

    let boys: Int


var totol = classStrength(girls: 0, boys: 3)

Computer Properties are the variable which performs the getter and setter functionality

struct classStrength {

    var girls: Int

    let boys: Int

    var total:Int {

        get {

            return boys + girls


        set(total) {

             boys + girls




var totol = classStrength(girls: 0, boys: 3)

15. What is Dependency injection ?

Dependency Injection is the software design pattern in which object receives other instance that it depends on.