-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat]: DIContainer / Coordinator 설계
- Loading branch information
Showing
630 changed files
with
353 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// DIContainer.swift | ||
// AVIRO | ||
// | ||
// Created by 전성훈 on 5/10/24. | ||
// | ||
|
||
import Foundation | ||
|
||
final class DIContainer { | ||
private var dependencies: [String: AnyObject] = [:] | ||
|
||
private init() { } | ||
|
||
func register<T: AnyObject>(_ type: T.Type, dependency: T) { | ||
let key = String(describing: type) | ||
|
||
dependencies[key] = dependency | ||
} | ||
|
||
func resolve<T: AnyObject>(_ type: T.Type) -> T? { | ||
let key = String(describing: type) | ||
|
||
guard let value = dependencies[key] as? T else { | ||
printIfDebug("---- 의존성 key 값을 찾지 못했습니다 \(key) ----") | ||
|
||
return nil | ||
} | ||
|
||
return value | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// printIfDebug.swift | ||
// AVIRO | ||
// | ||
// Created by 전성훈 on 5/10/24. | ||
// | ||
|
||
func printIfDebug(_ string: String) { | ||
#if DEBUG | ||
print(string) | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// AVIROViewModel.swift | ||
// AVIRO | ||
// | ||
// Created by 전성훈 on 5/10/24. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol CoordinatorActions: AnyObject { } | ||
|
||
protocol AVIROViewModel { | ||
associatedtype CoordinatorActions | ||
|
||
associatedtype Input | ||
associatedtype Output | ||
|
||
func transform(input: Input) -> Output | ||
} |
Oops, something went wrong.