I'm trying to use KVO pattern on scrollView's contentInset
and i need to know about old/new values. I know UIEdgeInests
is a struct hence can not be stored in Dictionary, but i receive it in changes. this is my change Dictionary:
Optional(["old": UIEdgeInsets: {0, 0, 100, 0}, "new": UIEdgeInsets: {64, 0, 149, 0}, "kind": 1])
and this is how i'm trying to cast it:
guard let oldValue = change?[NSKeyValueChangeOldKey] as? UIEdgeInsets,
newValue = change?[NSKeyValueChangeNewKey] as? UIEdgeInsets
else { return }
But always fails.
Any ideas how to cast it into UIEdgeInsets?