SOLID in Real-World iOS Apps
Get an overview of the SOLID code craft guidelines, how they apply to Swift code, and how you can refactor your current code towards them. By Alex Curran.
Who is this for?
iOS developers looking to understand how code craft can be applied to everyday work. This course expects you to be familiar with mid-to-advanced level Swift development.
Covered concepts
- SOLID aspects
- How to write adhering to those aspects
- How to refactor code current code to better fit SOLID guidelines
Part 1: Understanding SOLID
After an introduction to SOLID and the Single Responsibility Principle, learn how to refactor common iOS methods to move towards singly-responsible code.
Understand and use the Open/Closed Principle and learn how structs can make code that is more extensible and open.
Find out what Liskov's Substitution is and how to build protocols which conform to it. Then understand the Circle-as-an-Ellipse problem, basic violations of the principle and how to avoid them.
Learn why Interface Segregation is a useful way to avoid code creep, what a role interface is and how to find them in your code and identifying role interfaces in iOS APIs.
Understand the difference between Dependency Inversion and Injection. Learn to build a data loader with inverted dependencies and use interfaces to abstract API-specific behavior.
Part 2: Refactoring towards SOLID
Refactor multiple responsibilities out of a large class and how to slowly move responsibilities without breaking large chunks of code.
Learn how to refactor a closed system and what disadvantages it brings, then understand the benefits of opening up a closed system.
Identify roles and splitting out smaller protocols from a large one and how to keep minimize breaking changes using interface extensions.
Learn how to test code with inverted dependencies, build mocks by hand and compare the testability of SOLID-ly built code with other code.