Files
sing-box-for-apple/ApplicationLibrary/Views/Dashboard/InstallProfileButton.swift
T
2023-07-26 20:38:51 +08:00

28 lines
571 B
Swift

import Library
import SwiftUI
public struct InstallProfileButton: View {
@Environment(\.extensionProfile) private var extensionProfile
@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)
}
}
}