forked from swiftwasm/JavaScriptKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwiftClosure.swift
More file actions
79 lines (64 loc) · 2.81 KB
/
Copy pathSwiftClosure.swift
File metadata and controls
79 lines (64 loc) · 2.81 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import JavaScriptKit
@JS public class Person {
public let name: String
@JS public init(name: String) {
self.name = name
}
}
@JS public struct Animal {
public let type: String
@JS public init(type: String) {
self.type = type
}
}
@JS class TestProcessor {
@JS init(transform: @escaping (String) -> String) {}
}
@JS func roundtripAnimal(_ animalClosure: (Animal) -> Animal) -> (Animal) -> Animal
@JS func roundtripOptionalAnimal(_ animalClosure: (Animal?) -> Animal?) -> (Animal?) -> Animal?
@JS func roundtripString(_ stringClosure: (String) -> String) -> (String) -> String
@JS func roundtripInt(_ intClosure: (Int) -> Int) -> (Int) -> Int
@JS func roundtripBool(_ boolClosure: (Bool) -> Bool) -> (Bool) -> Bool
@JS func roundtripFloat(_ floatClosure: (Float) -> Float) -> (Float) -> Float
@JS func roundtripDouble(_ doubleClosure: (Double) -> Double) -> (Double) -> Double
@JS func roundtripOptionalString(_ stringClosure: (String?) -> String?) -> (String?) -> String?
@JS func roundtripOptionalInt(_ intClosure: (Int?) -> Int?) -> (Int?) -> Int?
@JS func roundtripOptionalBool(_ boolClosure: (Bool?) -> Bool?) -> (Bool?) -> Bool?
@JS func roundtripOptionalFloat(_ floatClosure: (Float?) -> Float?) -> (Float?) -> Float?
@JS func roundtripOptionalDouble(_ doubleClosure: (Double?) -> Double?) -> (Double?) -> Double?
@JS func roundtripPerson(_ personClosure: (Person) -> Person) -> (Person) -> Person
@JS func roundtripOptionalPerson(_ personClosure: (Person?) -> Person?) -> (Person?) -> Person?
@JS func roundtripDirection(_ callback: (Direction) -> Direction) -> (Direction) -> Direction
@JS func roundtripTheme(_ callback: (Theme) -> Theme) -> (Theme) -> Theme
@JS func roundtripHttpStatus(_ callback: (HttpStatus) -> HttpStatus) -> (HttpStatus) -> HttpStatus
@JS func roundtripAPIResult(_ callback: (APIResult) -> APIResult) -> (APIResult) -> APIResult
@JS func roundtripOptionalDirection(_ callback: (Direction?) -> Direction?) -> (Direction?) -> Direction?
@JS func roundtripOptionalTheme(_ callback: (Theme?) -> Theme?) -> (Theme?) -> Theme?
@JS func roundtripOptionalHttpStatus(_ callback: (HttpStatus?) -> HttpStatus?) -> (HttpStatus?) -> HttpStatus?
@JS func roundtripOptionalAPIResult(_ callback: (APIResult?) -> APIResult?) -> (APIResult?) -> APIResult?
@JS func roundtripOptionalDirection(_ callback: (Direction?) -> Direction?) -> (Direction?) -> Direction?
@JS enum Direction {
case north
case south
case east
case west
}
@JS enum Theme: String {
case light = "light"
case dark = "dark"
case auto = "auto"
}
@JS enum HttpStatus: Int {
case ok = 200
case notFound = 404
case serverError = 500
case unknown = -1
}
@JS enum APIResult {
case success(String)
case failure(Int)
case flag(Bool)
case rate(Float)
case precise(Double)
case info
}