Reusable iOS Frameworks

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. By David Okun.

4.6 (14) · 1 Review

Save for later
Comments
Share

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

Part 1: Introduce Your User

01
Toggle description

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?

Toggle description

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

Toggle description

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

Part 2: Consider Your User

Toggle description

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

Toggle description

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

Toggle description

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

Toggle description

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

Toggle description

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

Toggle description

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

Toggle description

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

Part 3: Empower Your User

Toggle description

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

Get RESTful 10:25
Toggle description

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

Toggle description

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

Toggle description

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

Toggle description

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

Toggle description

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

Toggle description

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

Toggle description

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

Part 4: Integrating Your User

Toggle description

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

Toggle description

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