iOS Interview Questions and Answers (with Sample Code)
Top 10 most asked interview questions for an iOS Developer role, in a form of a mock interview.
The code from the video: https://github.com/richardtop/ios_interview
Follow Richard on social media:
/ @richardtopchii
https://github.com/richardtop/
https://x.com/richardtop_ios
Follow Daniel on social media:
https://x.com/iDanb0
https://github.com/idanbo
⭐ ️ Links from the video ⭐ ️
View Controller Life Cyhttps://developer.apple.com/documentation/uikit/uiviewcontrollera...
What’s the difference between a struct and a clhttps://docs.swift.org/swift-book/LanguageGuide/ClassesAndStructures.htmlnhttps://github.com/apple/swift/blob/main/stdlib/public/core/Array.swift#L303mhttps://developer.apple.com/swift/blog/?id=10o...
What’s the difference between .frame and .bounds property of a UIVhttps://developer.apple.com/documentation/uikit/uiview/1622621-framea...
What is a Protocol Oriented Programmhttps://developer.apple.com/videos/play/wwdc2015/408/l...
"defer" statement coding questhttps://docs.swift.org/swift-book/ReferenceManual/Statements.htmlf...
MVC architecture (Model, View, Controllhttps://developer.apple.com/library/archive/documentation/General/Conceptual/DevPedia-CocoaCore/MVC.htmlahttps://developer.apple.com/library/archive/documentation/General/Conceptual/CocoaEncyclopedia/Model-View-Controller/Model-a... View-Controller.html#//apple_ref/doc/uid/TP40010810-Chttps://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.htmla...
"weak" and "unowned" keywohttps://kelvas09.github.io/blog/posts/ios_weak_unowned/shttps://developer.apple.com/documentation/foundation/urlsessiona...
"lazy" keywhttps://stackoverflow.com/questions/38141298/lazy-initialisation-and-retain-cycle3...
"@escaping" closure attribue and non-escaping closuhttps://kelvas09.github.io/blog/posts/ios-escaping/s...
❤ ️ Support for this channel comes from our friends at Scrimba – the coding platform that's reinvented interactive learhttps://scrimba.com/freecodecampdecamp
⭐ ️ Contents ⭐ ️
⌨ ️ (0:00:00) Overview
⌨ ️ (0:00:34) Daniel, the interviewer
⌨ ️ (0:02:03) Why these questions?
⌨ ️ (0:02:43) View Controller Life Cycle
⌨ ️ (0:12:08) What’s the difference between a struct and a class
⌨ ️ (0:18:33) What’s the difference between .frame and .bounds property of a UIView
⌨ ️ (0:25:58) What is a Protocol Oriented Programming
⌨ ️ (0:32:16) "defer" statement coding question
⌨ ️ (0:37:13) GCD / DispatchQueue coding question
⌨ ️ (0:46:49) MVC architecture (Model, View, Controller)
⌨ ️ (0:52:32) "weak" and "unowned" keywords
⌨ ️ (0:57:07) "lazy" keyword
⌨ ️ (1:02:05) "@escaping" closure attribue and non-escaping closures
⌨ ️ (1:05:16) Summary and feedback
Corrections:
52:19 The video states that unowned references cannot be optional. However, in practice, unowned references may be either optional or non-optional. For official dhttps://docs.swift.org/swift-book/documentation/the-swift-programming-language/automaticreferencecounting/#Unowned-Optional-Referencestps://docs.swift.org/swift-book/doc...
1:01:52 The explanation in the video may lead viewers to incorrectly infer that non-escaping behavior became the default for closures starting with Swift 5.0. The phrase "as of Swift 5.0, the non-escaping behavior is the default" was used solely to clarify the behavior at the time of the interview recording, rather than to specify the exact point at which this change was introduced.
The video emphasizes the ability to store a closure in a variable as the defining characteristic of an escaping closure. However, the more precise and official definition is: "A closure is said to escape a function when the closure is passed as an argument to the function but is called after the function returns." This definition correctly highlights the API behavior rather than the implementationhttps://docs.swift.org/swift-book/documentation/the-swift-programming-language/closures/tps://docs.swift.org/swift-book/doc...