Skip to content

Commit

Permalink
Add Environment
Browse files Browse the repository at this point in the history
  • Loading branch information
jihoonahn committed Nov 20, 2023
1 parent ab2f9ec commit c75e21d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ProjectDescriptionHelpers/Environment.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import ProjectDescription

/// Environment value Property wrapper
///
/// Used for Environment Management.
/// ```swift
/// @Environment var env = AppEnvironment()
/// ```
@propertyWrapper public struct Environment<ObjectType> where ObjectType: EnvironmentObject {
private var env: ObjectType

public init(wrappedValue: ObjectType) {
self.env = wrappedValue
}

public var wrappedValue: ObjectType { env }

public var projectedValue: Environment<ObjectType> {
get { return self }
}
}

0 comments on commit c75e21d

Please sign in to comment.