forked from swiftwasm/JavaScriptKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnumAssociatedValue.swift
More file actions
57 lines (49 loc) · 1.59 KB
/
EnumAssociatedValue.swift
File metadata and controls
57 lines (49 loc) · 1.59 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
@JS
enum APIResult {
case success(String)
case failure(Int)
case flag(Bool)
case rate(Float)
case precise(Double)
case info
}
@JS func handle(result: APIResult)
@JS func getResult() -> APIResult
@JS func roundtripAPIResult(result: APIResult) -> APIResult
@JS func roundTripOptionalAPIResult(result: APIResult?) -> APIResult?
@JS
enum ComplexResult {
case success(String)
case error(String, Int)
case status(Bool, Int, String)
case coordinates(Double, Double, Double)
case comprehensive(Bool, Bool, Int, Int, Double, Double, String, String, String)
case info
}
@JS func handleComplex(result: ComplexResult)
@JS func getComplexResult() -> ComplexResult
@JS func roundtripComplexResult(_ result: ComplexResult) -> ComplexResult
@JS func roundTripOptionalComplexResult(result: ComplexResult?) -> ComplexResult?
@JS
enum Utilities {
@JS enum Result {
case success(String)
case failure(String, Int)
case status(Bool, Int, String)
}
}
@JS func roundTripOptionalUtilitiesResult(result: Utilities.Result?) -> Utilities.Result?
@JS(namespace: "API")
@JS enum NetworkingResult {
case success(String)
case failure(String, Int)
}
@JS func roundTripOptionalNetworkingResult(result: NetworkingResult?) -> NetworkingResult?
@JS
enum APIOptionalResult {
case success(String?)
case failure(Int?, Bool?)
case status(Bool?, Int?, String?)
}
@JS func roundTripOptionalAPIOptionalResult(result: APIOptionalResult?) -> APIOptionalResult?
@JS func compareAPIResults(result1: APIOptionalResult?, result2: APIOptionalResult?) -> APIOptionalResult?