Files
sing-box-for-apple/ApplicationLibrary/Views/Dashboard/InstallProfileButton.swift
T
2023-08-15 17:20:44 +08:00

26 lines
504 B
Swift

import Library
import SwiftUI
public struct InstallProfileButton: View {
@State private var alert: Alert?
public init() {}
public var body: some View {
Button("Install NetworkExtension") {
Task {
await installProfile()
}
}
.alertBinding($alert)
}
private func installProfile() async {
do {
try await ExtensionProfile.install()
} catch {
alert = Alert(error)
}
}
}