This PR contains the work done to add a location at a time and updates the locations in the list of locations screen right after. To give further details about the work done: - [x] implemented the `LocationProvider` provider in the **Persistence** library; - [x] implemented the `SaveLocalLocationUseCase` use case; - [x] defined the properties and functions of the `LocationsAddViewModeling` protocol to support the clean, updating and saving of locations; - [x] implemented the `LocationsAddViewModel` view model; - [x] implemented the `LocationsAddViewController` view controller; - [x] implemented the dismissal of the `LocationsAddCoordinator` coordinator. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: rock-n-code/deep-linking-assignment#11
50 lines
970 B
Swift
50 lines
970 B
Swift
//
|
|
// LocationsAddCoordinator.swift
|
|
// Locations
|
|
//
|
|
// Created by Javier Cicchelli on 11/04/2023.
|
|
// Copyright © 2023 Röck+Cöde. All rights reserved.
|
|
//
|
|
|
|
import Core
|
|
import UIKit
|
|
|
|
class LocationsAddCoordinator: Coordinator {
|
|
|
|
// MARK: Properties
|
|
|
|
var children: [Coordinator] = []
|
|
var router: Router
|
|
|
|
// MARK: Initialisers
|
|
|
|
init(router: Router) {
|
|
self.router = router
|
|
}
|
|
|
|
// MARK: Coordinator
|
|
|
|
func present(animated: Bool, onDismiss: (() -> Void)?) {
|
|
router.present(
|
|
LocationsAddViewController(
|
|
viewModel: LocationsAddViewModel(coordinator: self)
|
|
),
|
|
animated: animated,
|
|
onDismiss: onDismiss
|
|
)
|
|
}
|
|
|
|
}
|
|
|
|
// MARK: - LocationsAddCoordination
|
|
|
|
extension LocationsAddCoordinator: LocationsAddCoordination {
|
|
|
|
// MARK: Functions
|
|
|
|
func closeAddLocation() {
|
|
router.dismiss(animated: true)
|
|
}
|
|
|
|
}
|