Curated iOS Interview Questions Series — Part 3
Series aiming to cover as many Q&A’s as possible from iOS interview perspective.
Q 35. Is there any difference between nil and .none
Output : are same
Q36. What is the output in Playground?
Output : Welcome to Mars
The capture list creates a copy of thing
when you declare the closure and does not change afterwards.
Q37. What is the output in Playground?
Output : Welcome to Earth
As the compiler would use reference, thus would use the last updated value from thing.
Q38. Recursive enumeration in Swift?
If any case in the enum contains one or more associated value as another instance of the same enum itself then it is recursive enumeration.
use indirect keyword for the same.
Q39. Can enum have stored properties and methods?
Stored Property — No
method — Yes
Q40. opaque return type in Swift?
A function or method with an opaque return type hides its return value’s type information. Instead of providing a concrete type as the function’s return type, the return value is described in terms of the protocols it supports.
Q41. What is output ?
Answer : 5, Optional(25)
Q42. What is Output?
Output : Compilation Error, Can not assign a property: ‘name’ is get only property
Follow me Rahul Goel for further updates.