| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- // LoopFollow
- // LoadingButtonView.swift
- import SwiftUI
- struct LoadingButtonView: View {
- var buttonText: String
- var progressText: String
- var isLoading: Bool
- var action: () -> Void
- var isDisabled: Bool = false
- var body: some View {
- Section {
- VStack {
- if isLoading {
- HStack {
- ProgressView()
- .padding(.trailing, 10)
- Text(progressText)
- }
- .padding()
- } else {
- Button(action: {
- action()
- }) {
- Text(buttonText)
- .frame(maxWidth: .infinity)
- }
- .buttonStyle(.borderedProminent)
- .controlSize(.large)
- .disabled(isDisabled)
- }
- }
- .frame(maxWidth: .infinity, alignment: .center)
- .listRowInsets(EdgeInsets())
- }
- }
- }
|