|
As the title suggests, |
Answered by
marcprux
Jul 15, 2024
Replies: 1 comment 1 reply
|
If you are in a SwiftUI view, the recommended way to open a URL is like: public struct ContentView: View {
@Environment(\.openURL) var openURLAction
public var body: some View {
Button("Launch URL") {
let url = URL(string: "https://skip.tools")!
openURLAction(url)
}
}
}If you need to call this from a non-SwiftUI view (e.g., from model code), note that we do implement func openSkipURL() {
Task {
let url = URL(string: "https://skip.tools")!
await UIApplication.shared.open(url)
}
}P.S. Note that you will need to ensure your AndroidManifest.xml file contains the <?xml version="1.0" encoding="utf-8"?>
<!-- This AndroidManifest.xml template was generated by Skip -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<!-- permissions needed for using the internet or an embedded WebKit browser -->
<uses-permission android:name="android.permission.INTERNET" />
</manifest> |
1 reply
Answer selected by
marcprux
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are in a SwiftUI view, the recommended way to open a URL is like:
If you need to call this from a non-SwiftUI view (e.g., from model code), note that we do implement
UIApplication.shared.open, but there was a bug with it that prevented it from working until the latest version of SkipUI (0.10.7). So once you update your packages, this should also work: