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

Reusable iOS Frameworks

Pro

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

Version

  • 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?

1

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

2

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

3

Consider Your User

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

4

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

5

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

6

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

7

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

8

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

9

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

10

Empower Your User

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

11

Get RESTful

10:25

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

12

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

13

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

14

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

15

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

16

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

17

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

18

Integrating Your User

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

19

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

20

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

Contributors

Comments