Odgovori: Asynchronous Means That Completes A Task in The Background and Can

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Odgovori

4. In ‘Details’ we have a property called ‘delegate’. And we are assigning


delegate to ‘self’. So the self is pointing back to the VC, which creates a
cycle and leads to a memory leak.

5. Synchronous means that the thread that initiated that operation will wait
for the task to finish before continuing.
Asynchronous means that Completes a task in the background and can
notify you when complete, which means it will not wait. In task network
request is an asynchronous process.

6. An escaping closure is a closure that’s called after the function it was


passed to returns. In other words, it outlives the function it was passed to.
A non-escaping closure is a closure that’s called within the function it was
passed into, i.e. before it returns. This closure never passes the bounds of
the function it was passed into.

8. MVVM stands for Model, View, ViewModel, a specific architecture


pattern where the ViewModel stands between View and Model providing
interfaces to imitate UI component. Makes code easier to understand,
maintain and troubleshoot.

View Controller: It only performs things related to UI Show/get information.


Part of the view layer. In this project folder named Screens

View Model: It receives information from VC, handles all this information,
and sends it back to VC. In this project folder named ‘View Model’

Model: This is only your model, in this project folder named ‘Models’.It is
used by VM and updates whenever VM sends new updates.

10. Returns a reusable table-view cell object after locating it by its


identifier.

11. It's called a pull request because you're asking the project to pull
changes from your fork.
12. An optional value allows us to write clean code with at the same time
taking care of possible nil values.

The simplest way to unwrap an optional is to add a ! after the optional


name. This is called "force unwrapping". It returns the value inside the
optional (as the original type) but if the optional is nil, it causes a runtime
crash. Before unwrapping you should be sure there's a value, or we can put
a ‘default’ or alternative value.

13. We use the guard statement in Swift to return a function when a


condition isn't satisfied. It's similar to an if statement.

15. Frame - a view's location and size using the parent view's coordinate
system. Bounds - a view's location and size using its own coordinate
system.

16. The completion block should be used to notify interested objects that
the work is complete or perform other tasks that might be related to, but not
part of, the operation's actual task.
A finished operation may finish either because it was canceled or because
it successfully completed its task.

17. When we use a UITableView and UICollectionView, you have to set a


data source and delegate to provide the data to display and handle events,
like row selection.
When you scroll down, instead of instantiating new ones, they are reusing
the already existing ones using dequeueReusableCellWithIdentifier.

18. The key difference between a strong and a weak or unowned


reference is that a strong reference prevents the class instance it points to
from being deallocated.

19. Swift uses Automatic Reference Counting (ARC) to track and


manage your app's memory usage. ARC automatically frees up the
memory used by class instances when those instances are no longer
needed.

20. NSObject is the root class of all ordinary Objective C inheritance


hierarchies; it's the one class that has no superclass. It's through NSObject
that instances of all classes obtain their ability to behave as objects.

You might also like