iOS 13.0废弃‘keyWindow‘的解决方法

let keyWindow = UIApplication.shared.connectedScenes
        .filter({$0.activationState == .foregroundActive})
        .map({$0 as? UIWindowScene})
        .compactMap({$0})
        .first?.windows
        .filter({$0.isKeyWindow}).first

使用: 

keyWindow?.endEditing(true)

 

你可能感兴趣的:(ios)