@@ -18,6 +18,10 @@ public final class SwiftGenerator {
18
18
19
19
private let testableImports : [ String ] ?
20
20
21
+ private let projectName : String ?
22
+
23
+ private let platform : Platform ?
24
+
21
25
private let version : String
22
26
23
27
private let swiftlintDisableAll : Bool
@@ -27,13 +31,17 @@ public final class SwiftGenerator {
27
31
28
32
public init ( dependencyGraph: DependencyGraph ,
29
33
inspector: Inspector ,
34
+ projectName: String ? ,
35
+ platform: Platform ? ,
30
36
version: String ,
31
37
testableImports: [ String ] ? ,
32
38
swiftlintDisableAll: Bool ,
33
39
importFilter: @escaping ImportFilter ) throws {
34
40
35
41
self . dependencyGraph = dependencyGraph
36
42
self . inspector = inspector
43
+ self . projectName = projectName
44
+ self . platform = platform
37
45
self . version = version
38
46
self . testableImports = testableImports? . filter ( importFilter)
39
47
self . swiftlintDisableAll = swiftlintDisableAll
@@ -45,9 +53,22 @@ public final class SwiftGenerator {
45
53
if let file = _file {
46
54
return file
47
55
}
56
+
57
+ let objcPrefix : String ?
58
+ if let projectName = projectName {
59
+ if let platform = platform {
60
+ objcPrefix = " \( projectName. typeCase) \( platform. rawValue. typeCase) "
61
+ } else {
62
+ objcPrefix = " \( projectName. typeCase) "
63
+ }
64
+ } else {
65
+ objcPrefix = nil
66
+ }
67
+
48
68
let file = try MetaWeaverFile (
49
69
dependencyGraph,
50
70
inspector,
71
+ objcPrefix,
51
72
version,
52
73
testableImports,
53
74
swiftlintDisableAll,
@@ -179,7 +200,9 @@ private final class MetaWeaverFile {
179
200
private let dependencyGraph : DependencyGraph
180
201
181
202
private let inspector : Inspector
182
-
203
+
204
+ private let objcPrefix : String ?
205
+
183
206
private let version : String
184
207
185
208
private let testableImports : [ String ] ?
@@ -209,13 +232,15 @@ private final class MetaWeaverFile {
209
232
210
233
init ( _ dependencyGraph: DependencyGraph ,
211
234
_ inspector: Inspector ,
235
+ _ objcPrefix: String ? ,
212
236
_ version: String ,
213
237
_ testableImports: [ String ] ? ,
214
238
_ swiftlintDisableAll: Bool ,
215
239
_ importFilter: @escaping SwiftGenerator . ImportFilter ) throws {
216
240
217
241
self . dependencyGraph = dependencyGraph
218
242
self . inspector = inspector
243
+ self . objcPrefix = objcPrefix
219
244
self . version = version
220
245
self . testableImports = testableImports
221
246
self . swiftlintDisableAll = swiftlintDisableAll
@@ -318,10 +343,10 @@ private final class MetaWeaverFile {
318
343
// MARK: - MainDependencyContainer
319
344
320
345
private extension MetaWeaverFile {
321
-
346
+
322
347
func mainDependencyContainer( ) throws -> Type {
323
348
return Type ( identifier: . mainDependencyContainer)
324
- . with ( objc: doesSupportObjc)
349
+ . with ( objc: doesSupportObjc, prefix : objcPrefix )
325
350
. adding ( inheritedType: doesSupportObjc ? . nsObject : nil )
326
351
. adding ( member: EmptyLine ( ) )
327
352
. adding ( member: Property ( variable: Variable ( name: " provider " ) . with ( immutable: true ) . with ( type: . provider) ) . with ( accessLevel: . private) )
@@ -950,7 +975,7 @@ static func _pushDynamicResolver<Resolver>(_ resolver: Resolver) {
950
975
builderReference = . named( customBuilder) | . call( Tuple ( )
951
976
. adding ( parameter: TupleParameter ( value:
952
977
( containsAmbiguousDeclarations ? Variable . __self. reference + Variable. proxySelf. reference : Reference . named ( " _inputContainer " ) ) |
953
- . as | target. type. inputDependencyResolverTypeID. reference
978
+ . as( . strict ( target. type. inputDependencyResolverTypeID) )
954
979
) )
955
980
)
956
981
shouldUnwrapResolverReference = containsAmbiguousDeclarations
0 commit comments