This PR contains the work done to put in the app an MVVM-C architecture plus other small fixes in the `Library` libraries. To give further details about the work done: - [x] remove the `SceneDelegate` delegate; - [x] implemented the `WindowRouter`, `PushNavigationRouter`, and `ModalNavigationRouter` routers in the `Core` library; - [x] defined the `LocationsAddCoordination` and `LocationsListCoordination` protocols; - [x] defined the `LocationsAddViewModeling` and `LocationsListViewModeling` protocols; - [x] implemented the `LocationsListCoordinator` and `LocationsAddCoordinator` coordinators; - [x] implemented the `LocationsAddViewController` view controller and `LocationsAddViewModel` view model; - [x] implemented the `LocationsListViewController` view controller and `LocationsListViewModel` view model; - [x] implemented the `BaseViewController` base view controller; - [x] implemented the `persistence` and `remote` properties in the `DependencyService+Keys` extension. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: rock-n-code/deep-linking-assignment#9
57 lines
1.1 KiB
Swift
57 lines
1.1 KiB
Swift
//
|
|
// LocationsListViewController.swift
|
|
// Locations
|
|
//
|
|
// Created by Javier Cicchelli on 08/04/2023.
|
|
// Copyright © 2023 Röck+Cöde. All rights reserved.
|
|
//
|
|
|
|
import Core
|
|
import UIKit
|
|
|
|
class LocationsListViewController: BaseViewController {
|
|
|
|
// MARK: Properties
|
|
|
|
var viewModel: LocationsListViewModeling
|
|
|
|
// MARK: Initialisers
|
|
|
|
init(viewModel: LocationsListViewModeling) {
|
|
self.viewModel = viewModel
|
|
|
|
super.init()
|
|
}
|
|
|
|
required init?(coder: NSCoder) {
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
|
|
// MARK: UIViewController
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
navigationItem.rightBarButtonItem = UIBarButtonItem(
|
|
title: "Add",
|
|
style: .plain,
|
|
target: self,
|
|
action: #selector(addLocationPressed)
|
|
)
|
|
title = "Locations"
|
|
}
|
|
|
|
}
|
|
|
|
// MARK: - Helpers
|
|
|
|
private extension LocationsListViewController {
|
|
|
|
// MARK: Functions
|
|
|
|
@objc func addLocationPressed() {
|
|
viewModel.openAddLocation()
|
|
}
|
|
|
|
}
|