diff --git a/Sources/LoadingButton/LoadingButton.swift b/Sources/LoadingButton/LoadingButton.swift index 36f7dd7..989c148 100644 --- a/Sources/LoadingButton/LoadingButton.swift +++ b/Sources/LoadingButton/LoadingButton.swift @@ -2,7 +2,7 @@ import SwiftUI public struct LoadingButton: View{ @Binding var isLoading: Bool - var style: LoadingButtonStyle? = LoadingButtonStyle() + var style: LoadingButtonStyle let content: Content var action: () -> () = {} @@ -22,12 +22,12 @@ public struct LoadingButton: View{ }) { ZStack { Rectangle() - .fill(isLoading ? style!.loadingBackgroundColor : style!.backgroundColor) - .frame(width: isLoading ? style!.height : style!.width, height: style!.height) - .cornerRadius(isLoading ? style!.height/2 : style!.cornerRadius) + .fill(isLoading ? style.loadingBackgroundColor : style.backgroundColor) + .frame(width: isLoading ? style.height : style.width, height: style.height) + .cornerRadius(isLoading ? style.height/2 : style.cornerRadius) .animation(.easeInOut) if isLoading { - CircleLoadingBar(style: style!) + CircleLoadingBar(style: style) } else { VStack { @@ -35,7 +35,7 @@ public struct LoadingButton: View{ } } } - }.frame(width: style!.width, height: style!.height) + }.frame(width: style.width, height: style.height) } }