You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Special logic for keyPath having a optional target value. When the keyPath referencing a nil value, the newValue/oldValue should be in the form .some(nil) instead of .none
260
+
// Solve https://bugs.swift.org/browse/SR-6066
261
+
262
+
// NSNull is used by KVO to signal that the keyPath value is nil.
263
+
// If Value == Optional<T>.self, We will get nil instead of .some(nil) when casting Optional(<null>) directly.
264
+
// To fix this behavior, we will eliminate NSNull first, then cast the transformed value.
265
+
266
+
iflet unwrapped = changeValue {
267
+
// We use _castForKVO to cast first.
268
+
// If Value != Optional<NSNull>.self, the NSNull value will be eliminated.
0 commit comments