1
0
mirror of https://github.com/yattee/yattee.git synced 2025-01-06 01:20:31 +05:30
yattee/Shared/Modifiers/RedrawOnViewModifier.swift

20 lines
408 B
Swift
Raw Normal View History

2021-09-25 13:48:22 +05:30
import SwiftUI
struct RedrawOnViewModifier: ViewModifier {
@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 {
modifier(RedrawOnViewModifier(changeFlag: flag))
}
}