Swift Developer

  Home  Computer Programming  Swift Developer


“Swift Developer based Frequently Asked Questions in various Swift Developer job interviews by interviewer. These professional questions are here to ensures that you offer a perfect answers posed to you. So get preparation for your new job hunting”



39 Swift Developer Questions And Answers

2⟩ Explain me why do we use swift?

Mention the advantages?

A few of the many advantages of using swift are:

☛ Optional types

☛ Closures

☛ Built-in error handling

☛ Much faster than other languages

☛ Supports pattern matching

☛ Type-safe language

 164 views

4⟩ Tell us your preference when writing UI's? Xib files, Storyboards or programmatic UIView?

There's no right or wrong answer to this, but it's great way of seeing if you understand the benefits and challenges with each approach. Here's the common answers I hear:

☛ Storyboard's and Xib's are great for quickly producing UI's that match a design spec. They are also really easy for product managers to visually see how far along a screen is.

☛ Storyboard's are also great at representing a flow through an application and allowing a high-level visualization of an entire application.

☛ Storyboard's drawbacks are that in a team environment they are difficult to work on collaboratively because they're a single file and merge's become difficult to manage.

☛ Storyboards and Xib files can also suffer from duplication and become difficult to update. For example if all button's need to look identical and suddenly need a color change, then it can be a long/difficult process to do this across storyboards and xibs.

☛ Programmatically constructing UIView's can be verbose and tedious, but it can allow for greater control and also easier separation and sharing of code. They can also be more easily unit tested.

Most developers will propose a combination of all 3 where it makes sense to share code, then re-usable UIViews or Xib files.

 183 views

5⟩ Explain me what Is The Significance Of “?” In Swift?

The question mark (?) is used during the declaration of a property. If the property does not hold a value, the question mark (?) helps to avoiding application errors.

Example looks like -

class Employee {

var certificate : [Certificates]?

}

let employee = Employee();

Example 2 -

let middleName : String? = nil

let lastName : String = "Muhammad"

let name : String = middleName ?? lastName

 171 views

7⟩ What is the Adapter and Memento Pattern?

Adapter – It lets the classes with incompatible interfaces to work together and it wraps itself around the object to expose a standard interface to interact with that object.

Memento – This pattern in iOS is used as a part of state restoration.

That is this externalized state can be restored without violating any encapsulation.This pattern is especially used for the archiving in Apple.

 184 views

10⟩ Tell me what are the important data types found in Objective-C?

There are four data types that the developers mostly use in Objective – C.

☛ BOOL – It represents a Boolean value that is true or false.

☛ NSInteger – It represents an Integer.

☛ NSString – It represents a string.

☛ Cgfloat – It represents a floating-point value.

 186 views

11⟩ Tell us what Is The Difference Between Swift And Objective-c Language?

Swift Programming-

☛ In a swift programming, the variables and constants are declared before use.

☛ In a swift programming, “var” keyword used for variable and “let” keyword for constant.

☛ In a swift programming, no need to end code with semi-colon

☛ In a swift programming, does not require creating a separate interface like Objective-C.

☛ In a swift programming, we can define methods in class, structure or enumeration.

Objective-C Programming-

☛ In objective-C programming, we need to end code with semi-colon

☛ In objective-C programming, we can declare constant as int and variable as NSString.

 182 views

12⟩ Do you know how Multiple Line Comment Can Be Written In Swift?

The Nested multiline comments enable you to comment out large blocks of code quickly and easily.

Use an opening (/*: ) and closing ( */) comment and it looks like -

/*:

The above forward slash (/) and an asterisk (*) then a colon (:) is opening comment - (/*:)

The below an asterisk (*) and forward slash is closing comment – (*))

*/

 188 views

14⟩ Do you know the Adapter And Memento Pattern?

Adapter – It lets the classes with incompatible interfaces to work together and it wraps itself around the object to expose a standard interface to interact with that object.

Memento – This pattern in iOS is used as a part of state restoration.

That is this externalized state can be restored without violating any encapsulation.This pattern is especially used for the archiving in Apple.

 184 views

15⟩ Explain me some Common Execution States In Ios?

The states of the common execution can be as follows:

Not running – This state means that there is no code that is being executed and the application is completely switched off.

Inactive – This state means that the application is running in the background and is not receiving any events.

Active – This state means that the applications are running in the background and is receiving the events.

Background – This state means that the application is executing the code in the background.

Suspended – This state means that the application is in the background and is not executing.

 191 views

16⟩ Tell us what Are B-Trees?

B-trees are search trees that provide an ordered key-value store with excellent performance characteristics. In principle, each node maintains a sorted array of its own elements, and another array for its children.

 191 views

17⟩ Do you know the difference between copy and retain?

Retaining an object means the retain count increases by one. This means the instance of the object will be kept in memory until it’s retain count drops to zero. The property will store a reference to this instance and will share the same instance with anyone else who retained it too. Copy means the object will be cloned with duplicate values. It is not shared with any one else.

 198 views

18⟩ Tell us the difference between not-running, inactive, active, background and suspended execution states?

☛ Not running: The app has not been launched or was running but was terminated by the system.

☛ Inactive: The app is running in the foreground but is currently not receiving events. (It may be executing other code though.) An app usually stays in this state only briefly as it transitions to a different state.

☛ Active: The app is running in the foreground and is receiving events. This is the normal mode for foreground apps.

☛ Background: The app is in the background and executing code. Most apps enter this state briefly on their way to being suspended. However, an app that requests extra execution time may remain in this state for a period of time. In addition, an app being launched directly into the background enters this state instead of the inactive state.

☛ Suspended: The app is in the background but is not executing code. The system moves apps to this state automatically and does not notify them before doing so. While suspended, an app remains in memory but does not execute any code. When a low-memory condition occurs, the system may purge suspended apps without notice to make more space for the foreground app.

 185 views

19⟩ Tell me what is Enum?

Basically, it is a type that contains a group of various related values under the same umbrella.

 185 views