An example of MVVM-C + POP + UIKit + Combine show plan weekend schedule for an input pools(Pool A, Pool B, Pool C and Pool D) of teams.
- Using Swift + MVVM-C + UIKit + Combine + POP
- Show plan weekend schedule for an input pools(Pool A, Pool B, Pool C and Pool D) of teams.
- Make UI with programmatically.
- Light & dark mode compatible.
- No third-party libraries.
- Unit test
- iOS 13.0+
- Xcode 12.2
Using MVVM-C pattern gives us some benefits like code reuse, ease of testing, bindings make UI updates easier to handle, ease of maintainability.
And splitting off protocols (DataSource and Delegate) into separate objects we can re-use those objects in other view controllers, or use different objects in the same view controller to get different behavior at runtime.
func test_update_poolSize_4_teamSize_8() {
//Given
let poolSize = 4
let teamSize = 8
//When
viewModel.updatePools(size: poolSize, teamSize: teamSize)
//Then
XCTAssert(viewModel.pools.count != 0)
XCTAssert(viewModel.pools.count == poolSize)
XCTAssert(viewModel.pools.first!.teams.count == teamSize)
}
- Make UI with SwiftUI
Tommy Doan, [email protected] or [email protected]