@@ -124,34 +124,6 @@ extension Xcodeproj {
124
124
}
125
125
}
126
126
}
127
-
128
- @propertyWrapper
129
- enum AllowUnknownRawValue < T: RawRepresentable > : Decodable where T. RawValue == String {
130
- case known( T )
131
- case other( String )
132
-
133
- var wrappedValue : T ? {
134
- switch self {
135
- case . known( let v) : return v
136
- case . other: return nil
137
- }
138
- }
139
- var projectedValue : String {
140
- switch self {
141
- case . known( let v) : return v. rawValue
142
- case . other( let s) : return s
143
- }
144
- }
145
- init ( from decoder: Decoder ) throws {
146
- let container = try decoder. singleValueContainer ( )
147
- let string = try container. decode ( String . self)
148
- if let known = T ( rawValue: string) {
149
- self = . known( known)
150
- } else {
151
- self = . other( string)
152
- }
153
- }
154
- }
155
127
156
128
/// Type used to represent and decode the root object of a `.pbxproj` file.
157
129
struct PBXProjFile : Decodable {
@@ -203,8 +175,9 @@ extension Xcodeproj {
203
175
struct PBXNativeTarget : PBXObject {
204
176
let name : String
205
177
let buildPhases : [ ObjectUUID ]
206
- @AllowUnknownRawValue var productType : ProductType ?
207
-
178
+ let productType : String
179
+ var knownProductType : ProductType ? { ProductType ( rawValue: productType) }
180
+
208
181
enum ProductType : String , Decodable {
209
182
case app = " com.apple.product-type.application "
210
183
case appExtension = " com.apple.product-type.app-extension "
329
302
targetsToLint = project. nativeTargets. filter { $0. name == targetName }
330
303
} else {
331
304
print ( " Linting all app extension targets " )
332
- targetsToLint = project. nativeTargets. filter { $0. productType == . appExtension }
305
+ targetsToLint = project. nativeTargets. filter { $0. knownProductType == . appExtension }
333
306
}
334
307
335
308
// Lint each requested target
0 commit comments