diff --git a/ProjectDescriptionHelpers/Constant.swift b/ProjectDescriptionHelpers/Constant.swift new file mode 100644 index 00000000..34dca307 --- /dev/null +++ b/ProjectDescriptionHelpers/Constant.swift @@ -0,0 +1,21 @@ +import ProjectDescription + +/// Constant value Property wrapper +/// +/// Used for Constant Management. +/// ```swift +/// @Constant var env = Constants() +/// ``` +@propertyWrapper public struct Constant where ObjectType: ModuleObject { + private var value: ObjectType + + public init(wrappedValue: ObjectType) { + self.value = wrappedValue + } + + public var wrappedValue: ObjectType { value } + + public var projectedValue: Constant { + get { return self } + } +} diff --git a/ProjectDescriptionHelpers/Object/ModuleObject.swift b/ProjectDescriptionHelpers/Object/ModuleObject.swift new file mode 100644 index 00000000..73a7b656 --- /dev/null +++ b/ProjectDescriptionHelpers/Object/ModuleObject.swift @@ -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 {}