1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 14:50:32 +05:30
yattee/Shared/Modifiers/RedrawOnModifier.swift
2021-10-23 13:52:48 +02:00

20 lines
400 B
Swift

import SwiftUI
struct RedrawOnModifier: 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(RedrawOnModifier(changeFlag: flag))
}
}