FIRST QUESTION:
Automatic Reference Counting
Keeps track of strong references to an object and when that count gets to zero it will automatically deallocate it from memory for you.
Retain Cycles/Memory Leaks
If you have a retain cycle or two objects have a strong reference to each other its kind of a never=ending loop and that will never get to zero
Trick is to make one of those references a weak reference "weak var"
Apple Automatic Reference Counting Doc:
https://docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html
Follow up questions to memory in closure, weak self unknown self come into play
SECOND QUESTION:
Communication Patterns between views:
Delegates vs Observers and Notifications
Delegates is a one to one communication. Like one view communicating with another view
Observers Notifications you can have one observer and then have ten different areas that notify that observer throughout your code, so it's a one to many communication pattern.
When to use:
Downsides to Observer Notification pattern is you can have 10 to 20 notifications spread out all throughout your code only pointing to one observer. In a bigger code base there can be timing issues and hard to keep track of.
What is the lifecycle overview?
viewdidLoad - gets called the very first time the view is loaded into memory and only gets called once
viewWillAppear - gets called every time the view appears, an example of this is say you're navigation controller a master detail view and you keep going back and forth between those two views, viewDidLoad will not get called but viewWillAppear does. If you need an animation to occur every time you arrive upon page, use viewWillAppear
viewWillLayoutSubviews/viewDidSubLayoutSubviews - these two are where the view is actually laying out all the sub views, the constraints, the sizing, and everything
viewDidAppear- which means the view is completely loaded
End of LifeCycle
viewWillDisappear - you can do stuff right before the view dissapears
viewDidDisappear - to let you know the view is gone
THIRD QUESTION:
What is your favorite Apple framework to work with?
Do you like core location, do you like UIKit, like MapKit and if you do, why you like those API?
FOURTH QUESTION:
Classes vs Structs?
When would you use one versus the other?
Explain that classes are a reference type, that if you change a property on that class you are actually going to change the reference whereas a struct is a value type that essentially creates a copy of that objects are not overwriting other properties
If you subclass, you are inheriting the superclass methods, variables, properties, etc, which is some bloat that you don't necessarily need.
Structs are more lightweight and clean
FIFTH QUESTION:
Filter, map, and reduce on collections
Filter - Filter an array, you want to filter out all the even or odd numbers in an array
Map - is like you want to transform to every object in the array. If you want to multiply an array of numbers by multiplying by 2 to each index
Reduce - summing up the numbers up in an array
SIXTH QUESTION:
Testing - do you have experience with testing?
Learn to build testing suites in projects
SEVENTH QUESTION:
3RD PARTY LIBRARIES:
What experience you have with 3rd party libraries like cocoa pods or Carthage or Swift package manager. So get experience using this, and the pros and cons of using them and knowing how to use them.
At the end of the day, that's what a dependency is, you are depending on somebody's code in your project. So in a language like swift you got to hope the manager of that library is keeping up to date with swift.
CODING EXCERCISES:
1. Gesture recognizers - the tap gesture recognizer, the pane gesture recognizer, the pinch and zoom.
For example: grabbing a file and dragging it to a trash bin, being able to manipulate objects on the screen using a gesture recognizer, look for tutorials that teach how to use gesture recognizers in a UI
2. Networking - Authenticate on a server, they should give all the API information, the endpoints needed, but essentially you will have to build a URL the proper headers with authorization and make sure the body of the request was complete with the username password etc and had to authenticate on the server and return a token. This is very fundamental
3. Merge Sort/ Shuffle an Array
4. Debugging.
They will put code in front of you have to debug it just by looking at it. You have to find the errors yourself. The usual suspects. look for optionals being forced and wrapped inappropriately, look for race conditions in the network calls, look for retained cycles, memory leaks, and look for UI not being updated on the main thread
5. Take a large unit and break it down into small units. Take 100,000 seconds and break that down into days hours minutes seconds. Use the modulu operator
6. Know how to iterate through for loops / while loops
7. Know data structures and algorithms
TAKE HOME PROJECTS!:
1. Create a mini version of their app, networking/building a tableView to building the UI to a design spec, persistence, animation
2. Build a basic login flow but it was a 100 percent programmatic, no storyboards, no nothing for auto layout