Skip to content

Commit

Permalink
Merge pull request #2 from 15joeybloom/main
Browse files Browse the repository at this point in the history
Remove unnecessary force-unwrapping
  • Loading branch information
changemin authored Apr 2, 2021
2 parents 4f5ffbf + ce4264e commit 5045668
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Sources/LoadingButton/LoadingButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import SwiftUI

public struct LoadingButton<Content: View>: View{
@Binding var isLoading: Bool
var style: LoadingButtonStyle? = LoadingButtonStyle()
var style: LoadingButtonStyle
let content: Content
var action: () -> () = {}

Expand All @@ -22,20 +22,20 @@ public struct LoadingButton<Content: View>: 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 {
content.animation(.easeInOut)
}
}
}
}.frame(width: style!.width, height: style!.height)
}.frame(width: style.width, height: style.height)
}
}

0 comments on commit 5045668

Please sign in to comment.