{"id":280883,"date":"2016-11-13T19:10:04","date_gmt":"2016-11-13T16:10:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=280883"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=280883","title":{"rendered":"\u041a\u0430\u043a \u0435\u0449\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c type safety \u0432 \u0446\u0435\u043b\u044f\u0445 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f API"},"content":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u042f \u2014 lead developer cocos2d-objc. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 Swift. \u042f \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u043e\u0441\u0432\u0435\u0449\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u0442.\u0434. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0435\u0449\u0435 \u043d\u0430 proof-of-a-concept \u0441\u0442\u0430\u0434\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u043c \u043f\u0440\u0438\u0451\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043a\u0430\u043a \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0441\u0434\u0435\u043b\u0430\u043b \u043d\u0430\u0448\u0443 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0447\u0443\u0442\u044c \u043b\u0443\u0447\u0448\u0435. \u0415\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u2014 \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/632\/9e8\/ebe\/6329e8ebe426d19f44f48ffc23503a04.png\" alt=\"image\"\/><br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0434\u0432\u0438\u0436\u043e\u043a \u043d\u0430 Swift, \u0441\u0442\u0430\u043b\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0439 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043f\u043e\u0434 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043d\u0443\u0436\u0434\u044b. \u0414\u0432\u0438\u0436\u043e\u043a \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e x-platform in mind, \u0442\u0430\u043a \u0447\u0442\u043e CG* \u0442\u0438\u043f\u044b \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043c\u043e\u0433\u043b\u0438, \u0434\u0430 \u0438 CoreGraphics API \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e Swifty \u0434\u043b\u044f \u043d\u0430\u0441. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u0441 \u043d\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u043b\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044f\u0441\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0430\u0441\u043a\u0435\u0442\u0438\u0437\u043c\u0430. <\/p>\n<p>  \u041c\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043b\u0438\u0441\u044c \u0441\u043a\u0440\u043e\u043c\u043d\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0442\u0438\u043f\u043e\u0432: <i>Vector2f, Vector3f, Vector4f, Matrix3f, Matrix4f, Rect<\/i>. \u041c\u044b \u0442\u0432\u0435\u0440\u0434\u043e \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c ARC overhead \u0438 \u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0442\u0438\u043c \u0438\u043c\u0435\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 <i>SIMD<\/i> (\u0445\u043e\u0442\u044f \u0431\u044b \u043d\u0430 <i>Darwin<\/i> \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445, \u0434\u043b\u044f <i>Glibc<\/i> \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 simd \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e), \u043f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u0432 \u0438 \u0437\u0430\u0432\u044f\u0437\u0430\u0442\u044c \u0432\u0441\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043d\u0430 \u0442\u0438\u043f\u0435 <i>Float<\/i>, \u0431\u0435\u0437 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 <i>Double<\/i>.<\/p>\n<p>  \u041e\u043a, \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u0432\u0430\u043c \u044d\u0442\u043e \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u044d\u0442\u043e \u0432\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435. \u041e \u0447\u0435\u043c \u0441\u0442\u0430\u0442\u044c\u044f?<\/p>\n<p>  \u0412 \u043a\u0430\u043a\u043e\u0439 \u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u043f\u043e\u043d\u044f\u043b\u0438, \u0447\u0442\u043e API, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0443\u0433\u043b\u0430\u043c\u0438 (\u0432\u0440\u043e\u0434\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430 \u0438 \u0442.\u0434.) \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u0443\u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0438. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043d\u0430\u043c \u0432\u0430\u0436\u043d\u043e\u0439 \u2014 \u0443\u0431\u0440\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043d\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434: \u0440\u0430\u0434\u0438\u0430\u043d\u044b \u0438\u043b\u0438 \u0433\u0440\u0430\u0434\u0443\u0441\u044b.<\/p>\n<p>  \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u043b\u0438\u0430\u0441\u044b \u043d\u0430 Float \u0432\u0438\u0434\u0430 <\/p>\n<pre><code>typealias Radians = Float; typealias Degrees = Float;<\/code><\/pre>\n<p>  \u041f\u043e\u043d\u044f\u0442\u043d\u043e\u0435 \u0434\u0435\u043b\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u043e \u043d\u0435 \u0441\u043f\u0430\u0441\u0430\u0435\u0442, \u0442.\u043a. \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0435\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u043c\u0435\u0442\u043e\u0434 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0432 \u0442\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0435. <\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 rad() \u0438 deg(), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0438 \u043d\u0443\u0436\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0412\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 Int \u0438 Float, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0445 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432 \u0432\u0438\u0434\u0430   <\/p>\n<pre><code>45.degrees 180.radians <\/code><\/pre>\n<p>  \u041d\u0430\u043c \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u043b\u0438\u0441\u044c, \u0442.\u043a. \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c:  <\/p>\n<pre><code>180.radians.radians<\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043f\u043e\u0434 \u0442\u0438\u043f Angle:  <\/p>\n<pre><code>\/\/\/ A floating point value that represents an angle public struct Angle { \t     \/\/\/ The value of the angle in degrees     public let degrees: Float \t     \/\/\/ The value of the angle in radians     public var radians: Float {         return degrees * Float.pi \/ 180.0     }  \t\/\/\/ Creates an instance using the value in radians     @inline(__always)     public init(radians val: Float) {         degrees = val \/ Float.pi * 180.0     } \t \t\/\/\/ Creates an instance using the value in degrees     @inline(__always)     public init(degrees val: Float) {         degrees = val     }          @inline(__always)     internal init(_ val: Float) {         degrees = val     } }<\/code><\/pre>\n<p>  \u0427\u0435\u043c \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e? \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0443\u0433\u043e\u043b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u043f\u0440\u0438\u0447\u0435\u043c \u0435\u043c\u0443 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f, \u0432 \u043a\u0430\u043a\u043e\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u0438\u0434\u0435: \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445 \u0438\u043b\u0438 \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u0445. <br \/>  \u0415\u0441\u043b\u0438 \u043e\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 Angle, \u0442\u043e \u043e\u043d \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.<\/p>\n<p>  \u041c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0432\u0441\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Angle (\u0442\u0430\u043a\u0438\u0435 \u0436\u0435, \u043a\u0430\u043a \u0434\u043b\u044f \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d, \u0442\u043e\u043b\u044c\u043a\u043e Angle \/ Angle \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 Float \u0432\u043c\u0435\u0441\u0442\u043e Angle, \u0430 Angle * Angle \u043d\u0435\u0442 \u0432\u043e\u0432\u0441\u0435)<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c extension \u0434\u043b\u044f Int:  <\/p>\n<pre><code>extension Int {     \/\/\/ Returns the integer value as an angle in degrees     public var degrees: Angle {         return Angle(degrees: Float(self))     } }<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0438\u043c\u0438 \u0443\u0433\u043b\u0430\u043c\u0438 \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u0430\u0445, \u043d\u0435 \u0442\u0435\u0440\u044f\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0442\u0430\u043c, \u0433\u0434\u0435 \u043d\u0435 \u043d\u0430\u0434\u043e \u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0438\u0445 \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e (\u043e\u0431\u044b\u0447\u043d\u043e, \u043f\u0440\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u0445).<br \/>  \u0427\u0442\u043e\u0431\u044b \u0435\u0449\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c, \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 sin \u0438 cos \u0434\u043b\u044f Angle \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code>@inline(__always) internal func sinf(_ a: Angle) -&gt; Float { \treturn __sinpif(a.degrees \/ 180.0) }  @inline(__always) internal func cosf(_ a: Angle) -&gt; Float { \treturn __cospif(a.degrees \/ 180.0) }<\/code><\/pre>\n<p>  \u041f\u0440\u0430\u0432\u0434\u0430, \u0434\u043b\u044f Glibc \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u044d\u0442\u0438\u0445 \u0444\u0443\u043a\u043d\u0446\u0438\u0439, \u0442.\u043a. \u0442\u0430\u043c \u043d\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u041d\u0443 \u0438 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044e\u043d\u0438\u043a\u043e\u0434\u0430 \u0432 \u043a\u043e\u0434\u0435 \u2014 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043f\u043e\u0440\u043d\u0430\u044f \u0442\u0435\u043c\u0430. \u041b\u0438\u0447\u043d\u043e \u044f \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u044d\u0442\u043e. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e, \u043c\u044b \u0440\u0430\u0434\u0438 \u0432\u0435\u0441\u0435\u043b\u044c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440:  <\/p>\n<pre><code> \/\/\/ The degree operator constructs an `Angle` from the specified floating point value in degrees \/\/\/ \/\/\/ - remark:  \/\/\/ * Degree operator is the unicode symbol U+00B0 DEGREE SIGN \/\/\/ * macOS shortcut is \u2318+\u21e7+8 @inline(__always) public postfix func \u00b0(lhs: Float) -&gt; Angle {     return Angle(degrees: lhs) }  \/\/\/ Constructs an `Angle` from the specified `Int` value in degrees @inline(__always) public postfix func \u00b0(lhs: Int) -&gt; Angle {     return Angle(degrees: Float(lhs)) }<\/code><\/pre>\n<p>  \u0418 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u043d\u0430\u0448\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0432\u043e\u0442 \u0442\u0430\u043a:  <\/p>\n<pre><code>    \/\/ MARK: Constants     public static let zero  = 0\u00b0     public static let pi_6  = 30\u00b0     public static let pi_4  = 45\u00b0     public static let pi_3  = 60\u00b0     public static let pi_2  = 90\u00b0     public static let pi2_3 = 120\u00b0     public static let pi    = 180\u00b0     public static let pi3_2 = 270\u00b0     public static let pi2   = 360\u00b0<\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435, \u044f \u043f\u043e\u0439\u043c\u0430\u043b \u0441\u0435\u0431\u044f \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u044d\u0442\u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0432 \u043a\u043e\u0434\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430, \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u043b\u043e\u0443\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u2014 \u043d\u0435 \u0432\u0441\u0435 \u043f\u043e\u043c\u043d\u044f\u0442 \u0448\u043e\u0440\u0442\u043a\u0430\u0442\u044b \u0438 \u043f\u043e\u0440\u043e\u0439 \u044d\u0442\u043e <b>\u0431\u0435\u0441\u0438\u0442<\/b>.<\/p>\n<p>  \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0443\u0441\u0442\u044f\u043a\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043e\u0434\u043d\u0430\u043a\u043e \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c \u0432\u0430\u043c \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u044f \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u0435\u043c, \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0433\u043e\u043d\u044f\u0442\u044c \u0442\u0443\u0434\u0430-\u0441\u044e\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043d\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u0442\u043e\u0433\u043e, \u0432 \u043a\u0430\u043a\u0438\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430\u0445 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0421\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0432\u0438\u0436\u043a\u0430 <a href=\"https:\/\/github.com\/s1ddok\/Fiber2D\">\u043c\u043e\u0436\u043d\u043e \u0442\u0443\u0442<\/a>.<br \/>  <a href=\"https:\/\/github.com\/SwiftGFX\/SwiftMath\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 math lib.<\/a><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:\/\/habrahabr.ru\/post\/315164\/\"> https:\/\/habrahabr.ru\/post\/315164\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442! \u042f \u2014 lead developer cocos2d-objc. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 Swift. \u042f \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u043e\u0441\u0432\u0435\u0449\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u0442.\u0434. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0435\u0449\u0435 \u043d\u0430 proof-of-a-concept \u0441\u0442\u0430\u0434\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u043c \u043f\u0440\u0438\u0451\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043a\u0430\u043a \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0441\u0434\u0435\u043b\u0430\u043b \u043d\u0430\u0448\u0443 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0447\u0443\u0442\u044c \u043b\u0443\u0447\u0448\u0435. \u0415\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u2014 \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/632\/9e8\/ebe\/6329e8ebe426d19f44f48ffc23503a04.png\" alt=\"image\"\/>  <\/p>\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-280883","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/280883","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=280883"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/280883\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=280883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=280883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=280883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}