yattee/Backports/ScrollDismissesKeyboard+Backport.swift

21 lines
572 B
Swift
Raw Normal View History

2022-08-17 15:34:25 +00:00
import Foundation
import SwiftUI
extension Backport where Content: View {
2023-02-06 20:51:57 +00:00
@ViewBuilder func scrollDismissesKeyboardImmediately() -> some View {
2022-08-17 15:34:25 +00:00
if #available(iOS 16.0, macOS 13.0, tvOS 16.0, *) {
content.scrollDismissesKeyboard(.immediately)
} else {
content
}
}
2023-02-06 20:51:57 +00:00
@ViewBuilder func scrollDismissesKeyboardInteractively() -> some View {
2023-02-25 15:42:18 +00:00
if #available(iOS 16.0, macOS 13.0, tvOS 16.0, *) {
content.scrollDismissesKeyboard(.interactively)
} else {
content
2023-02-06 20:51:57 +00:00
}
2023-02-25 15:42:18 +00:00
}
2022-08-17 15:34:25 +00:00
}