-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathswift-bridge.mustache
44 lines (39 loc) · 1.38 KB
/
swift-bridge.mustache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// swiftformat:disable redundantRawValues
// Don't modify this file manually, it's auto generated.
{{#documentationLines}}
///{{{.}}}
{{/documentationLines}}
public class {{moduleName}} {
{{#customTags.privateDispatcher}}private {{/customTags.privateDispatcher}}let jsExecutor: BridgeJSExecutor
init(jsExecutor: BridgeJSExecutor) {
self.jsExecutor = jsExecutor
}
{{#methods}}
{{#documentationLines}}
///{{{.}}}
{{/documentationLines}}
public func {{methodName}}({{parametersDeclaration}}{{#parametersDeclaration.length}}, {{/parametersDeclaration.length}}completion: {{#returnType}}@escaping BridgeCompletion<{{returnType}}>{{/returnType}}{{^returnType}}BridgeJSExecutor.Completion? = nil{{/returnType}}) {
{{#parameters.length}}
struct Args: Encodable {
{{#parameters}}
let {{name}}: {{type}}
{{/parameters}}
}
{{/parameters.length}}
{{#parameters.length}}
let args = Args(
{{#parameters}}
{{name}}: {{name}}{{^last}},{{/last}}
{{/parameters}}
)
{{/parameters.length}}
jsExecutor.execute(with: "{{customTags.invokePath}}", feature: "{{methodName}}", args: {{#parameters.length}}args{{/parameters.length}}{{^parameters}}nil{{/parameters}}, completion: completion)
}
{{/methods}}
}
{{#associatedTypes}}
{{> swift-named-type}}
{{/associatedTypes}}