scale
3D Touch
// 定义一个枚举类型
enum Shortcut: String {
case openBlue = "OpenBlue"
}
// APP正在运行时,下面的方法会响应3D Touch操作
func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
completionHandler(handleQuickAction(shortcutItem))
}
// guard
guard let touch = touches.first else {
return
}
// 判断3D Touch是否可用
if traitCollection.forceTouchCapability == UIForceTouchCapability.available {}