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
40 lines
724 B
Swift
40 lines
724 B
Swift
//
|
|
// Location.swift
|
|
// Remote
|
|
//
|
|
// Created by Javier Cicchelli on 10/04/2023.
|
|
// Copyright © 2023 Röck+Cöde. All rights reserved.
|
|
//
|
|
|
|
public struct Location: Equatable {
|
|
|
|
// MARK: Properties
|
|
|
|
public let name: String?
|
|
public let latitude: Float
|
|
public let longitude: Float
|
|
|
|
// MARK: Initialisers
|
|
|
|
init(
|
|
name: String? = nil,
|
|
latitude: Float,
|
|
longitude: Float
|
|
) {
|
|
self.name = name
|
|
self.latitude = latitude
|
|
self.longitude = longitude
|
|
}
|
|
|
|
}
|
|
|
|
// MARK: - Decodable
|
|
|
|
extension Location: Decodable {
|
|
enum CodingKeys: String, CodingKey {
|
|
case name
|
|
case latitude = "lat"
|
|
case longitude = "long"
|
|
}
|
|
}
|