Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import Foundation
import SwiftUI
struct DependencyManager {
let identifier: String
let urlSession = URLSession.shared
struct DependencyManagerKey: EnvironmentKey {
typealias Value = DependencyManager
static var defaultValue = DependencyManager(identifier: "Default created by environment")
extension EnvironmentValues {
var dependencyManager: DependencyManager {
get {
return self[DependencyManagerKey.self]
set {
self[DependencyManagerKey.self] = newValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment