12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //
- // ChatApp.swift
- // Shared
- //
- // Created by Sergey Tarasov on 24.07.2022.
- //
- import SwiftUI
- import XMPPFramework
- @main
- struct ChatApp: App {
- var body: some Scene {
- WindowGroup {
- ContentView()
- .onAppear(perform: UIApplication.shared.addTapGestureRecognizer)
- }
- }
- }
- class AppDelegate: NSObject, UIApplicationDelegate {
- func application(
- _ application: UIApplication,
- didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
- ) -> Bool {
- DDLog.add(DDTTYLogger.sharedInstance!, with: DDLogLevel.all)
- return true
- }
- }
- extension UIApplication {
- func addTapGestureRecognizer() {
- guard let window = windows.first else { return }
- let tapGesture = UITapGestureRecognizer(target: window, action: #selector(UIView.endEditing))
- tapGesture.requiresExclusiveTouchType = false
- tapGesture.cancelsTouchesInView = false
- tapGesture.delegate = self
- window.addGestureRecognizer(tapGesture)
- }
- }
- extension UIApplication: UIGestureRecognizerDelegate {
- public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
- return false
- }
- }
|