Tim Malseed
10/29/2022, 12:15 AMTim Malseed
10/29/2022, 12:16 AMclass RoutineViewModel(val context: Context) {
val driverFactory = DriverFactory(context)
val databaseHelper = DatabaseHelper(driverFactory)
val dataSource = AppDataSource(databaseHelper.database)
val repository = LocalAppRepository(dataSource)
}
This compiles fine. Note that these classes come from a couple of different gradle modules.Tim Malseed
10/29/2022, 12:17 AMclass RoutineViewModel {
private let repository: LocalAppRepository
init() {
let driverFactory = DriverFactory()
let databaseHelper = DatabaseHelper(driverFactory: driverFactory)
let dataSource = AppDataSource(database: databaseHelper.database)
self.repository = LocalAppRepository(dataSource: dataSource)
}
Tim Malseed
10/29/2022, 12:18 AMDatabaseAppDataSource
Tim Malseed
10/29/2022, 12:20 AMDirverFactory
, DatabaseHelper
and AppDataSource
are part of the same database
gradle module (and ‘database’ swift framework).
LocalAppRepository
is part of the data
gradle module (and data
framework)Tim Malseed
10/29/2022, 12:21 AMTim Malseed
10/29/2022, 12:28 AMTim Malseed
10/29/2022, 12:57 AM