1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 06:40:32 +05:30
yattee/Shared/Modifiers/RedrawOnModifier.swift

20 lines
400 B
Swift
Raw Normal View History

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