Swift, Solid Principles In Swift, Easy, Dependency Injection, Swift Programming.
Switchable { func turnOn() func turnOff() } class LightBulb: Switchable { func turnOn() { // logic for turning on } func turnOff() { // logic for turning off } } class Switch { private let device: Switchable init(device: Switchable) { self.device = device } func operate() { device.turnOn() } } In