-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import ProjectDescription | ||
|
||
/// Constant value Property wrapper | ||
/// | ||
/// Used for Constant Management. | ||
/// ```swift | ||
/// @Constant var env = Constants() | ||
/// ``` | ||
@propertyWrapper public struct Constant<ObjectType> where ObjectType: ModuleObject { | ||
private var value: ObjectType | ||
|
||
public init(wrappedValue: ObjectType) { | ||
self.value = wrappedValue | ||
} | ||
|
||
public var wrappedValue: ObjectType { value } | ||
|
||
public var projectedValue: Constant<ObjectType> { | ||
get { return self } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import ProjectDescription | ||
|
||
/// ModuleObject Type | ||
/// Helps manage module variables that are used repeatedly by Tuist. | ||
/// | ||
/// ```swift | ||
/// struct Constants: ModuleObject { | ||
/// static var version: String! = "x.y.z" | ||
/// static let config = AppConfig() | ||
///} | ||
/// ``` | ||
/// | ||
public protocol ModuleObject {} |