36 lines
768 B
Swift
36 lines
768 B
Swift
|
//
|
||
|
// DependencyService+Keys.swift
|
||
|
// Locations
|
||
|
//
|
||
|
// Created by Javier Cicchelli on 11/04/2023.
|
||
|
// Copyright © 2023 Röck+Cöde. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import Dependency
|
||
|
import Persistence
|
||
|
import Remote
|
||
|
|
||
|
// MARK: - DependencyService+Keys
|
||
|
|
||
|
extension DependencyService {
|
||
|
var persistence: PersistenceService {
|
||
|
get { Self[PersistenceKey.self] }
|
||
|
set { Self[PersistenceKey.self] = newValue }
|
||
|
}
|
||
|
|
||
|
var remote: RemoteService {
|
||
|
get { Self[RemoteKey.self] }
|
||
|
set { Self[RemoteKey.self] = newValue }
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// MARK: - Dependency keys
|
||
|
|
||
|
struct PersistenceKey: DependencyKey {
|
||
|
static var currentValue: PersistenceService = .shared
|
||
|
}
|
||
|
|
||
|
struct RemoteKey: DependencyKey {
|
||
|
static var currentValue: RemoteService = .init()
|
||
|
}
|