<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          PromiseKitiOS 異步開(kāi)發(fā)

          聯(lián)合創(chuàng)作 · 2023-09-25 16:53

          現(xiàn)代化的開(kāi)發(fā)都要求高度異步,iOS 開(kāi)發(fā)也是一樣,PromiseKit 能提供強(qiáng)大的 iOS 開(kāi)發(fā)異步功能,非常容易使用。

          PromiseKit 不僅僅是 Promises 的實(shí)現(xiàn),還是輔助函數(shù)的集合,使得 iOS 開(kāi)發(fā)典型的異步模式更強(qiáng)大。

          PromiseKit 支持集成到其他 Cocoapods,如果用戶的庫(kù)有異步操作,而又喜歡使用 PromiseKit,則可以添加了一個(gè)可選的缺省子說(shuō)明書,提供 Promises 服務(wù),文檔會(huì)幫助集成 PromiseKit 到用戶自身的 pods 中。

          示例:

          [CLLocationManager promise].catch(^{
              return self.chicagoLocation;}).then(^(CLLocation *loc){
              return [NSURLConnection GET:@"http://user.net/%f/%f", loc.latitude, loc.longitude];}).then(^(NSDictionary *user){
              UIAlertView *alert = [UIAlertView new];
              alert.title = [NSString stringWithFormat:@"Hi, %@!", user.name];
              [alert addButtonWithTitle:@"Bye"];
              [alert addButtonWithTitle:@"Hi!"];
              return alert.promise;}).then(^(NSNumber *tappedButtonIndex, UIAlertView *alert){
              if (tappedButtonIndex.intValue == alert.cancelButtonIndex)
                  return nil;
              id vc = [HelloViewController new]
              return [self promiseViewController:vc animated:YES completion:nil].then(^(id resultFromViewController){
                  //…
              });}).catch(^(NSError *err){
              //…});

           

          瀏覽 28
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  最新版中文官网资源 | 国产内射网站 | A∨日本精品免费 | 九一麻豆影院无码精品 | 国产黄片免费播放 |