feat: add crate swift-rs

This commit is contained in:
2023-12-09 10:17:41 +08:00
parent d36c06f461
commit 215b75d6da
35 changed files with 2489 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
import SwiftRs
import Foundation
class Complex: NSObject {
var a: SRString
var b: Int
var c: Bool
public init(a: SRString, b: Int, c: Bool) {
self.a = a
self.b = b
self.c = c
}
}
@_cdecl("complex_data")
func complexData() -> SRObjectArray {
return SRObjectArray([
Complex(a: SRString("Brendan"), b: 0, c: true),
Complex(a: SRString("Amod"), b: 1, c: false),
Complex(a: SRString("Lucas"), b: 2, c: true),
Complex(a: SRString("Oscar"), b: 3, c: false),
])
}
@_cdecl("echo_data")
func echoData(data: SRData) -> SRData {
return SRData(data.toArray())
}