Swifjection

PUBLISHED ON MAR 1, 2017 — PROJECT

Overview

Swifjection – lightweight and simplistic dependency injection framework written in Swift for Swift .

The main idea behind this project is to achieve DI for Swift objects that does not inherit from Objective-C classes.

Technical details

We built Swifjection for our use in the first place. These are the key points what was our motivation:

  • No need to inherit from NSObject in order to inject dependencies
  • To inject pure Swift types you just need to conform to simple Injectable protocol
  • No action required to inject NSObject sublcasses, or classes conforming to Injectable protocol
  • Clear and simple binding system inspired by Objective-C framework Objection
  • Lightweight – we wanted to avoid unnecessary clutter and made the APIs as simple as possible