Impressia/Vernissage/Extensions/View+Transition.swift

22 lines
554 B
Swift
Raw Normal View History

2023-01-13 21:11:30 +01:00
//
// https://mczachurski.dev
// Copyright © 2023 Marcin Czachurski and the repository contributors.
2023-03-28 10:35:38 +02:00
// Licensed under the Apache License 2.0.
2023-01-13 21:11:30 +01:00
//
2023-01-13 21:11:30 +01:00
import SwiftUI
extension View {
func withoutAnimation(action: @escaping () -> Void) {
var transaction = Transaction()
transaction.disablesAnimations = true
withTransaction(transaction) {
action()
}
}
2023-02-14 18:40:08 +01:00
func hideKeyboard() {
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
}
2023-01-13 21:11:30 +01:00
}