@@ -68,7 +68,7 @@ struct HookListPage: HookView {
68
68
let isOn = useState ( false )
69
69
let count = useState ( 0 )
70
70
71
- useEffect ( . prevented ( by: isOn. wrappedValue) ) {
71
+ useEffect ( . preserved ( by: isOn. wrappedValue) ) {
72
72
guard isOn. wrappedValue else { return nil }
73
73
74
74
let timer = Timer . scheduledTimer ( withTimeInterval: 0.3 , repeats: true ) { _ in
@@ -90,7 +90,7 @@ struct HookListPage: HookView {
90
90
let flag = useState ( false )
91
91
let random = useState ( 0 )
92
92
93
- useLayoutEffect ( . prevented ( by: flag. wrappedValue) ) {
93
+ useLayoutEffect ( . preserved ( by: flag. wrappedValue) ) {
94
94
random. wrappedValue = Int . random ( in: 0 ... 100000 )
95
95
return nil
96
96
}
@@ -106,7 +106,7 @@ struct HookListPage: HookView {
106
106
107
107
var useMemoRow : some View {
108
108
let flag = useState ( false )
109
- let randomColor = useMemo ( . prevented ( by: flag. wrappedValue) ) {
109
+ let randomColor = useMemo ( . preserved ( by: flag. wrappedValue) ) {
110
110
Color ( hue: . random( in: 0 ... 1 ) , saturation: 1 , brightness: 1 )
111
111
}
112
112
@@ -125,7 +125,7 @@ struct HookListPage: HookView {
125
125
let n2 = useRef ( 1 )
126
126
let fibonacci = useState ( 2 )
127
127
128
- useEffect ( . prevented ( by: flag. wrappedValue) ) {
128
+ useEffect ( . preserved ( by: flag. wrappedValue) ) {
129
129
n2. current = n1. current
130
130
n1. current = fibonacci. wrappedValue
131
131
fibonacci. wrappedValue = n1. current + n2. current
0 commit comments