Skip to content

Instantly share code, notes, and snippets.

@robertohuertasm
Created November 3, 2019 10:49
Show Gist options
  • Save robertohuertasm/db250006a7f456aa8aa3f137c4f9edd6 to your computer and use it in GitHub Desktop.
Save robertohuertasm/db250006a7f456aa8aa3f137c4f9edd6 to your computer and use it in GitHub Desktop.
rust_for_android_ios_flutter
import SwiftUI
struct ContentView: View {
let s = getName()
var body: some View {
Text(s)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
func getName() -> String {
let result = hello("Rob")
let sr = String(cString: result!)
// IMPORTANT: once we get the result we have to release the pointer.
hello_release(UnsafeMutablePointer(mutating: result))
return sr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment