feat: add swift from go
This commit is contained in:
7
swift-from-go/Sources/go-swift/go_swift.swift
Normal file
7
swift-from-go/Sources/go-swift/go_swift.swift
Normal file
@@ -0,0 +1,7 @@
|
||||
@_cdecl("sayHello") // export to C as `sayHello``
|
||||
public func sayHello(namePtr: UnsafePointer<CChar>?) {
|
||||
// Creates a new string by copying the null-terminated UTF-8 data (C String)
|
||||
// referenced by the given pointer.
|
||||
let name = String(cString: namePtr!)
|
||||
print("Welcome, \(name)!")
|
||||
}
|
||||
Reference in New Issue
Block a user