blob: 0aaa388da49be3adfd654f866ca65ea02cf2ec6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
//
// Inject.swift
// iosApp
//
// Created by Iván on 26/01/22.
// Copyright © 2022 orgName. All rights reserved.
//
import Foundation
import shared
// Source: https://www.kiloloco.com/articles/004-dependency-injection-via-property-wrappers/
// Source: https://medium.com/swlh/c1f02f06cd51
@propertyWrapper
struct Inject<T: Injectable> {
var injectable: T
init() {
injectable = Resolver.shared.resolve()
}
public var wrappedValue: T {
get { return injectable }
}
}
|