Use atproto actions with ease in iOS shortcuts
1//
2// LoadingButtonStyle.swift
3// shortcut
4//
5// Created by Bailey Townsend on 7/21/25.
6//
7
8import Foundation
9import SwiftUI
10
11struct LoadingButtonStyle: ButtonStyle {
12 @Environment(\.isEnabled) private var isEnabled
13 private var isLoading: Bool
14
15 init(isLoading: Bool) {
16 self.isLoading = isLoading
17 }
18
19 func makeBody(configuration: Configuration) -> some View {
20 HStack(spacing: 8) {
21 if isLoading {
22 ProgressView()
23 }
24
25 configuration.label
26 }
27 .foregroundStyle(Color.accentColor)
28 .opacity(configuration.isPressed ? 0.2 : 1)
29 .animation(.default, value: isEnabled)
30 .animation(.default, value: isLoading)
31 }
32}