yattee/Shared/Modifiers/RedrawOnModifier.swift

20 lines
400 B
Swift
Raw Normal View History

2021-09-25 08:18:22 +00:00
import SwiftUI
2021-10-23 11:51:02 +00:00
struct RedrawOnModifier: ViewModifier {
2021-09-25 08:18:22 +00:00
@State private var changeFlag: Bool
init(changeFlag: Bool) {
self.changeFlag = changeFlag
}
func body(content: Content) -> some View {
content.opacity(changeFlag ? 1 : 1)
}
}
extension View {
func redrawOn(change flag: Bool) -> some View {
2021-10-23 11:51:02 +00:00
modifier(RedrawOnModifier(changeFlag: flag))
2021-09-25 08:18:22 +00:00
}
}