This article is meant to be a guide. Target is to evolve it to a exhaustive list of swift questions and answers with your support. Given below are few of the most common questions asked in swift interview straight from swift docs, which according to me is a must read for any one trying to develop some skills in swift.Questions are added on last page.
Important swift questions you should know
Question 1. How to declare constant in swift?
Answer: Constant are declared using let keyword and once set, attempting to change a constant value results in compile time error
let welcome = "Welcome Buddy!!!"
Question 2. Can we use Swift reserve keywords as variable or constant name? How?
Answer 2. Yes we can, we need to surround the reserve keyword in “`” (backticks)
var `protocol`:String = "Protocol is reserved"
Question 3. What are Type Aliases ? Why they are used?
Answer 3. Type Aliases are used to give alternative name for an existing type.They come in handy when we want to give a existing type a name which is more clear in applications context.
typealias PriorityLevel = UInt16 let a = PriorityLevel.min // which is same as UInt16.min