Update with legacy API demo to say greetings
This commit is contained in:
parent
e1d10f485d
commit
f30caa194d
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"cSpell.words": [
|
||||
"uniffi"
|
||||
]
|
||||
}
|
|
@ -7,5 +7,6 @@ final class HelloTests: XCTestCase {
|
|||
// Use XCTAssert and related functions to verify your tests produce the correct
|
||||
// results.
|
||||
// XCTAssertEqual(Hello.text, "Hello, World!")
|
||||
XCTAssertEqual(rustGreeting(name: "Bob"), "Hello, Bob!")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class ViewController: UIViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view.
|
||||
sayHello(name: "Apple Demo App")
|
||||
print(rustGreeting(name: "Bob"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
namespace Hello {
|
||||
void say_hello(string name);
|
||||
string rust_greeting(string name);
|
||||
};
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
pub fn say_hello(name: String) {
|
||||
println!("Hello, {}!", name);
|
||||
pub fn rust_greeting(to: String) -> String {
|
||||
return format!("Hello, {}!", to);
|
||||
}
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/hello.uniffi.rs"));
|
||||
|
|
Loading…
Reference in New Issue