Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔀 :: struct로 된 공유 객체들의 타입을 class로 변경 및 싱글톤 DI #64

Merged
merged 2 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Projects/Core/JwtStore/Sources/JwtStoreAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public final class JwtStoreAssembly: Assembly {
public func assemble(container: Container) {
container.register(JwtStore.self) { _ in
KeychainJwtStore()
}.inObjectScope(.container)
}
.inObjectScope(.container)
}
}
2 changes: 1 addition & 1 deletion Projects/Core/JwtStore/Sources/KeychainJwtStore.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import JwtStoreInterface

struct KeychainJwtStore: JwtStore {
final class KeychainJwtStore: JwtStore {
func save(property: JwtStoreProperties, value: String) {
let query: NSDictionary = [
kSecClass: kSecClassGenericPassword,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public final class KeyValueStoreAssembly: Assembly {
public func assemble(container: Container) {
container.register(KeyValueStore.self) { _ in
UserDefaultsKeyValueStore(userDefaults: .standard)
}.inObjectScope(.container)
}
.inObjectScope(.container)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ public final class AuthDomainAssembly: Assembly {
keyValueStore: resolver.resolve(KeyValueStore.self)!
)
}
.inObjectScope(.container)

container.register(LocalAuthDataSource.self) { resolver in
LocalAuthDataSourceImpl(jwtStore: resolver.resolve(JwtStore.self)!)
}
.inObjectScope(.container)

// MARK: - Repository
container.register(AuthRepository.self) { resolver in
Expand All @@ -26,6 +28,7 @@ public final class AuthDomainAssembly: Assembly {
localAuthDataSource: resolver.resolve(LocalAuthDataSource.self)!
)
}
.inObjectScope(.container)

// MARK: - UseCase
container.register(SigninUseCase.self) { resolver in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import AuthDomainInterface
import Combine
import JwtStoreInterface

struct LocalAuthDataSourceImpl: LocalAuthDataSource {
final class LocalAuthDataSourceImpl: LocalAuthDataSource {
private let jwtStore: any JwtStore

init(jwtStore: any JwtStore) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import AuthDomainInterface
import Combine

struct AuthRepositoryImpl: AuthRepository {
final class AuthRepositoryImpl: AuthRepository {
private let remoteAuthDataSource: any RemoteAuthDataSource
private let localAuthDataSource: any LocalAuthDataSource

Expand Down