不要判断iOS 15+和处理器A12+,判断iOS 15的"实时文本"功能支持.创建一个带有以下判断的助手方法,该判断将返回设备是否支持实时文本
var isSupported = true
if #available(iOS 15.0, *) {
let check = UITextField().canPerformAction(#selector(UIResponder.captureTextFromCamera(_:)), withSender: nil)
isSupported = check
} else {
isSupported = false
}
print(isSupported)
如果设备具有iOS 15+但不具有硬件支持,则使用上述条件将返回false
.