File tree Expand file tree Collapse file tree
algorithmPlayGround.playground/Pages/Architectures.xcplaygroundpage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ struct MVVM_Entity {
141141
142142// Use cases
143143class 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 {
210210class 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+
213224class 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 ) {
You can’t perform that action at this time.
0 commit comments