50 iOS Interview Questions And Answers Part 3
Updated on Jan, 2024
Hello, Part 3 is ready! Check out Part 1 and Part 2 if you haven’t already :)
1- Explain the Mediator Design Pattern
The mediator object encapsulates the interaction policies in a hidden and unconstraining way. Objects being manipulated by mediators 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- Please explain “Arrange-Act-Assert”
AAA is a pattern for arranging and formatting code in Unit Tests. If we were to write XCTests each of our tests would group these functional sections, separated by blank lines:
- Arrange (Given) all necessary preconditions and inputs.
- Act (When) on the object or method under test.
- Assert (Then) that the expected results have occurred.
3- What is the benefit of writing tests in iOS apps?
- Writing tests first gives us a clear perspective on the API design, by getting into the mindset of being a client of the API before it exists.
- Good tests serve as great documentation of…