{"id":391516,"date":"2024-06-29T09:52:03","date_gmt":"2024-06-29T09:52:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=391516"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=391516","title":{"rendered":"<span>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0436\u0435\u0441\u0442\u043e\u0432 \u0432 iOS<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f iOS \u0432\u0430\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0437\u043d\u0443\u0442\u0440\u0438. \u041f\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0438\u043d\u0444\u044b, \u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0432 \u043e\u0434\u043d\u0443. \u0427\u0442\u043e \u044f \u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b74\/9e6\/b9f\/b749e6b9f7cc4bfc4ba603a8e34b8d7d.png\" width=\"2254\" height=\"590\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b74\/9e6\/b9f\/b749e6b9f7cc4bfc4ba603a8e34b8d7d.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430:<\/strong><\/p>\n<ul>\n<li>\n<p>UIKit<\/p>\n<\/li>\n<li>\n<p>Responder Chain<\/p>\n<\/li>\n<li>\n<p>Main Event Loop<\/p>\n<\/li>\n<li>\n<p>Gesture Recognizers<\/p>\n<\/li>\n<li>\n<p>Hit testing<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0431\u043e\u0440 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u0435\u0439\u0441\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<h2>UIKit<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0432\u0430\u0448 UIKit? \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043a\u0443, \u0442\u043e \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0442\u0430\u043a\u0443\u044e \u0438\u043d\u0444\u0443:<\/p>\n<blockquote>\n<p><em>The UIKit framework provides the required infrastructure for your iOS or tvOS apps. It provides the window and view architecture for implementing your interface, the event handling infrastructure for delivering Multi-Touch and other types of input to your app, and the main run loop needed to manage interactions among the user, the system, and your app.<\/em><\/p>\n<\/blockquote>\n<p>\u0422\u0430\u043a. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0443\u0437\u043d\u0430\u043b\u0438, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043d\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043e\u043a\u043e\u043d \u0438 \u0432\u044c\u044e\u0448\u0435\u043a, \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<h4>UIApplication, UIWindow, UIView &#8212; \u043a\u0442\u043e, \u0437\u0430\u0447\u0435\u043c \u0438 \u043f\u043e\u0447\u0435\u043c\u0443?<\/h4>\n<p>\u041d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442 \u0441 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiapplication\" rel=\"noopener noreferrer nofollow\">UIApplication<\/a>. \u041a\u0430\u0436\u0434\u043e\u0435 iOS \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442 \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <strong>UIApplication<\/strong>. \u041e\u043d \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>UIApplicationDelegate<\/strong> \u0438\u043d\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u0445 (\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0435 \u0445\u0432\u0430\u0442\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f).<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f6e\/2bb\/6fc\/f6e2bb6fce5fc19680d3a6047dd8f7af.png\" width=\"300\" height=\"160\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f6e\/2bb\/6fc\/f6e2bb6fce5fc19680d3a6047dd8f7af.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043a\u043e\u0434\u0435. \u0415\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u044e\u0437\u0430\u043b\u0438 \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434\u044b, \u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. UIApplicationMain \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043b\u0438 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434\u044b. \u041e\u043d \u0437\u043d\u0430\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b main storyboard \u0438 \u043a\u0430\u043a\u043e\u0432\u043e \u0435\u0435 \u0438\u043c\u044f, \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u043a\u043b\u044e\u0447 Info.plist \u201cMain storyboard file base name\u201d (UIMainStoryboard- File)<\/p>\n<p>\u041d\u043e \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"swift\">\/\/ \u043e\u0442\u043c\u0435\u0447\u0430\u0435\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c @main \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 @main class MainAppDelegate: UIResponder, UIApplicationDelegate {     \/\/ \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043e\u043a\u043d\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0433\u043b\u0430\u0432\u043d\u044b\u043c.     var window: UIWindow?          \/\/ \u041c\u0435\u0442\u043e\u0434 UIApplicationDelegate. \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u043e\u0441\u044c     func application(         _ application: UIApplication,         didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?     ) -> Bool {         let window = UIWindow(frame: UIScreen.main.bounds) window.rootViewController = ViewController() \/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0432\u044c\u044e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440         window.makeKeyAndVisible() \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u044d\u0442\u043e \u043e\u043a\u043d\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c         self.window = window          return true     } }<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>UIApplicationMain \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 UIApplication \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u044d\u0442\u043e\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440. \u041a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0437\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 UIApplication.shared<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0437\u043d\u0430\u0435\u0442 \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u043a\u043b\u0430\u0441\u0441, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043c\u0435\u0442\u0438\u043b\u0438 \u0435\u0433\u043e <strong>@main<\/strong> (\u0432 \u0440\u0430\u043d\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 @<strong>UIApplicationMain<\/strong>)<\/p>\n<\/li>\n<li>\n<p>UIApplicationMain \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0443 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434 <strong>application(_:didFinish- LaunchingWithOptions:)<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u041d\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0435\u0433\u043e window \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u043e\u043a\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0424\u0443\u043d\u043a\u0446\u0438\u044f <strong>makeKeyAndVisible <\/strong>\u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c<\/p>\n<\/li>\n<\/ul>\n<p><em>\u041d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 iOS 13, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 AppDelegate \u0431\u044b\u043b\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043c\u0435\u0436\u0434\u0443 AppDelegate \u0438 SceneDelegate. \u042d\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043c\u043d\u043e\u0433\u043e\u043e\u043a\u043e\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0432 \u041e\u0421 iPad, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 AppDelegate \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438.<\/em><\/p>\n<ul>\n<li>\n<p>UIApplicationMain \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0443 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434 <strong>application(_:didFinish- LaunchingWithOptions:)<\/strong>.<\/p>\n<\/li>\n<li>\n<p><strong>UIApplicationMain<\/strong> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 <strong>UISceneSession<\/strong>, <strong>UIWindowScene<\/strong> \u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u043c \u0441\u0446\u0435\u043d\u044b \u043e\u043a\u043d\u0430<\/p>\n<\/li>\n<li>\n<p>\u0412 Info.plist \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c (\u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438) \u043a\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u043c <\/p>\n<\/li>\n<li>\n<p>UIApplicationMain \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043b\u0438 \u0432\u0430\u0448\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0446\u0435\u043d\u0430 \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434\u044b. (\u0412 Info.plist \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u043c\u044f \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434\u0430)<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0446\u0435\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434, \u0442\u043e UIApplicationMain \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 UIWindow \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0435\u0433\u043e \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u043c \u0441\u0446\u0435\u043d\u044b.<\/p>\n<\/li>\n<li>\n<p>UIApplicationMain \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 UIWindow <strong>makeKeyAndVisible<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0435 \u0441\u0446\u0435\u043d\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <strong>scene(_:willConnectTo:options:)<\/strong><\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u041d\u0435 \u043e\u0436\u0438\u0434\u0430\u0439\u0442\u0435, \u0447\u0442\u043e window \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e. \u0415\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043e\u043a\u043d\u0430 <strong>UITextEffectsWindow<\/strong> \u0438 <strong>UIRemoteKeyboardWindow<\/strong>.<\/p>\n<\/blockquote>\n<p>\u041e\u043a\u0435\u0439. \u041c\u044b \u0432\u0440\u043e\u0434\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u0441\u0435\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041d\u043e \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u044d\u0442\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043a\u0430\u043a \u043e\u043d\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442?<\/p>\n<p>\u0417\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c. \u042d\u0442\u043e <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uievent\" rel=\"noopener noreferrer nofollow\">UIEvent<\/a>. \u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043d\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041a\u043e\u0433\u0434\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u0442\u0430\u043a\u043e\u0435 \u043a\u0430\u043a \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043a \u044d\u043a\u0440\u0430\u043d\u0443, UIKit \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b UIEvent \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 (main event loop), \u0432\u044b\u0437\u044b\u0432\u0430\u044f <strong>UIApplication.shared.sendEvent()<\/strong>. <\/p>\n<h4>UITouch<\/h4>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 UIEvent \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 UITouch. \u0414\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 UITouch \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u0432\u0435\u0449\u0438. \u041e\u043d\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0444\u0430\u0437\u0430\u043c\u0438 \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c <strong>var phase<\/strong>: <strong>UITouch.Phase:<\/strong><\/p>\n<ul>\n<li>\n<p>.<strong>began<\/strong> \u2014 \u041f\u0430\u043b\u0435\u0446 \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043a\u043e\u0441\u043d\u0443\u043b\u0441\u044f \u044d\u043a\u0440\u0430\u043d\u0430; \u044d\u0442\u043e\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 UITouch \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d. \u042d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0435\u0440\u0432\u0430\u044f \u0444\u0430\u0437\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p>.<strong>moved <\/strong>\u2014 \u041f\u0430\u043b\u0435\u0446 \u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u044d\u043a\u0440\u0430\u043d\u0443.<\/p>\n<\/li>\n<li>\n<p>.<strong>stationary <\/strong>\u2014 \u041f\u0430\u043b\u0435\u0446 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043d\u0435\u043f\u043e\u0434\u0432\u0438\u0436\u043d\u043e. \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e? \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 UITouch \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d, \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0431\u044b\u0432\u0430\u0435\u0442 UIEvent \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u0442\u0430\u0447. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 UIEvent \u043f\u0440\u0438\u0431\u044b\u0432\u0430\u0435\u0442 \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u043b\u0435\u0446 \u043a\u043e\u0441\u043d\u0443\u043b\u0441\u044f \u044d\u043a\u0440\u0430\u043d\u0430), UIEvent \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043f\u0430\u043b\u0435\u0446 \u0434\u0435\u043b\u0430\u043b, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u043b<\/p>\n<\/li>\n<li>\n<p><strong>.ended <\/strong>\u2014 \u041f\u0430\u043b\u0435\u0446 \u043f\u043e\u043a\u0438\u043d\u0443\u043b \u044d\u043a\u0440\u0430\u043d. \u041a\u0430\u043a \u0438 .began, \u044d\u0442\u0430 \u0444\u0430\u0437\u0430 \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u042d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 UITouch \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u0442 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 UIEvents \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u0442\u0430\u0447\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u0438\u0445 4\u0445 \u0444\u0430\u0437 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0430\u043b\u044c\u0446\u0430. \u041d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u0444\u0430\u0437\u0430:<\/p>\n<ul>\n<li>\n<p>.<strong>cancelled <\/strong>\u2014 \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0440\u0435\u0440\u0432\u0430\u043b\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u0443\u043b\u044c\u0442\u0438\u0442\u0430\u0447\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u0435\u0440\u0432\u0430\u043b\u043e \u0435\u0435.<strong> <\/strong>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0436\u0430\u043b \u043a\u043d\u043e\u043f\u043a\u0443 \u00ab\u0414\u043e\u043c\u043e\u0439\u00bb \u0438\u043b\u0438 \u043a\u043d\u043e\u043f\u043a\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<p><strong>UITouch<\/strong> \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<ul>\n<li>\n<p><strong>location(in:), previousLocation(in:) <\/strong>\u2014 \u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 view.<\/p>\n<\/li>\n<li>\n<p><strong>timestamp <\/strong>\u2014 \u041a\u043e\u0433\u0434\u0430 \u0442\u0430\u0447 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0440\u0430\u0437 \u043c\u0435\u043d\u044f\u043b\u0441\u044f. \u041f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u043a\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f (.began) \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f (.moved)<\/p>\n<\/li>\n<li>\n<p><strong>tapCount <\/strong>\u2014 \u0415\u0441\u043b\u0438 \u0434\u0432\u0430 \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u043c\u0435\u0441\u0442\u0435 \u0432 \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430 \u043f\u0435\u0440\u0432\u043e\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435, \u0432\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e. \u042d\u0442\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043d\u043e \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 tapCount \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0443 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e<\/p>\n<\/li>\n<li>\n<p><strong>view <\/strong>\u2014 \u0432\u044c\u044e\u0448\u043a\u0430, c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u044d\u0442\u043e \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u0433\u0434\u0430 UITouch \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f (.began), \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0441 \u043a\u0430\u043a\u0438\u043c UIView \u043e\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e. (\u041f\u043e\u0437\u0436\u0435 \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442). \u0417\u0430\u0442\u0435\u043c \u044d\u0442\u043e \u0436\u0435 UIView \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e var view \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0438\u043c. C \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u044d\u0442\u043e\u0442 UITouch \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u044d\u0442\u0438\u043c view (\u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u044d\u0442\u043e\u0442 \u043f\u0430\u043b\u0435\u0446 \u043d\u0435 \u043f\u043e\u043a\u0438\u043d\u0435\u0442 \u044d\u043a\u0440\u0430\u043d).<\/p>\n<h2>Main Event Loop<\/h2>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043e\u043d \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 window, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435. Window \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0432 view, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c<\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/463\/991\/6cf\/4639916cf7ec9b815a4217a2988d09e7.png\" width=\"500\" height=\"278\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/463\/991\/6cf\/4639916cf7ec9b815a4217a2988d09e7.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u043e\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 UI \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u042d\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 window \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u0432\u044c\u044e\u0448\u0435\u043a.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043e\u043d \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 window, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435. Window \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0432 view, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c<\/p>\n<p>\u041e\u043a\u0435\u0439. \u0412\u0440\u043e\u0434\u0435 \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041c\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u043f\u0440\u043e \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0443\u0437\u043d\u0430\u043b\u0438 \u043e \u0441\u0430\u043c\u0438\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u0445. \u041d\u043e \u043a\u0430\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0434\u043e\u0445\u043e\u0434\u044f\u0442 \u0434\u043e \u0442\u043e\u0447\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f?<\/p>\n<h2>Responder Chain<\/h2>\n<p>\u042d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiresponder\" rel=\"noopener noreferrer nofollow\">UIResponder<\/a> \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u0430\u043c\u0438 (UIApplication, UIWindow, UIViewController, UIView).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b9c\/095\/053\/b9c095053f2ce3f9f294bd667169f26c.png\" width=\"644\" height=\"283\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b9c\/095\/053\/b9c095053f2ce3f9f294bd667169f26c.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u0447\u0442\u043e \u043e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u043c \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u043e\u043c <\/p>\n<p>\u0420\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0438 \u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043b\u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u0441\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443-\u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u043d\u0442\u0443. \u041f\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0441\u043f\u0438\u0441\u043a\u0443 \u043e\u0442 \u0440\u0435\u043f\u043e\u043d\u0434\u0435\u0440\u0430 \u043a \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u0443.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d1a\/219\/4bd\/d1a2194bdcefde540cf1a1a3d884460f.png\" width=\"1304\" height=\"790\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d1a\/219\/4bd\/d1a2194bdcefde540cf1a1a3d884460f.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0438 \u0438\u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438, \u043e\u043d \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u00ab\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u0443\u00bb.  \u0415\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u043d\u0442\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043e\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u0443 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435. \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u0442\u0441\u044f \u0432\u0432\u0435\u0440\u0445 \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043e. \u0415\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ec5\/a3f\/0ca\/ec5a3f0caa86ad00aea4a480527bd7ac.png\" width=\"1319\" height=\"773\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ec5\/a3f\/0ca\/ec5a3f0caa86ad00aea4a480527bd7ac.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0423 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u0430 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439:<\/p>\n<ul>\n<li>\n<p><strong>touchesBegan(_:with:)<\/strong> \u2014 \u0432\u043e view \u0438\u043b\u0438 window \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043e\u0434\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u044b\u0445 \u043a\u0430\u0441\u0430\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>touchesMoved(_:with:) <\/strong>\u2014 <em>\u0421\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u043d\u0442\u0443, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u0441\u0430\u043d\u0438\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c, \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c.<\/em><\/p>\n<\/li>\n<li>\n<p><strong>touchesEnded(_:with:) <\/strong>\u2014 \u0421\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u043d\u0442\u0443, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043b\u044c\u0446\u0435\u0432 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u0432\u0438\u0434\u0430 \u0438\u043b\u0438 \u043e\u043a\u043d\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>touchesCancelled(_:with:) \u2014 <\/strong>\u0421\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u043d\u0442\u0443, \u043a\u043e\u0433\u0434\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435) \u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0441\u0430\u043d\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<p>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><strong>touches: Set&lt;UITouch><\/strong> \u2014 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u0432\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u043a\u0430\u0441\u0430\u043d\u0438\u0435, \u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0435\u0433\u043e. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u043c\u043d\u043e\u0433\u043e \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f first \u043c\u0435\u0442\u043e\u0434 (\u043d\u0430\u0431\u043e\u0440 \u043d\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0430\u043a\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432\u044b\u0431\u0435\u0440\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e).<\/p>\n<\/li>\n<li>\n<p><strong>event: UIEvent?<\/strong> \u2014 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u0430 UIEvent<\/p>\n<\/li>\n<\/ul>\n<h2>Gesture Recognizer<\/h2>\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0436\u0435\u0441\u0442\u043e\u0432 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c. \u0415\u0449\u0435 \u0441\u043b\u043e\u0436\u043d\u0435\u0439, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0436\u0435\u0441\u0442\u043e\u0432. \u0420\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f Gesture Recognizers (\u0441\u0443\u0431\u043a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uigesturerecognizer\" rel=\"noopener noreferrer nofollow\">UIGestureRecognizer<\/a>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u0443\u044e\u0442 \u043e\u0431\u0449\u0438\u0435 \u0436\u0435\u0441\u0442\u044b \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u0438 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0436\u0435\u0441\u0442\u043e\u0432 \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0436\u0435\u0441\u0442\u043e\u0432 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441 UIView \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u044e \u043a\u0430\u0441\u0430\u043d\u0438\u044f.<\/p>\n<p>Gesture Recognizer \u2014 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442, \u0437\u0430\u0434\u0430\u0447\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u0443\u043b\u044c\u0442\u0438\u0442\u0430\u0447 \u043f\u0440\u0438\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 \u0436\u0435\u0441\u0442\u0430. \u041e\u043d \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u0435\u043d \u043a UIView. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u0438:<\/p>\n<ul>\n<li>\n<p>addGestureRecognizer(_:)<\/p>\n<\/li>\n<li>\n<p>removeGestureRecognizer(_:)<\/p>\n<\/li>\n<\/ul>\n<p>UIGestureRecognizer \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0447\u0435\u0442\u044b\u0440\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u043a\u0430\u0441\u0430\u043d\u0438\u044f, \u043d\u043e \u043e\u043d \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u043e\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 responder chain.<\/p>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0441\u0435 \u0436\u0435\u0441\u0442\u044b.<\/p>\n<p>\u0412 \u043a\u0435\u0439\u0441\u0435 \u043d\u0438\u0436\u0435 \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c \u0436\u0435\u0441\u0442\u043e\u0432, \u0432\u044c\u044e\u0445\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0432 \u043b\u044e\u0431\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043e\u0434\u043d\u0438\u043c \u043f\u0430\u043b\u044c\u0446\u0435\u043c.<\/p>\n<pre><code class=\"swift\">func viewDidLoad {     super.viewDidLoad()     let p = UIPanGestureRecognizer(target:self, action:#selector(dragging))     self.v.addGestureRecognizer(p) }      @objc func dragging(_ p : UIPanGestureRecognizer) {   let v = p.view!     switch p.state {     case .began, .changed:         let delta = p.translation(in:v.superview)         var c = v.center         c.x += delta.x; c.y += delta.y         v.center = c         p.setTranslation(.zero, in: v.superview)     default: break   } }<\/code><\/pre>\n<p>Window \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0436\u0435\u0441\u0442\u043e\u0432, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043e\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u0432 hit-testing view<\/p>\n<h2>\u0417\u0430\u043a\u0440\u0435\u043f\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439<\/h2>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u043c \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0443 \u0442\u0430\u0447\u0435\u0439 \u043e\u0442 \u0442\u043e\u0447\u043a\u0438 \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0434\u043e \u0442\u043e\u0447\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u043e\u0435 \u043a\u0430\u0441\u0430\u043d\u0438\u0435, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430\u0436\u0430\u0442\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c view, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u0443\u043b\u0438\u0441\u044c. \u042d\u0442\u043e view \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u044d\u0442\u0438\u043c \u043a\u0430\u0441\u0430\u043d\u0438\u0435\u043c \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f <strong>hit-test view<\/strong><\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u0440\u0443\u0433\u043e\u0435 \u043a\u0430\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 sendEvent(<em>:), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 sendEvent(<\/em>\ud83d\ude42 \u043e\u043a\u043d\u0430 (window). Window \u043f\u0440\u043e\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043f\u0443\u0442\u044c \u043a \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u044e<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u043e \u043a\u0430\u043a \u044d\u0442\u043e\u0442 \u043f\u0443\u0442\u044c \u043f\u0440\u043e\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f?<\/p>\n<h2>Hit-Testing<\/h2>\n<p>Hit Testing \u2014 \u044d\u0442\u043e \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0441\u0440\u0435\u0434\u0438 \u0432\u0441\u0435\u0439 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0432\u044c\u044e\u0445 \u043a \u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u0443\u043b\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c. iOS \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 UIView \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u0434\u043d\u0435\u0439 \u0432\u044c\u044e\u0448\u043a\u043e\u0439 \u043f\u043e\u0434 \u043f\u0430\u043b\u044c\u0446\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043a\u0430\u0441\u0430\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5a3\/738\/7dd\/5a37387dd18dcf0014c4f02ffa6008ce.png\" width=\"1241\" height=\"1452\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5a3\/738\/7dd\/5a37387dd18dcf0014c4f02ffa6008ce.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u0432\u044b\u0448\u0435 hit-testing \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043f\u0430\u043b\u0435\u0446 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u044d\u043a\u0440\u0430\u043d\u0430. \u0418 \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0436\u0435\u0441\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 UIEvent, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043a\u0430\u0441\u0430\u043d\u0438\u0435. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f UIView \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f firstResponder.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 hitTest(_: with \ud83d\ude42 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0432\u044c\u044e\u0445\u0438. \u0415\u0441\u043b\u0438 <strong>isUserInteractionEnabled<\/strong> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 false, \u0438\u043b\u0438 \u0435\u0433\u043e <strong>isHidden<\/strong> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 true, \u0438\u043b\u0438 \u0435\u0433\u043e <strong>alpha<\/strong> \u0431\u043b\u0438\u0437\u043a\u0430 \u043a 0,0, \u0442\u043e hitTest \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 nil, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043d\u0438 \u044d\u0442\u0430 \u0432\u044c\u044e\u0445\u0430, \u043d\u0438 \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0437 \u0435\u0451 \u0441\u0430\u0431\u0432\u044c\u044e\u0445 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u044c\u044e\u0445\u043e\u0439 \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <strong>hitTest. <\/strong><\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0443 UIApplication \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u0430 sendEvent (_ :). \u0430 UIApplication, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0435\u0433\u043e UIWindow, \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0435\u0433\u043e sendEvent (_ :). \u0417\u0430\u0442\u0435\u043c UIWindow \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0430\u0447\u0430 \u0435\u0433\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0432\u044c\u044e\u0448\u0435\u043a <\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"swift\">class CustomWindow: UIWindow {     var childSubviews = [UIView]()          override func sendEvent(_ event: UIEvent) {         guard let touches = event.allTouches, let touch = touches.first else {             return         }                  let firstResponder: UIResponder = chHitTest(point: touch.location(in: self), with: event) ?? self                  switch touch.phase {         case .began:             firstResponder.touchesBegan(touches, with: event)         case .moved:             firstResponder.touchesMoved(touches, with: event)         case .ended:             firstResponder.touchesEnded(touches, with: event)         default:             break         }     }          private func childHitTest(point: CGPoint, with event: UIEvent?) -> UIView? { if self.isHidden || !self.isUserInteractionEnabled ||  self.alpha &lt;= 0.01 else {         return nil     }         for subview in childSubviews {             if subview.frame.contains(point) {                 let nextPoint = subview.layer.convert(point, to: layer)                                  return subview.hitTest(point: nextPoint, with: event)             }         }                  return nil     } }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 <a href=\"http:\/\/smnh.me\/hit-testing-in-ios\/\" rel=\"noopener noreferrer nofollow\">\u043d\u0430\u0448\u0435\u043b<\/a> \u0441\u0445\u0435\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043b\u043e\u0433\u0438\u043a\u0443 hit testing&#8217;\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2c3\/838\/8da\/2c38388da2e01a44d3df0d50cee7624d.png\" width=\"846\" height=\"944\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2c3\/838\/8da\/2c38388da2e01a44d3df0d50cee7624d.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0420\u0430\u0437\u0431\u043e\u0440 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u0435\u0439\u0441\u043e\u0432<\/h2>\n<h4>1. \u041a\u0435\u0439\u0441 \u0441 \u0432\u044b\u043f\u0438\u0440\u0430\u044e\u0449\u0435\u0439 \u0432\u044c\u044e\u0445\u043e\u0439<\/h4>\n<p>\u041a\u0435\u0439\u0441 \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439. \u041e \u043d\u0435\u043c \u043f\u0438\u0441\u0430\u043b \u044f\u043d\u0434\u0435\u043a\u0441 \u0438 \u043c\u043d\u043e\u0433\u043e \u0440\u0435\u0431\u044f\u0442 \u043d\u0430 \u0437\u0430\u043f\u0430\u0434\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445.<\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u043f\u0440\u043e\u0441\u0442\u0430\u044f. \u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0430\u0436\u043c\u0435\u043c \u043d\u0430 \u0432\u044b\u043f\u0438\u0440\u0430\u044e\u0449\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u044c\u044e\u0445\u0438 C?<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/66f\/7a1\/c9e\/66f7a1c9e0ed7325c770e9216762cebe.png\" width=\"582\" height=\"590\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/66f\/7a1\/c9e\/66f7a1c9e0ed7325c770e9216762cebe.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0434\u043e\u043a\u0443, \u0442\u043e \u043e\u0442\u0432\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c<\/p>\n<blockquote>\n<p>If a touch location is outside of a view\u2019s bounds, the hitTest(_:with:) method ignores that view and all of its subviews. As a result, when a view\u2019s clipsToBounds property is false, subviews outside of that view\u2019s bounds are not returned even if they happen to contain the touch.<\/p>\n<\/blockquote>\n<p>Touch \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u0432\u044c\u044e B. \u0415\u0433\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u0435\u0451 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0441\u0430\u043c\u043e\u0439 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0439 \u0432\u044c\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u043c\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u0438\u0435, \u0431\u0443\u0434\u0435\u0442 view A.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u044c\u044e \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u043e\u0434<\/p>\n<pre><code class=\"swift\">override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {     \/\/ 1.      if let viewAvailable = findPointsInsideView(parent: self, point: point, event: event) {         return viewAvailable     }     \/\/ 2.      if self.point(inside: point, with: event) {         return self     }          return nil }<\/code><\/pre>\n<ol>\n<li>\n<p>\u041c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u043f\u043e\u0438\u043d\u0442\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u043b\u044e\u0431\u044b\u0445 \u0438\u0437 \u0441\u0430\u0431\u0432\u044c\u044e\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0443\u043f\u0435\u0440\u0432\u044c\u044e\u0445\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0438 \u043e\u0434\u043d\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443, \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u044d\u0442\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u0441\u0430\u0431\u0432\u044c\u044e\u0445\u0438, \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u043b\u0438 \u043f\u043e\u0438\u043d\u0442\u044b \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0438\u0437 \u0441\u0443\u043f\u0435\u0440\u0432\u044c\u044e\u0445.<\/p>\n<pre><code class=\"swift\">private func findPointsInsideView(parent: UIView, point: CGPoint, event: UIEvent?) -> UIView? {     let allChilds = parent.subviews      guard allChilds.count > 0 else {         return nil     }      for chilView in allChilds.reversed() {         let modifiedPoint = parent.convert(point, to: chilView)         if chilView.point(inside: modifiedPoint, with: event){             if let foundView = findPointsInsideView(parent: chilView, point: modifiedPoint, event: event) {                 return foundView             } else {                 return chilView             }         }     }          return nil }<\/code><\/pre>\n<h4>2. \u041a\u0435\u0439\u0441 \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043a\u043d\u043e\u043f\u043a\u0438<\/h4>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438 &#171;\u0425&#187;. \u041f\u0440\u0438\u0448\u0435\u043b \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440 \u0438 \u0441\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u044d\u0442\u0443 \u0432\u044c\u044e\u0448\u043a\u0443. \u0418 \u043d\u0443\u0436\u043d\u043e, \u043d\u0435 \u043c\u0435\u043d\u044f\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043d\u0430\u0436\u0430\u0442\u0438\u044f. \u0422\u0430\u0447 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0432 \u043a\u0440\u0430\u0441\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u0430 UIButton \u0434\u043e\u043b\u0436\u0435\u043d \u044d\u0442\u043e \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u0438\u0442\u044c <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3a1\/bf3\/6b6\/3a1bf36b699887ef2bed06962e456239.png\" width=\"582\" height=\"590\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3a1\/bf3\/6b6\/3a1bf36b699887ef2bed06962e456239.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0440\u0438 \u0442\u0430\u043f\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 pont(inside:):<\/p>\n<pre><code class=\"swift\">override func point(inside point: CGPoint, with _: UIEvent?) -> Bool {     let margin: CGFloat = 55     let area = self.bounds.insetBy(dx: -margin, dy: -margin)     return area.contains(point) }<\/code><\/pre>\n<h4>3. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \u0432\u044b\u0440\u0435\u0437\u0430\u043d\u043d\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u0434\u044b\u0440\u043a\u043e\u0439<\/h4>\n<p>\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0438\u043d\u0435\u0439 \u0432\u044c\u044e\u0448\u043a\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0438\u0441\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0432\u044c\u044e\u0448\u0435\u043a, \u043f\u043e\u0434 \u043d\u0435\u0439 \u043b\u0435\u0436\u0430\u0449\u0438\u0445? <\/p>\n<p>\u0423\u0441\u043b\u043e\u0432\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u2014 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0435\u043b\u0435\u043d\u043e\u0439 \u0438\u043b\u0438 \u0436\u0435\u043b\u0442\u043e\u0439 \u0432\u044c\u044e\u0448\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0446\u0435\u043d\u0442\u0440\u0435 \u0441\u0438\u043d\u0435\u0439  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/254\/548\/38b\/25454838b35efb50b4c4811dc3a7249f.png\" width=\"582\" height=\"590\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/254\/548\/38b\/25454838b35efb50b4c4811dc3a7249f.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0442\u0432\u0435\u0442 \u0432 \u043a\u043e\u0434\u0435:<\/p>\n<pre><code class=\"swift\">override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {   for subview in subviews {       if subview.frame.contains(point) {           let nextPoint = subview.layer.convert(point, to: layer)            return subview.hitTest(nextPoint, with: event)       }   }    return self }<\/code><\/pre>\n<h4>4. \u041f\u0440\u043e\u0445\u043e\u0434 hitTest \u043f\u043e \u0441\u043b\u043e\u044f\u043c<\/h4>\n<p>\u041a\u0430\u043a \u043c\u044b \u0437\u043d\u0430\u0435\u043c hitTest \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0432\u044c\u044e\u0448\u043a\u0430\u043c\u0438. \u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u0430\u043a.<\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434<\/p>\n<pre><code class=\"swift\">let view1 = UIView(frame: CGRect(x: 100, y: 100, width: 200, height: 200)) view1.backgroundColor = .white let layer = CALayer() layer.backgroundColor = UIColor.green.cgColor layer.frame = CGRect(x: 40, y: 10, width: 50, height: 50) view1.layer.addSublayer(layer)  let layer2 = CALayer() layer2.backgroundColor = UIColor.red.cgColor layer2.frame = CGRect(x: 10, y: 50, width: 50, height: 50) view1.layer.addSublayer(layer2)  let layer3 = CustomBlueLayer() layer3.backgroundColor = UIColor.blue.cgColor layer3.frame = CGRect(x: 60, y: 90, width: 50, height: 50) view1.layer.addSublayer(layer3)  view.addSubview(view1)<\/code><\/pre>\n<p>\u0415\u0441\u0442\u044c 1 \u0432\u044c\u044e\u0448\u043a\u0430 \u0438 \u0432 \u043d\u0435\u0439 3 \u0441\u043b\u043e\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/921\/67f\/7a3\/92167f7a36f661cde44c2ca4ffc95e9d.png\" width=\"582\" height=\"590\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/921\/67f\/7a3\/92167f7a36f661cde44c2ca4ffc95e9d.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u044f \u0437\u0430\u0445\u043e\u0447\u0443 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043b\u043e\u0435\u0432 \u043f\u0440\u0438 \u0442\u0430\u0447\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c hitTest UIWindow, \u0447\u0442\u043e\u0431\u044b \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043b\u043e\u0435\u0432 \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0441\u044f<\/p>\n<pre><code class=\"swift\">extension UIWindow {     open override func hitTest(_ point: CGPoint, with e: UIEvent?) -> UIView? {         let lay = self.layer.hitTest(point)                  if lay is CustomBlueLayer {             lay?.transform = CATransform3DScale(lay!.transform, 1.1, 1.1, 1.1)         }              return super.hitTest(point, with:e)     } }<\/code><\/pre>\n<p>\u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 hitTest UIWindow \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0430\u0448\u0438\u0445 \u0441\u043b\u043e\u0435\u0432 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/252\/0a2\/142\/2520a2142583466bdfeda81ddbf5ff88.png\" width=\"582\" height=\"590\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/252\/0a2\/142\/2520a2142583466bdfeda81ddbf5ff88.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418\u0442\u043e\u0433\u043e, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u0431\u0449\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u0441\u0442\u0430\u0442\u0435\u0439 \u0438 \u0434\u043e\u043a, \u0430 \u0442\u043a\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445 \u0441\u0430\u043c. \u0421\u043e\u0433\u043b\u0430\u0448\u0443\u0441\u044c, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u043a\u0435\u0439\u0441\u043e\u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435, \u043d\u043e \u0432\u0441\u0435 \u0436\u0435 \u0437\u043d\u0430\u0442\u044c, \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043f\u043e\u043b\u0435\u0437\u043d\u043e.<\/p>\n<h2>\u0420\u0435\u0441\u0443\u0440\u0441\u044b<\/h2>\n<ul>\n<li>\n<p><a href=\"http:\/\/smnh.me\/hit-testing-in-ios\/\" rel=\"noopener noreferrer nofollow\">http:\/\/smnh.me\/hit-testing-in-ios\/<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/iosdev12.blogspot.com\/2020\/09\/hittest-ios-identify-view-being-hit.html\" rel=\"noopener noreferrer nofollow\">https:\/\/iosdev12.blogspot.com\/2020\/09\/hittest-ios-identify-view-being-hit.html<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/General\/Conceptual\/Devpedia-CocoaApp\/EventHandlingiPhone.html#\/\/apple_ref\/doc\/uid\/TP40009071-CH13-SW1\" rel=\"noopener noreferrer nofollow\">https:\/\/developer.apple.com\/library\/archive\/documentation\/General\/Conceptual\/Devpedia-CocoaApp\/EventHandlingiPhone.html#\/\/apple_ref\/doc\/uid\/TP40009071-CH13-SW1<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/useyourloaf.com\/blog\/what-does-main-do-in-swift-5.3\/\" rel=\"noopener noreferrer nofollow\">https:\/\/useyourloaf.com\/blog\/what-does-main-do-in-swift-5.3\/<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/medium.com\/@kalyan.parise\/understanding-scene-delegate-app-delegate-7503d48c5445\" rel=\"noopener noreferrer nofollow\">https:\/\/medium.com\/@kalyan.parise\/understanding-scene-delegate-app-delegate-7503d48c5445<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/swiftrocks.com\/understanding-the-ios-responder-chain.html\" rel=\"noopener noreferrer nofollow\">https:\/\/swiftrocks.com\/understanding-the-ios-responder-chain.html<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.hackingwithswift.com\/example-code\/system\/what-is-the-first-responder\" rel=\"noopener noreferrer nofollow\">https:\/\/www.hackingwithswift.com\/example-code\/system\/what-is-the-first-responder<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0426\u0438\u043a\u043b \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0442 \u044f\u043d\u0434\u0435\u043a\u0441\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/medium.com\/yandex-maps-mobile\/tooltip-menu-for-every-view-1aede0d4d3e7\" rel=\"noopener noreferrer nofollow\">https:\/\/medium.com\/yandex-maps-mobile\/tooltip-menu-for-every-view-1aede0d4d3e7<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/medium.com\/yandex-maps-mobile\/%D0%B4%D0%B5%D1%80%D0%B6%D0%B8%D0%BC-%D1%83%D0%B4%D0%B0%D1%80-%D1%81-hittest-542653d51a8c\" rel=\"noopener noreferrer nofollow\">https:\/\/medium.com\/yandex-maps-mobile\/\u0434\u0435\u0440\u0436\u0438\u043c-\u0443\u0434\u0430\u0440-\u0441-hittest-542653d51a8c<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u0442\u0430\u043a\u0436\u0435 \u043d\u0430 \u043c\u043e\u0439 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043a\u0430\u043d\u0430\u043b, \u0433\u0434\u0435 \u044f \u0434\u0435\u043b\u044e\u0441\u044c \u0432\u0441\u044f\u043a\u0438\u043c\u0438 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u043c\u0438))<\/p>\n<p><a href=\"https:\/\/t.me\/iosmakemecry\" rel=\"noopener noreferrer nofollow\">https:\/\/t.me\/iosmakemecry<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/584100\/\"> https:\/\/habr.com\/ru\/articles\/584100\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0434\u043b\u044f iOS \u0432\u0430\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0437\u043d\u0443\u0442\u0440\u0438. \u041f\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439 \u0438\u043d\u0444\u044b, \u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0432 \u043e\u0434\u043d\u0443. \u0427\u0442\u043e \u044f \u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p><strong>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430:<\/strong><\/p>\n<ul>\n<li>\n<p>UIKit<\/p>\n<\/li>\n<li>\n<p>Responder Chain<\/p>\n<\/li>\n<li>\n<p>Main Event Loop<\/p>\n<\/li>\n<li>\n<p>Gesture Recognizers<\/p>\n<\/li>\n<li>\n<p>Hit testing<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0431\u043e\u0440 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u0435\u0439\u0441\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<h2>UIKit<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e. \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0432\u0430\u0448 UIKit? \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043a\u0443, \u0442\u043e \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0442\u0430\u043a\u0443\u044e \u0438\u043d\u0444\u0443:<\/p>\n<blockquote>\n<p><em>The UIKit framework provides the required infrastructure for your iOS or tvOS apps. It provides the window and view architecture for implementing your interface, the event handling infrastructure for delivering Multi-Touch and other types of input to your app, and the main run loop needed to manage interactions among the user, the system, and your app.<\/em><\/p>\n<\/blockquote>\n<p>\u0422\u0430\u043a. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0443\u0437\u043d\u0430\u043b\u0438, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043d\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u043e\u043a\u043e\u043d \u0438 \u0432\u044c\u044e\u0448\u0435\u043a, \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043c\u0441\u044f \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<h4>UIApplication, UIWindow, UIView &#8212; \u043a\u0442\u043e, \u0437\u0430\u0447\u0435\u043c \u0438 \u043f\u043e\u0447\u0435\u043c\u0443?<\/h4>\n<p>\u041d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u0442\u0443\u0435\u0442 \u0441 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiapplication\" rel=\"noopener noreferrer nofollow\">UIApplication<\/a>. \u041a\u0430\u0436\u0434\u043e\u0435 iOS \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442 \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <strong>UIApplication<\/strong>. \u041e\u043d \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>UIApplicationDelegate<\/strong> \u0438\u043d\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u0445 (\u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0435 \u0445\u0432\u0430\u0442\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f).<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043a\u043e\u0434\u0435. \u0415\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u044e\u0437\u0430\u043b\u0438 \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434\u044b, \u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. UIApplicationMain \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043b\u0438 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434\u044b. \u041e\u043d \u0437\u043d\u0430\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b main storyboard \u0438 \u043a\u0430\u043a\u043e\u0432\u043e \u0435\u0435 \u0438\u043c\u044f, \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u043a\u043b\u044e\u0447 Info.plist \u201cMain storyboard file base name\u201d (UIMainStoryboard- File)<\/p>\n<p>\u041d\u043e \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"swift\">\/\/ \u043e\u0442\u043c\u0435\u0447\u0430\u0435\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c @main \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0432\u0445\u043e\u0434\u0430 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 @main class MainAppDelegate: UIResponder, UIApplicationDelegate {     \/\/ \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043e\u043a\u043d\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0433\u043b\u0430\u0432\u043d\u044b\u043c.     var window: UIWindow?          \/\/ \u041c\u0435\u0442\u043e\u0434 UIApplicationDelegate. \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u043e\u0441\u044c     func application(         _ application: UIApplication,         didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?     ) -> Bool {         let window = UIWindow(frame: UIScreen.main.bounds) window.rootViewController = ViewController() \/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0432\u044c\u044e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440         window.makeKeyAndVisible() \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u044d\u0442\u043e \u043e\u043a\u043d\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c         self.window = window          return true     } }<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\n<p>UIApplicationMain \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 UIApplication \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u044d\u0442\u043e\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440. \u041a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0437\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 UIApplication.shared<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0437\u043d\u0430\u0435\u0442 \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u043a\u043b\u0430\u0441\u0441, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043c\u0435\u0442\u0438\u043b\u0438 \u0435\u0433\u043e <strong>@main<\/strong> (\u0432 \u0440\u0430\u043d\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 @<strong>UIApplicationMain<\/strong>)<\/p>\n<\/li>\n<li>\n<p>UIApplicationMain \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0443 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434 <strong>application(_:didFinish- LaunchingWithOptions:)<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u041d\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0435\u0433\u043e window \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u043e\u043a\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0424\u0443\u043d\u043a\u0446\u0438\u044f <strong>makeKeyAndVisible <\/strong>\u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c<\/p>\n<\/li>\n<\/ul>\n<p><em>\u041d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 iOS 13, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 AppDelegate \u0431\u044b\u043b\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043c\u0435\u0436\u0434\u0443 AppDelegate \u0438 SceneDelegate. \u042d\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043c\u043d\u043e\u0433\u043e\u043e\u043a\u043e\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0436\u0438\u043c\u0430, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0432 \u041e\u0421 iPad, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 AppDelegate \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438.<\/em><\/p>\n<ul>\n<li>\n<p>UIApplicationMain \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0443 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434 <strong>application(_:didFinish- LaunchingWithOptions:)<\/strong>.<\/p>\n<\/li>\n<li>\n<p><strong>UIApplicationMain<\/strong> \u0441\u043e\u0437\u0434\u0430\u0435\u0442 <strong>UISceneSession<\/strong>, <strong>UIWindowScene<\/strong> \u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u043c \u0441\u0446\u0435\u043d\u044b \u043e\u043a\u043d\u0430<\/p>\n<\/li>\n<li>\n<p>\u0412 Info.plist \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c (\u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438) \u043a\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u043c <\/p>\n<\/li>\n<li>\n<p>UIApplicationMain \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043b\u0438 \u0432\u0430\u0448\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0446\u0435\u043d\u0430 \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434\u044b. (\u0412 Info.plist \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u043c\u044f \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434\u0430)<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0446\u0435\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434, \u0442\u043e UIApplicationMain \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 UIWindow \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0435\u0433\u043e \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u043c \u0441\u0446\u0435\u043d\u044b.<\/p>\n<\/li>\n<li>\n<p>UIApplicationMain \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 UIWindow <strong>makeKeyAndVisible<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0435 \u0441\u0446\u0435\u043d\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <strong>scene(_:willConnectTo:options:)<\/strong><\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u041d\u0435 \u043e\u0436\u0438\u0434\u0430\u0439\u0442\u0435, \u0447\u0442\u043e window \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e. \u0415\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043e\u043a\u043d\u0430 <strong>UITextEffectsWindow<\/strong> \u0438 <strong>UIRemoteKeyboardWindow<\/strong>.<\/p>\n<\/blockquote>\n<p>\u041e\u043a\u0435\u0439. \u041c\u044b \u0432\u0440\u043e\u0434\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u0441\u0435\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041d\u043e \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u044d\u0442\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043a\u0430\u043a \u043e\u043d\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442?<\/p>\n<p>\u0417\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c. \u042d\u0442\u043e <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uievent\" rel=\"noopener noreferrer nofollow\">UIEvent<\/a>. \u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u043d\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u041a\u043e\u0433\u0434\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u0442\u0430\u043a\u043e\u0435 \u043a\u0430\u043a \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043a \u044d\u043a\u0440\u0430\u043d\u0443, UIKit \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b UIEvent \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 (main event loop), \u0432\u044b\u0437\u044b\u0432\u0430\u044f <strong>UIApplication.shared.sendEvent()<\/strong>. <\/p>\n<h4>UITouch<\/h4>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 UIEvent \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 UITouch. \u0414\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 UITouch \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0442\u044b\u0440\u0435 \u0432\u0435\u0449\u0438. \u041e\u043d\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0444\u0430\u0437\u0430\u043c\u0438 \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c <strong>var phase<\/strong>: <strong>UITouch.Phase:<\/strong><\/p>\n<ul>\n<li>\n<p>.<strong>began<\/strong> \u2014 \u041f\u0430\u043b\u0435\u0446 \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043a\u043e\u0441\u043d\u0443\u043b\u0441\u044f \u044d\u043a\u0440\u0430\u043d\u0430; \u044d\u0442\u043e\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 UITouch \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d. \u042d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0435\u0440\u0432\u0430\u044f \u0444\u0430\u0437\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p>.<strong>moved <\/strong>\u2014 \u041f\u0430\u043b\u0435\u0446 \u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u044d\u043a\u0440\u0430\u043d\u0443.<\/p>\n<\/li>\n<li>\n<p>.<strong>stationary <\/strong>\u2014 \u041f\u0430\u043b\u0435\u0446 \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043d\u0435\u043f\u043e\u0434\u0432\u0438\u0436\u043d\u043e. \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e? \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 UITouch \u0431\u044b\u043b \u0441\u043e\u0437\u0434\u0430\u043d, \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0431\u044b\u0432\u0430\u0435\u0442 UIEvent \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u0442\u0430\u0447. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 UIEvent \u043f\u0440\u0438\u0431\u044b\u0432\u0430\u0435\u0442 \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u043b\u0435\u0446 \u043a\u043e\u0441\u043d\u0443\u043b\u0441\u044f \u044d\u043a\u0440\u0430\u043d\u0430), UIEvent \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043f\u0430\u043b\u0435\u0446 \u0434\u0435\u043b\u0430\u043b, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u043b<\/p>\n<\/li>\n<li>\n<p><strong>.ended <\/strong>\u2014 \u041f\u0430\u043b\u0435\u0446 \u043f\u043e\u043a\u0438\u043d\u0443\u043b \u044d\u043a\u0440\u0430\u043d. \u041a\u0430\u043a \u0438 .began, \u044d\u0442\u0430 \u0444\u0430\u0437\u0430 \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u042d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 UITouch \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u0442 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 UIEvents \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u0442\u0430\u0447\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u0438\u0445 4\u0445 \u0444\u0430\u0437 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0430\u043b\u044c\u0446\u0430. \u041d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u0444\u0430\u0437\u0430:<\/p>\n<ul>\n<li>\n<p>.<strong>cancelled <\/strong>\u2014 \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0440\u0435\u0440\u0432\u0430\u043b\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u0443\u043b\u044c\u0442\u0438\u0442\u0430\u0447\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u0435\u0440\u0432\u0430\u043b\u043e \u0435\u0435.<strong> <\/strong>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0436\u0430\u043b \u043a\u043d\u043e\u043f\u043a\u0443 \u00ab\u0414\u043e\u043c\u043e\u0439\u00bb \u0438\u043b\u0438 \u043a\u043d\u043e\u043f\u043a\u0443 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u044d\u043a\u0440\u0430\u043d\u0430 \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<p><strong>UITouch<\/strong> \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<ul>\n<li>\n<p><strong>location(in:), previousLocation(in:) <\/strong>\u2014 \u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 view.<\/p>\n<\/li>\n<li>\n<p><strong>timestamp <\/strong>\u2014 \u041a\u043e\u0433\u0434\u0430 \u0442\u0430\u0447 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0440\u0430\u0437 \u043c\u0435\u043d\u044f\u043b\u0441\u044f. \u041f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u043a\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f (.began) \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f (.moved)<\/p>\n<\/li>\n<li>\n<p><strong>tapCount <\/strong>\u2014 \u0415\u0441\u043b\u0438 \u0434\u0432\u0430 \u043a\u0430\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u043c\u0435\u0441\u0442\u0435 \u0432 \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430 \u043f\u0435\u0440\u0432\u043e\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435, \u0432\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e. \u042d\u0442\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043d\u043e \u0432\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 tapCount \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0443 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e<\/p>\n<\/li>\n<li>\n<p><strong>view <\/strong>\u2014 \u0432\u044c\u044e\u0448\u043a\u0430, c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u044d\u0442\u043e \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u0433\u0434\u0430 UITouch \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f (.began), \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0441 \u043a\u0430\u043a\u0438\u043c UIView \u043e\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e. (\u041f\u043e\u0437\u0436\u0435 \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442). \u0417\u0430\u0442\u0435\u043c \u044d\u0442\u043e \u0436\u0435 UIView \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e var view \u0441\u0435\u043d\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0438\u043c. C \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u044d\u0442\u043e\u0442 UITouch \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u044d\u0442\u0438\u043c view (\u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u044d\u0442\u043e\u0442 \u043f\u0430\u043b\u0435\u0446 \u043d\u0435 \u043f\u043e\u043a\u0438\u043d\u0435\u0442 \u044d\u043a\u0440\u0430\u043d).<\/p>\n<h2>Main Event Loop<\/h2>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043e\u043d \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 window, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435. Window \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0432 view, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c<\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u043e\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0443 UI \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u042d\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 window \u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u0432\u044c\u044e\u0448\u0435\u043a.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u043e\u043d \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 window, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435. Window \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0432 view, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c<\/p>\n<p>\u041e\u043a\u0435\u0439. \u0412\u0440\u043e\u0434\u0435 \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041c\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u043f\u0440\u043e \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0443\u0437\u043d\u0430\u043b\u0438 \u043e \u0441\u0430\u043c\u0438\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u0445. \u041d\u043e \u043a\u0430\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0434\u043e\u0445\u043e\u0434\u044f\u0442 \u0434\u043e \u0442\u043e\u0447\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f?<\/p>\n<h2>Responder Chain<\/h2>\n<p>\u042d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uiresponder\" rel=\"noopener noreferrer nofollow\">UIResponder<\/a> \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u0430\u043c\u0438 (UIApplication, UIWindow, UIViewController, UIView).<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438, \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e, \u0447\u0442\u043e \u043e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u043c \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u043e\u043c <\/p>\n<p>\u0420\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0438 \u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043b\u0438\u0431\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435, \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u0441\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443-\u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u043d\u0442\u0443. \u041f\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0441\u043f\u0438\u0441\u043a\u0443 \u043e\u0442 \u0440\u0435\u043f\u043e\u043d\u0434\u0435\u0440\u0430 \u043a \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u0443.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0438 \u0438\u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438, \u043e\u043d \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u00ab\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u0443\u00bb.  \u0415\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u043d\u0442\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438\u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043e\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u0443 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435. \u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u0442\u0441\u044f \u0432\u0432\u0435\u0440\u0445 \u043f\u043e \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043e. \u0415\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0423 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u0440\u0430 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439:<\/p>\n<ul>\n<li>\n<p><strong>touchesBegan(_:with:)<\/strong> \u2014 \u0432\u043e view \u0438\u043b\u0438 window \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043e\u0434\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u044b\u0445 \u043a\u0430\u0441\u0430\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>touchesMoved(_:with:) <\/strong>\u2014 <em>\u0421\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u043d\u0442\u0443, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u043d\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u0441\u0430\u043d\u0438\u0439, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c, \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c.<\/em><\/p>\n<\/li>\n<li>\n<p><strong>touchesEnded(_:with:) <\/strong>\u2014 \u0421\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u043d\u0442\u0443, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043b\u044c\u0446\u0435\u0432 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u0432\u0438\u0434\u0430 \u0438\u043b\u0438 \u043e\u043a\u043d\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>touchesCancelled(_:with:) \u2014 <\/strong>\u0421\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u0440\u0435\u0441\u043f\u043e\u043d\u0434\u0435\u043d\u0442\u0443, \u043a\u043e\u0433\u0434\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435) \u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0441\u0430\u043d\u0438\u0439.<\/p>\n<\/li>\n<\/ul>\n<p>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><strong>touches: Set&lt;UITouch><\/strong> \u2014 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u0432\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u043a\u0430\u0441\u0430\u043d\u0438\u0435, \u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0435\u0433\u043e. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0432\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u043c\u043d\u043e\u0433\u043e \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f first \u043c\u0435\u0442\u043e\u0434 (\u043d\u0430\u0431\u043e\u0440 \u043d\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u0430\u043a\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432\u044b\u0431\u0435\u0440\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e).<\/p>\n<\/li>\n<li>\n<p><strong>event: UIEvent?<\/strong> \u2014 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u0430 UIEvent<\/p>\n<\/li>\n<\/ul>\n<h2>Gesture Recognizer<\/h2>\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0436\u0435\u0441\u0442\u043e\u0432 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c. \u0415\u0449\u0435 \u0441\u043b\u043e\u0436\u043d\u0435\u0439, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0436\u0435\u0441\u0442\u043e\u0432. \u0420\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f Gesture Recognizers (\u0441\u0443\u0431\u043a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uigesturerecognizer\" rel=\"noopener noreferrer nofollow\">UIGestureRecognizer<\/a>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u0443\u044e\u0442 \u043e\u0431\u0449\u0438\u0435 \u0436\u0435\u0441\u0442\u044b \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u0438 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0436\u0435\u0441\u0442\u043e\u0432 \u0432 \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0436\u0435\u0441\u0442\u043e\u0432 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441 UIView \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u044e \u043a\u0430\u0441\u0430\u043d\u0438\u044f.<\/p>\n<p>Gesture Recognizer \u2014 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442, \u0437\u0430\u0434\u0430\u0447\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c, \u0447\u0442\u043e<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-391516","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/391516","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=391516"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/391516\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=391516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=391516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=391516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}