Skip to content

Commit fb10484

Browse files
committed
add new
1 parent 0f5c330 commit fb10484

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

  • algorithmPlayGround.playground/Pages/Architectures.xcplaygroundpage

algorithmPlayGround.playground/Pages/Architectures.xcplaygroundpage/Contents.swift

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct MVVM_Entity {
141141

142142
// Use cases
143143
class MVVM_UseCase {
144-
private let repository : MVVM_Interface = MVVM_Repository()
144+
private let repository : MVVM_Interface = MVVM_Repository(with: .local)
145145

146146
func fetch() -> MVVM_Entity? {
147147
return repository.get()
@@ -210,6 +210,17 @@ class MVVM_View {
210210
class MVVM_Network {
211211
}
212212

213+
class MVVM_Storage_Factory {
214+
enum StorageType {
215+
case local
216+
}
217+
static func factory(with type: StorageType) -> MVVM_Storage {
218+
switch type {
219+
case .local : return MVVM_Storage()
220+
}
221+
}
222+
}
223+
213224
class MVVM_Storage {
214225
}
215226

@@ -219,8 +230,8 @@ class MVVM_Repository : MVVM_Interface {
219230
private var count : Int = 0
220231
private var data: MVVM_Entity?
221232

222-
init(with storage : MVVM_Storage) {
223-
self.storage = storage
233+
init(with storageType : MVVM_Storage_Factory.StorageType) {
234+
self.storage = MVVM_Storage_Factory.factory(with: storageType)
224235
}
225236

226237
func set(_ data: MVVM_Entity) {

0 commit comments

Comments
 (0)