This course is available as part of the Professional subscription. To learn more click here

Reusable iOS Frameworks


May 26 2020 · Video Course (2 hrs, 6 mins) · Intermediate

If you have found yourself writing the same code over and over again for multiple different apps, then this is the course for you. Learn about the different ways to store your reusable code for a Swift project, how to write methods and functions in a reusable way, and how to think about your end user as a developer rather than a user by focusing on API design principles and access control.

4.9/5 10 Ratings


  • Swift 5.2, iOS 13.4, Xcode 11.4

Introduce Your User

This episode will present the main issue of the course: you have three apps to write and you'll need code to use across all of them. How do you solve this?


Learn about the difference between static and dynamic libraries, and how Swift Packages provide an elegant solution.


Create a git repository and set up Xcode to develop your reusable framework.


Consider Your User

Write a unit test, then write your first reusable API and learn about what goes into it.


Understand how semantic versioning works and how to define and uphold an API contract to prospective developers.


Push your API to your git repository, and test it in a sample project, only to discover a fatal flaw.


Dive into the world of access control while considering a different methodology entirely.


Start thinking about how accessible and open your API is, and consider Murphy's and Hyrum's Law.


Rewrite your first API thinking about how open it truly is, and reuse your own code.


Tag another interation of your framework, and think about changes to the semantic version of your framework.


Empower Your User

Add encapsulation and namespacing to your framework to ensure that APIs never cross wires.


Get RESTful


Build the beginning of your networking APIs, and come to the realization that you'll need to do some special testing.


Learn how to make your code more testable and resilient to multiple situations.


Learn how to inject a simulated mock network into your API tests.


Update your API's interface to handle this new methodology and make your tests pass while maintaining a developer-friendly interface.


Understand how generics help diversify your APIs to handle multiple scenarios.


Add a unit test to design your final API with a generic signature to handle a multitude of use cases.


Write code to make your final unit test pass with a generic function signature and a solid interface for other developers to use.


Integrating Your User

Add support for two other popular dependency managers without cutting off support for Swift Package Manager.


Think about some parting thoughts, and take your framework beyond what you've learned.


Who is this for?

Swift developers who have written code for more than one project, and want to set themselves up for success as they continue working on multiple different products.

Covered concepts

  • Setting up a Framework in Xcode
  • Setting up a Package with Swift Package Manager
  • Access control in Swift
  • Generics
  • API-driven design
  • Test-driven development
  • Dependency Injection