Update with legacy API demo to say greetings

This commit is contained in:
Daohan Chong 2022-01-24 10:50:05 +08:00
parent e1d10f485d
commit f30caa194d
5 changed files with 10 additions and 5 deletions

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"cSpell.words": [
"uniffi"
]
}

View File

@ -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!")
}
}

View File

@ -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"))
}
}

View File

@ -1,3 +1,3 @@
namespace Hello {
void say_hello(string name);
string rust_greeting(string name);
};

View File

@ -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"));