{"id":266646,"date":"2015-10-23T15:39:02","date_gmt":"2015-10-23T11:39:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=266646"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=266646","title":{"rendered":"\u0422\u0440\u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0445 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441 \u043f\u0440\u0438\u0445\u043e\u0434\u043e\u043c watchOS2"},"content":{"rendered":"<p>       \u0418\u0442\u0430\u043a, \u043e \u0447\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430 watchOS2 \u2014 \u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0440\u0438 \u043f\u0443\u043d\u043a\u0442\u0430:<\/p>\n<ul>\n<li>WKInterfacePicker<\/li>\n<li>Complications<\/li>\n<li>WCSession<\/li>\n<\/ul>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u043d\u0438\u0445.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>WKInterfacePicker<\/h4>\n<p>  WKInterfacePicker \u2014 \u044d\u0442\u043e \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043e\u0442 Apple, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432 \u0440\u0430\u0437\u044b. \u0427\u0442\u043e \u0436\u0435 \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435? \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438 \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043f\u043e\u0434 iOS, \u0442\u043e \u044d\u0442\u043e UIPickerView \u0434\u043b\u044f \u0447\u0430\u0441\u043e\u0432, \u043e\u0434\u043d\u0430\u043a\u043e \u0441 \u0431\u043e\u043b\u0435\u0435 \u0433\u0438\u0431\u043a\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c. \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Digital Crown.<\/p>\n<p>  \u041e\u0431\u043e \u0432\u0441\u0435\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445 \u044f \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u0430 \u043e\u0442\u043c\u0435\u0447\u0443 \u043b\u0438\u0448\u044c \u0442\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u0436\u043d\u043e \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u044d\u0442\u0430\u043f\u0430\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0418\u0442\u0430\u043a, WKInterfacePicker \u0438\u043c\u0435\u0435\u0442 2 \u0432\u0430\u0436\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: Style \u0438 Focus Style. \u041c\u0435\u043d\u044f\u044f \u0441\u0442\u0438\u043b\u044c (Style), \u043c\u044b \u043c\u0435\u043d\u044f\u0435\u043c \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. <\/p>\n<p>  \u041d\u0430\u0447\u043d\u0443 \u0441\u0440\u0430\u0437\u0443 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430. \u0412\u043e\u043f\u0440\u0435\u043a\u0438 \u0445\u0438\u043f\u0441\u0442\u0435\u0440\u0441\u043a\u0438\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c, \u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044e \u043a\u043e\u0434, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u0441\u0442\u0430\u0440\u043e\u0439 \u0434\u043e\u0431\u0440\u043e\u0439 \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0435 \u2014 Objective-C.<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0430\u0448 InterfaceController \u0430\u0443\u0442\u043b\u0435\u0442 \u043d\u0430 \u043f\u0438\u043a\u0435\u0440:  <\/p>\n<pre><code class=\"objectivec\">@property (unsafe_unretained, nonatomic) IBOutlet WKInterfacePicker *picker; <\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0442\u0438\u043b\u044c \u043f\u0438\u043a\u0435\u0440\u0430 \u0432 \u0440\u0435\u0436\u0438\u043c List.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7d8\/f9d\/c3d\/7d8f9dc3dca44b2eba9b410ffd04a324.png\"\/><\/p>\n<p>  \u0418 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u043c \u043a\u043e\u0434:<\/p>\n<pre><code class=\"objectivec\">- (void)willActivate {     \/\/ This method is called when watch view controller is about to be visible to user     [super willActivate];          NSArray* arrayOfTexts = @[                               @&quot;\u0420\u0430\u0437&quot;,                               @&quot;\u0414\u0432\u0430&quot;,                               @&quot;\u0422\u0440\u0438&quot;,                               @&quot;\u0427\u0435\u0442\u044b\u0440\u0435&quot;,                               @&quot;\u041f\u044f\u0442\u044c&quot;,                               @&quot;\u0428\u0435\u0441\u0442\u044c&quot;,                               @&quot;\u0421\u0435\u043c\u044c&quot;,                               @&quot;\u0412\u043e\u0441\u0435\u043c\u044c&quot;,                               @&quot;\u0414\u0435\u0432\u044f\u0442\u044c&quot;,                               @&quot;\u0414\u0435\u0441\u044f\u0442\u044c&quot;,                               @&quot;\u041e\u0434\u0438\u043d\u043d\u0430\u0434\u0446\u0430\u0442\u044c&quot;,                               @&quot;\u0414\u0432\u0435\u043d\u0430\u0434\u0446\u0430\u0442\u044c&quot;,                               @&quot;\u0422\u0440\u0438\u043d\u0430\u0434\u0446\u0430\u0442\u044c&quot;,                               @&quot;\u0427\u0435\u0442\u044b\u0440\u043d\u0430\u0434\u0446\u0430\u0442\u044c&quot;,                               @&quot;\u041f\u044f\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u044c&quot;,                               @&quot;\u0428\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u044c&quot;,                               @&quot;\u0421\u0435\u043c\u043d\u0430\u0434\u0446\u0430\u0442\u044c&quot;,                               @&quot;\u0412\u043e\u0441\u0435\u043c\u043d\u0430\u0434\u0446\u0430\u0442\u044c&quot;,                               @&quot;\u0414\u0435\u0432\u044f\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u044c&quot;,                               @&quot;\u0414\u0432\u0430\u0434\u0446\u0430\u0442\u044c&quot;];     NSMutableArray* arrayOfItems = [NSMutableArray new];          for (int i = 0; i &lt; arrayOfTexts.count; i++) {         WKPickerItem *item = [WKPickerItem new];         [item setTitle: arrayOfTexts[i]];         [arrayOfItems addObject: item];     }      [self.picker setItems:arrayOfItems]; }  <\/code><\/pre>\n<p>  \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 (List) \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0439 \u043d\u0430\u043c \u0444\u043e\u0440\u043c\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/184\/13a\/02c\/18413a02ceff458dbb0750bc002a2f0e.gif\"\/><\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 \u043f\u0443\u043d\u043a\u0442 Stack, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a c \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/1e4\/272\/848\/1e427284897b41b79b7c85efa045c1b9.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/da8\/2c2\/2c7\/da82c22c7cef44f4810e00c479558344.gif\"\/><\/p>\n<p>  \u0412\u044b\u0431\u0440\u0430\u0432 \u043f\u0443\u043d\u043a\u0442 Sequence, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443, \u043d\u043e \u0431\u0435\u0437 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043a\u0430\u043a \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u044c, \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u0430\u043b\u044c\u0444\u0430-\u043a\u0430\u043d\u0430\u043b\u0430 \u0438 \u0442.\u0434.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b67\/2e8\/0e3\/b672e80e388f44e08e1263a082e254a5.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/edd\/948\/383\/edd94838358a470698d4c2b14996845a.gif\"\/><\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u043a\u043e\u0435-\u0447\u0442\u043e \u0432\u0430\u0436\u043d\u043e\u0435: \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0430\u0440\u0442\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0441\u043e\u0442\u043d\u0438 \u0440\u0430\u0441\u043a\u0430\u0434\u0440\u043e\u0432\u043e\u043a \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c x2 (x3). \u042d\u0442\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442 \u043f\u043b\u0430\u0432\u043d\u0443\u044e \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0443 \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u0443\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u043a\u0448\u0435\u043d\u0430 (\u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439, \u043b\u0438\u0447\u043d\u043e \u044f \u043e\u0436\u0438\u0434\u0430\u043b \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>table didSelectRowAtIndex<\/code>.<\/p>\n<p>  \u0422\u044f\u043d\u0435\u043c \u043f\u0438\u043a\u0435\u0440 \u0432 \u0445\u0435\u0434\u0435\u0440 \u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430, \u0432\u0440\u043e\u0434\u0435 \u0442\u0430\u043a\u043e\u0433\u043e:<\/p>\n<pre><code class=\"objectivec\">- (IBAction)pickerDidSelectValue:(NSInteger)value; <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0441\u0432\u043e\u0435\u043c\u0443 \u0436\u0435\u043b\u0430\u043d\u0438\u044e.<\/p>\n<p>  \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 Focus Style, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u043b\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446 \u043f\u0438\u043a\u0435\u0440\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0444\u043e\u043a\u0443\u0441\u0430 (\u0432 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043f\u0438\u043a\u0435\u0440\u0430 \u0444\u043e\u043a\u0443\u0441 \u0437\u0435\u043b\u0435\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430 \u0441 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c\u0438 \u0437\u0430\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u044f\u043c\u0438).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e17\/504\/c70\/e17504c70581424d9945453be150ebde.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/5bf\/54a\/c6c\/5bf54ac6c60f49c88f427228f20e3685.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/301\/813\/7dc\/3018137dc5d24049812744e7a1f68aa5.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/67c\/7c9\/b37\/67c7c9b3769f4d658b78cd6495163e91.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e5b\/593\/a6b\/e5b593a6bf4a4813b1bed678c6072aad.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d81\/fb0\/a18\/d81fb0a1858e43bfbac7f4a978360644.png\"\/><\/p>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c WKinterfacePicker \u2014 \u044d\u0442\u043e \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. <\/p>\n<h4>Complications<\/h4>\n<p>  \u041f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0443\u0442\u0438 Complications \u2014 \u044d\u0442\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 Modular watch face. \u0414\u043e\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u043b\u043e\u0432\u0430 complications \u2014 \u043e\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u044f. \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0441\u0442\u044c? \u041d\u0435 \u0434\u0443\u043c\u0430\u044e. \u0412\u0435\u0434\u044c \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u043e\u0439 \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a ClockKit. \u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0436\u0430\u0441\u043d\u0443\u0442\u044c\u0441\u044f, \u0445\u043e\u0442\u044f \u0432\u0441\u0435 \u043d\u0435 \u0442\u0430\u043a \u0433\u0440\u0443\u0441\u0442\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043a\u0440\u0430\u0442\u043a\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u0430 \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u00ab\u043e\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u0439\u00bb. \u041f\u0440\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0433\u0430\u043b\u043e\u0447\u043a\u0435 \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441 ComplicationController.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/174\/c8b\/8a5\/174c8b8a549847f29d3fab717080a160.png\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/559\/631\/1cf\/5596311cf4054d2aae7a2277b17149af.png\"\/><\/p>\n<p>  \u041a \u0445\u0435\u0434\u0435\u0440\u0443 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b CLKComplicationDataSource. \u0412 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e 9 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u041f\u0435\u0440\u0432\u044b\u0435 4 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 Complications \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 (Time Travel). \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0438\u043d\u043e\u0439 \u043c\u0435\u0442\u043e\u0434.<\/p>\n<pre><code class=\"objectivec\">- (void)getCurrentTimelineEntryForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTimelineEntry * __nullable))handler <\/code><\/pre>\n<p>  \u041e\u043d \u0437\u0434\u0435\u0441\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439. \u0412 \u043d\u0435\u043c \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u00ab\u0442\u043e\u0447\u043a\u0443 \u0432\u0445\u043e\u0434\u0430\u00bb \u043d\u0430\u0448\u0435\u0433\u043e complication \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u0434\u0430\u0442\u043e\u0439. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 CLKComplicationTimelineEntry.<\/p>\n<pre><code class=\"objectivec\">CLKComplicationTimelineEntry* entry = nil; <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043f\u043b\u044f\u0448\u0435\u043c \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u043e\u0439 \u0442\u0438\u043f complication \u0445\u043e\u0442\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c Modular Small \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0443\u0434\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443. <\/p>\n<pre><code class=\"objectivec\">    if (complication.family == CLKComplicationFamilyModularSmall) {         CLKComplicationTemplateModularSmallSimpleImage* image = [[CLKComplicationTemplateModularSmallSimpleImage alloc] init];         [image setImageProvider: [CLKImageProvider imageProviderWithOnePieceImage:[UIImage imageNamed:@&quot;cat&quot;]]];         entry = [CLKComplicationTimelineEntry entryWithDate:[NSDate date] complicationTemplate:image];     }     handler(entry); <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 Modular watch face \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u0431\u0430\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u0442\u0435\u0439\u043a\u0443 \u043e\u0442 \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. Profit.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/653\/7f3\/5b0\/6537f35b0b784f04a9ccbb7e6c95cb16.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/06a\/b55\/4a7\/06ab554a778d47b490b18cf7656b9172.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/c43\/63a\/04a\/c4363a04a7b5497aa5bf2d760cdc9214.png\"\/><\/p>\n<p>  \u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0441\u0445\u0435\u043c\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0438 \u0442\u0435\u043a\u0441\u0442\u044b \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430 (\u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e, \u0431\u043b\u043e\u043a\u0430\u043c\u0438 \u0438 \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c\u0438). \u0412 \u0446\u0435\u043b\u043e\u043c, \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0438 \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0436\u0438\u0437\u043d\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0432\u0430\u0436\u043d\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h4>WCSession<\/h4>\n<p>  \u041f\u0440\u0438\u0448\u043b\u0430 \u043d\u043e\u0432\u0430\u044f \u044d\u0440\u0430 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 iPhone \u0438 Apple Watch. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u0441\u0442\u0430\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u00ab\u043a\u043e\u0441\u0442\u044b\u043b\u044f\u00bb \u043e\u0442 Apple \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c openParentApplication \u0438\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c AppGroup \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0447\u0435\u0440\u0432\u043e\u0442\u043e\u0447\u0438\u043d\u043e\u0439, \u0442\u043e \u043f\u043e\u0440\u0430 \u043e \u043d\u0438\u0445 \u0437\u0430\u0431\u044b\u0442\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u0442\u044c 3 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u00ab\u0441\u0435\u0441\u0441\u0438\u0438\u00bb:<\/p>\n<ul>\n<li>Application Context<\/li>\n<li>Transferring Files and Data<\/li>\n<li>Sending Messages<\/li>\n<\/ul>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u044d\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0444\u043e\u0440\u043a WatchConnectivity. \u041e\u043d-\u0442\u043e \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438.<\/p>\n<pre><code class=\"objectivec\">  #import &lt;WatchConnectivity\/WatchConnectivity.h&gt; <\/code><\/pre>\n<p>  \u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b WCSessionDelegate \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445, \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0442\u0440\u0430\u043d\u0441\u0444\u0435\u0440. \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0441\u0435\u0441\u0441\u0438\u0439. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e, \u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0432\u0441\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u0447\u0435\u0440\u0435\u0437 [WCSession defaultSession].<\/p>\n<pre><code class=\"objectivec\">if ([WCSession isSupported]) {       WCSession *session = [WCSession defaultSession];       session.delegate = self;       [session activateSession]; }   NSDictionary *dict = @{@&quot;key&quot;: @&quot;\u0422\u043e, \u0447\u0442\u043e \u043c\u044b \u0442\u0430\u043a \u0445\u043e\u0442\u0438\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c&quot;}; [[WCSession defaultSession] updateApplicationContext:dict error:nil];  \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434  -(void)session:(WCSession *)session didReceiveApplicationContext:(NSDictionary&lt;NSString *,id&gt; *)applicationContext {   NSString* stringWeNeed =  [applicationContext objectForKey:@&quot;key&quot;];     NSLog(@&quot;%@&quot;, stringWeNeed); } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0430\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u043c \u0438 \u0447\u0430\u0441\u0430\u043c\u0438, \u0442\u043e \u044d\u0442\u043e \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 2-\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432:<\/p>\n<p>  transferUserInfo: (\u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 NSDictionary)<br \/>  transferFile: metadata: (\u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 \u043f\u043e URL + NSDictionary \u0441 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438)<\/p>\n<p>  \u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438:<\/p>\n<p>  session didReceiveUserInfo: (\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c NSDictionary)<br \/>  session didReceiveFile: (\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c WCSessionFile \u0441 \u0441\u044b\u043b\u043b\u043a\u043e\u0439 \u043d\u0430 \u0444\u0430\u0439\u043b \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0441 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438)<\/p>\n<p>  \u041d\u0443 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a WatchConnectivity \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445 ViewController \u0438 InterfaceController. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b WatchConnectivity:<\/p>\n<pre><code class=\"objectivec\">@interface ViewController : UIViewController &lt;WCSessionDelegate&gt; @interface InterfaceController : WKInterfaceController &lt;WCSessionDelegate&gt; <\/code><\/pre>\n<p>  \u0412 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c:<\/p>\n<pre><code class=\"objectivec\">- (void)viewDidLoad {     [super viewDidLoad];          if ([WCSession isSupported]) {         WCSession *session = [WCSession defaultSession];         session.delegate = self;         [session activateSession];     } }  - (void)awakeWithContext:(id)context {     [super awakeWithContext:context];      if ([WCSession isSupported]) {         WCSession *session = [WCSession defaultSession];         session.delegate = self;         [session activateSession];     } } <\/code><\/pre>\n<p>  \u0411\u0443\u0434\u0435\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043d\u0430 \u0447\u0430\u0441\u0430\u0445 \u043f\u0440\u0438 \u043a\u043b\u0438\u043a\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u043d\u0430 iPhone. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0432 Main.storyboard \u0438 \u0442\u044f\u043d\u0435\u043c IBAction: <code>- (IBAction)buttonClicked:(id)sender;<\/code>.<\/p>\n<p>  \u0412 Interface.storyboard \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043b\u0435\u0439\u0431\u043b \u0438 \u043f\u0435\u0440\u0435\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c Outlet:<\/p>\n<pre><code class=\"objectivec\">@property (unsafe_unretained, nonatomic) IBOutlet WKInterfaceLabel *infoHere; <\/code><\/pre>\n<p>  \u041d\u0430\u0436\u0430\u0442\u0438\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0435\u0433\u043e \u043d\u0430 \u0447\u0430\u0441\u044b, \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c NSDictionary:<\/p>\n<pre><code class=\"objectivec\">- (IBAction)buttonClicked:(id)sender {    NSString* randomValue = [NSString stringWithFormat:@&quot;%u&quot;, (arc4random() % 10000) ];      [[WCSession defaultSession] sendMessage:@{@&quot;key&quot;:  randomValue]} replyHandler:^(NSDictionary&lt;NSString *,id&gt; * _Nonnull replyMessage) {              } errorHandler:^(NSError * _Nonnull error) {              }];      <\/code><\/pre>\n<p>  \u041d\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c:<\/p>\n<pre><code class=\"objectivec\">-(void)session:(WCSession *)session didReceiveMessage:(NSDictionary&lt;NSString *,id&gt; *)message replyHandler:(void (^)(NSDictionary&lt;NSString *,id&gt; * _Nonnull))replyHandler {       dispatch_async(dispatch_get_main_queue(), ^{               NSString* string = [message objectForKey:@&quot;key&quot;];          [self.label setText:string];      }); }  <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u041c\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c UI \u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, \u0438\u043d\u0430\u0447\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c. \u0414\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0447\u0438\u043d \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043e \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u041f\u043e\u0434\u044b\u0442\u043e\u0436\u0438\u043c. \u042f \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u0432\u0448\u0435\u0441\u0442\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0438\u0447\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u044e \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u043c\u0438 \u0441 \u043f\u0440\u0438\u0445\u043e\u0434\u043e\u043c OS2. \u041d\u0435\u0441\u043e\u043c\u043d\u0435\u043d\u043d\u043e, \u043e \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435, \u043f\u0440\u0438\u0447\u0435\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0431\u044a\u0435\u043c\u043d\u043e, \u043d\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0438\u0437 \u043d\u0430\u0441 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0441\u0432\u043e\u0435\u043d\u0438\u044f \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438. \u0422\u0430\u043a \u043f\u0443\u0441\u0442\u044c \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0441\u0442\u0430\u043d\u0435\u0442 \u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u043e\u043f\u043e\u0440\u044b \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432, \u0440\u0435\u0448\u0438\u0432\u0448\u0438\u0445 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043f\u043e\u0434 watchOS.       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/269401\/\"> http:\/\/habrahabr.ru\/post\/269401\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u0418\u0442\u0430\u043a, \u043e \u0447\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430 watchOS2 \u2014 \u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0440\u0438 \u043f\u0443\u043d\u043a\u0442\u0430:<\/p>\n<ul>\n<li>WKInterfacePicker<\/li>\n<li>Complications<\/li>\n<li>WCSession<\/li>\n<\/ul>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u043d\u0438\u0445.  <\/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-266646","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/266646","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=266646"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/266646\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=266646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=266646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=266646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}