Created
May 4, 2020 17:20
-
-
Save michzio/5cc4096a5becadd35da9871f0595fd16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct KeyboardAvoiderPreference: Equatable { | |
let tag: Int | |
let rect: CGRect | |
static func == (lhs: KeyboardAvoiderPreference, rhs: KeyboardAvoiderPreference) -> Bool { | |
print("y: \(lhs.rect.minY) vs \(rhs.rect.minY)") | |
return lhs.tag == rhs.tag && (lhs.rect.minY == rhs.rect.minY) | |
} | |
} | |
struct KeyboardAvoiderPreferenceKey: PreferenceKey { | |
typealias Value = [KeyboardAvoiderPreference] | |
static var defaultValue: [KeyboardAvoiderPreference] = [] | |
static func reduce(value: inout [KeyboardAvoiderPreference], nextValue: () -> [KeyboardAvoiderPreference]) { | |
value.append(contentsOf: nextValue()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment