50 iOS Interview Questions And Answers Part 3
--
Hello, Part 3 is ready! Check out Part 1 and Part 2 if you haven’t already :)
1- Explain Mediator Design Pattern
Mediator object encapsulates the interaction policies in a hidden and unconstraining way. Objects being manipulated by mediator have no idea it exists. It sits quietly behind the scenes and imposes its policies without their permission or knowledge.
If you want to learn more about this pattern, I recommend checking the Mediator Pattern Case Study.
2- What kind of JSONSerialization have ReadingOptions?
- mutableContainers Specifies that arrays and dictionaries are created as variables objects, not constants.
- mutableLeaves Specifies that leaf strings in the JSON object graph are created as instances of variable String.
3- How can you prevent a user from doing said action more than once on their device?
Apple has introduced DeviceCheck in iOS 10. This API allows us to access per-device, per-developer data in an iOS device. The solution is better than UserDefaults or Advertising Identifier. DeviceCheck allows us to store a boolean value.
4- What is DispatchGroup?
DispatchGroup
allows for aggregate synchronization of work. We can use them to submit multiple different work items and track when they all complete, even though they might run on different queues. This behavior can be helpful when progress can’t be made until all of the specified tasks are complete. — Apple’s Documentation
The most basic answer: If we need to wait on a couple of asynchronous or synchronous operations before proceeding, we can use DispatchGroup.
5- What is RGR ( Red — Green — Refactor)?
Red, Green and Refactor are stages of the TDD (Test Driven Development).
- Red: Write a small amount of test code usually no more than seven lines of code and watch it fail.
- Green: Write a small amount of production code. Again, usually no more than seven lines of…