The Fundamentals Flashcards
what is let and var in Swift?
let is used to declare constant and var is used to declare variable
What is the difference between structs and classes?
Classes reference type. Structs are value types.
How is memory management handled in iOS?
Swift uses automatic reference counting (ARC). ARC keeps track of strong references to instances of classes and increases or decreases their reference counting on assign and unassign.
What is protocol in Swift?
Declarations of what a type that adopts them should implement. @objc - class only
What is an extension and when is it used?
A way to extend the existing functionality of a class or type. drawback - globally applied be aware of - name conflicts
What are closures/blocks?
Declare and capture a piece of executable code that will be launched at a later time
What are the components of MVC for a typical iOS app?
- UIView are the views
- UIViewControllers are the Controllers
- any data objects, NSManagedObject subclasses are models
What are Singletons?
A class that returns only one-and-the-same instance no matter how many times you request it
What are 2 major disadvantages to using singletons?
- global state and object lifecycle
2. dependency injection
What is Delegate pattern?
A variation of the Observer pattern where only one object can observe events coming from another object