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
|
// Use XCTAssert and related functions to verify your tests produce the correct
|
||||||
// results.
|
// results.
|
||||||
// XCTAssertEqual(Hello.text, "Hello, World!")
|
// XCTAssertEqual(Hello.text, "Hello, World!")
|
||||||
|
XCTAssertEqual(rustGreeting(name: "Bob"), "Hello, Bob!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ class ViewController: UIViewController {
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
// Do any additional setup after loading the view.
|
// Do any additional setup after loading the view.
|
||||||
sayHello(name: "Apple Demo App")
|
print(rustGreeting(name: "Bob"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
namespace Hello {
|
namespace Hello {
|
||||||
void say_hello(string name);
|
string rust_greeting(string name);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
|
pub fn rust_greeting(to: String) -> String {
|
||||||
pub fn say_hello(name: String) {
|
return format!("Hello, {}!", to);
|
||||||
println!("Hello, {}!", name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/hello.uniffi.rs"));
|
include!(concat!(env!("OUT_DIR"), "/hello.uniffi.rs"));
|
||||||
|
|
Loading…
Reference in New Issue