[Improvement] Small, tiny things #14
@ -0,0 +1,19 @@
|
||||
//
|
||||
// Service.swift
|
||||
// Remote
|
||||
//
|
||||
// Created by Javier Cicchelli on 13/04/2023.
|
||||
// Copyright © 2023 Röck+Cöde. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public protocol Service {
|
||||
|
||||
// MARK: Functions
|
||||
|
||||
/// Retrieve a set of locations.
|
||||
/// - Returns: The set of locations represented as a `Location` instances.
|
||||
func getLocations() async throws -> [Location]
|
||||
|
||||
}
|
@ -21,6 +21,12 @@ public struct RemoteService {
|
||||
self.client = RemoteClient(configuration: configuration)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Service
|
||||
|
||||
extension RemoteService: Service {
|
||||
|
||||
// MARK: Functions
|
||||
|
||||
public func getLocations() async throws -> [Location] {
|
||||
@ -29,7 +35,7 @@ public struct RemoteService {
|
||||
for: Locations.self
|
||||
).locations
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Models
|
||||
|
@ -18,7 +18,7 @@ extension DependencyService {
|
||||
set { Self[PersistenceKey.self] = newValue }
|
||||
}
|
||||
|
||||
var remote: RemoteService {
|
||||
var remote: Remote.Service {
|
||||
get { Self[RemoteKey.self] }
|
||||
set { Self[RemoteKey.self] = newValue }
|
||||
}
|
||||
@ -31,5 +31,5 @@ struct PersistenceKey: DependencyKey {
|
||||
}
|
||||
|
||||
struct RemoteKey: DependencyKey {
|
||||
static var currentValue: RemoteService = .init()
|
||||
static var currentValue: Remote.Service = RemoteService()
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ struct LoadRemoteLocationsUseCase {
|
||||
// MARK: Properties
|
||||
|
||||
private let persistence: PersistenceService
|
||||
private let remoteService: RemoteService
|
||||
private let remoteService: Remote.Service
|
||||
|
||||
// MARK: Initialisers
|
||||
|
||||
init(
|
||||
persistence: PersistenceService,
|
||||
remoteService: RemoteService
|
||||
remoteService: Remote.Service
|
||||
) {
|
||||
self.persistence = persistence
|
||||
self.remoteService = remoteService
|
||||
|
Loading…
x
Reference in New Issue
Block a user