From 2981d4ce160131a2c5a8be2716f42690ec46a82a Mon Sep 17 00:00:00 2001 From: crane-hiromu Date: Thu, 22 Dec 2022 15:03:01 +0900 Subject: [PATCH] update btn range --- Sources/DroidKit/View/DroidKitActionButton.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Sources/DroidKit/View/DroidKitActionButton.swift b/Sources/DroidKit/View/DroidKitActionButton.swift index aa044f7..6c4b3f6 100644 --- a/Sources/DroidKit/View/DroidKitActionButton.swift +++ b/Sources/DroidKit/View/DroidKitActionButton.swift @@ -13,7 +13,7 @@ struct DroidKitActionButton: View { let action: () async throws -> Void var body: some View { - Button(title) { + Button(action: { Task { do { try await action() @@ -21,8 +21,10 @@ struct DroidKitActionButton: View { debugPrint("fail to \(title): \(error.localizedDescription)") } } - } - .modifier(ActionButtonModifier()) + }, label: { + Text(title) + .modifier(ActionButtonModifier()) + }) } }