Created
November 3, 2019 10:49
-
-
Save robertohuertasm/db250006a7f456aa8aa3f137c4f9edd6 to your computer and use it in GitHub Desktop.
rust_for_android_ios_flutter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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