Swift Developer Question:

Download Job Interview Questions and Answers PDF

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

Swift Developer Interview Question
Swift Developer Interview Question

Answer:

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

Download Swift Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Tell me what do you do when you realize that your App is prone to crashing?Tell us your preference when writing UI's? Xib files, Storyboards or programmatic UIView?