這是一個 MVVM 的展示專案
ViewModel 使用 POP & OOP 建立
方便使用,並且減少大量重複的 Code
--
Just Model
var models: [Model]
var status: ViewModelStatus
func loadData()
func loadDataMode()
var loadingDelegate: ViewModelLoadingDelegate?
var loadingStatusDelegate: ViewModelLoadingStatusDelegate?
var datasCount: Int
func model(at index: Int) -> Model?
func isLastData(index: Int) -> Bool
func isLoadMore(index: Int) -> Bool
func refreshData()
func nextStatus()
var viewModel: BaseViewModel
extension ViewController: ViewModelLoadingDelegate
func loadingDone()
func loadingFail(_ error: Error?)
extension ViewController: ViewModelLoadingStatusDelegate
func showEmptyView(with: Error?)
func removeEmptyView()
func showLoading(_ bool: Bool)
viewModel.nextStatus()
viewModel.refreshData()