Skip to content

Commit

Permalink
Merge pull request #64 from Team-Ampersand/60-common-struct-to-class
Browse files Browse the repository at this point in the history
🔀 :: struct로 된 공유 객체들의 타입을 class로 변경 및 싱글톤 DI
  • Loading branch information
baekteun authored Jul 6, 2023
2 parents b78772a + 6b7a576 commit 0d775b4
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
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

0 comments on commit 0d775b4

Please sign in to comment.