feat: add crate swift-rs
This commit is contained in:
29
swift-rs/tests/swift-pkg/lib.swift
Normal file
29
swift-rs/tests/swift-pkg/lib.swift
Normal 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())
|
||||
}
|
||||
Reference in New Issue
Block a user