Dependency Inversion — A Swift guide

A quite basic guide

Steven Curtis
6 min readJan 30, 2023
Photo by James Peacock on Unsplash

A demonstration of dependency inversion using Swift

Difficulty: Beginner | Easy | Normal | Challenging

This article has been developed using Xcode 12.0, and Swift 5.3

Terminology:

Dependency Injection: A technique that allows objects to receive other objects on which it depends

Dependency Inversion: A principle that allows the decoupling of software modules

Inversion of Control: A design pattern that allows code to conform to the Dependency Inversion principle

Prerequisites:

- You will be expected to be aware how to make a Single View Application, or a Playground to run Swift code

- I’d recommend that you have a working knowledge of Dependency Injection

Dependency injection vs. dependency inversion

Dependency Injection is a technique for supplying dependencies to a class, that is it is a technique that enables Inversion of Control by passing dependencies through a constructor, property or other method.

Dependency Inversion is a principle (and is therefore also known as the Dependency Inversion…

--

--

No responses yet