Skip to content

Commit

Permalink
/issues/5298 - Prevent the activity indicator modifier from reloading…
Browse files Browse the repository at this point in the history
… the whole view hierarchy.
  • Loading branch information
stefanceriu committed Dec 16, 2021
1 parent 78ea8fb commit 50ac3ca
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ import SwiftUI
/// A modifier for showing the activity indicator centered over a view.
struct ActivityIndicatorModifier: ViewModifier {
var show: Bool

@ViewBuilder
func body(content: Content) -> some View {
content
.overlay(activityIndicator, alignment: .center)
}

@ViewBuilder
private var activityIndicator: some View {
if show {
content
.overlay(ActivityIndicator(), alignment: .center)
} else {
content
ActivityIndicator()
}
}
}
Expand Down

0 comments on commit 50ac3ca

Please sign in to comment.