52 lines
1005 B
Swift
52 lines
1005 B
Swift
//
|
|
// LocationsListViewModel.swift
|
|
// Locations
|
|
//
|
|
// Created by Javier Cicchelli on 11/04/2023.
|
|
// Copyright © 2023 Röck+Cöde. All rights reserved.
|
|
//
|
|
|
|
import Combine
|
|
import Core
|
|
|
|
class LocationsListViewModel: ObservableObject {
|
|
|
|
// MARK: Properties
|
|
|
|
weak var coordinator: LocationsListCoordination?
|
|
|
|
@Published private var viewStatus: LocationsListViewStatus = .initialised
|
|
|
|
// MARK: Initialisers
|
|
|
|
init(coordinator: LocationsListCoordination) {
|
|
self.coordinator = coordinator
|
|
}
|
|
|
|
}
|
|
|
|
// MARK: - LocationsListViewModeling
|
|
|
|
extension LocationsListViewModel: LocationsListViewModeling {
|
|
|
|
// MARK: Properties
|
|
|
|
var viewStatusPublisher: Published<LocationsListViewStatus>.Publisher { $viewStatus }
|
|
|
|
// MARK: Functions
|
|
|
|
func openAddLocation() {
|
|
coordinator?.openAddLocation()
|
|
}
|
|
|
|
}
|
|
|
|
// MARK: - Enumerations
|
|
|
|
enum LocationsListViewStatus {
|
|
case initialised
|
|
case loading
|
|
case loaded
|
|
case error
|
|
}
|