ããªãã¼æ ªå¼ä¼ç¤¾ *1 ã®å¤ç°ã§ããHoliday ( https://haveagood.holiday/ ) ã¨ãããµã¼ãã¹ã®éçºãè¡ã£ã¦ãã¾ãã
ã¢ããªãéãã¦ã¦ã¼ã¶ã«ä¾¡å¤ãå±ããããã«ã¯ãã¢ããªã®ç´°é¨ã®ã¤ã³ã¿ã©ã¯ã·ã§ã³ã軽è¦ãããã¨ã¯ã§ãã¾ãããç´°ããé¨åã«æ°ãé ã使ãå¿å°ãè¯ããã¦ããããµã¼ãã¹ã§æ¬å½ã«å®ç¾ããã価å¤ãã¦ã¼ã¶ã«ã¾ã£ããå±ãããã¨ãã§ããããã§ãã
iOS ã¢ããªã®ä½¿ãå¿å°ãè¯ãããããã®åºæ¬çãªã¤ã³ã¿ã©ã¯ã·ã§ã³ã以åå½ããã°ã§æ稿ããè¨äºã§ããã¤ãç´¹ä»ãã¾ããããä»åã¯ååç´¹ä»ããªãã£ãã¤ã³ã¿ã©ã¯ã·ã§ã³ã®ãã¡ããèªã¿è¾¼ã¿ä¸ãã® UI ã®åºæ¬ãã¿ã¼ã³ã«ã¤ãã¦åãä¸ãããã¨ãããã¾ãã
ã¯ããã«ï¼ãªãèªã¿è¾¼ã¿ä¸ã® UI ãèããªãã¦ã¯ãããªãã®ã
Holiday iOS ã¢ããªã§ã¯ãåºæ¬çã«ãã¼ã¿ã¯ã¯ã©ã¤ã¢ã³ãå´ã§æãããµã¼ãã¨éä¿¡ãã¦è¡¨ç¤ºãããã¼ã¿ãåãåã£ã¦ãããåãåã£ããã¼ã¿ã表示ããã¾ã§ã«ã¯ã©ããã¦ãããç¨åº¦æéããããã¾ãããã¡ãããæ ¹æ¬çãªå¾ ã¡æéãçãããããã«ãAPI ãé«éåãããã¨ããã¬ã¹ãã³ã¹ã®æé©åããªã¯ã¨ã¹ãã®ã¿ã¤ãã³ã°ã®å·¥å¤«ãªã©ã¯å¿ è¦ä¸å¯æ¬ ã§ããã§ãããã©ãã¾ã§ãã®ãããªæé©åãè¡ã£ã¦ããç¹ã«ã¢ãã¤ã«ã¢ããªã®å ´åã¯ãããã¯ã¼ã¯ãä¸å®å®ãªç°å¢ãé¿ãããã¨ãã§ããªããããèªã¿è¾¼ã¿æéãããç¨åº¦ãããå ´åã®ãã¨ãæ³å®ããªãã¦ã¯ããã¾ããã
èªã¿è¾¼ã¿æéããããå ´åã«ã§ãããã¨ã¯è²ã ã¨èãããã¾ãããåã£ããã¨ãããã¨ãé©å㪠UI ãç¨ãããã¨ã§èªã¿è¾¼ã¿ä¸ã®ä½é¨ãè¯ããããã¨ãã§ãã¾ããããã§ãç°¡åã«å®ç¾ã§ããèªã¿è¾¼ã¿ä¸ã®åºæ¬ UI ãã¿ã¼ã³ã3ã¤ãHoliday iOS ã¢ããªã§ã®ä¾ã¨ã¨ãã«ãç´¹ä»ãã¾ãã
ãã¾ãï¼ãããã¯ã¼ã¯ç°å¢ãæªãç¶æ ãéçºä¸ã«åç¾ããããã«
ã·ãã¥ã¬ã¼ã¿ä¸ãå®æ©ã§ãããã¯ã¼ã¯ç°å¢ãæªãç¶æ ãåç¾ããããã«ã¯ãNetwork Link Conditioner ã使ãã¨è¯ãã§ãã
ã¢ã¯ãã£ããã£ã¤ã³ã¸ã±ã¼ã¿
æãåºæ¬çãªèªã¿è¾¼ã¿ä¸ã® UI ã¯ãUIKit ã§æä¾ããã¦ããã¢ã¯ãã£ããã£ã¤ã³ã¸ã±ã¼ã¿ã§ããã¢ã¯ãã£ããã£ã¤ã³ã¸ã±ã¼ã¿ã表示ãããã¨ã§ãå¦çãåæ¢ããã«é²ãã§ãããã¨ã示ããã¨ãã§ãã¾ãã
ã¢ã¯ãã£ããã£ã¤ã³ã¸ã±ã¼ã¿ã¯ç»é¢å ã«é¦´æãããããã¼ã¿ãåå¾ããã¾ã§ã®éã«è¡¨ç¤ºãããã®ã¨ãã¦æãæ軽ã§ç¡é£ãªé¸æè¢ã®ä¸ã¤ã§ããé·ç§»å¾ã®ç»é¢ã§ãã¼ã¿åå¾ã¾ã§ã®ç©ºã®ç»é¢ã«è¡¨ç¤ºãã¹ããã®ããªããªããã¢ã¯ãã£ããã£ã¤ã³ã¸ã±ã¼ã¿ã表示ãã¦ããã¨ç»é¢ãè¦ã¦ããã¦ã¼ã¶ãå®å¿ããããã¨ãã§ãã¾ãã
APIKit ã使ã£ããµã³ãã«ã³ã¼ãã¯ä¸è¨ã®ã¨ããã§ãã
// ãªã¯ã¨ã¹ããéãåã«ã¢ã¯ãã£ããã£ã¤ã³ã¸ã±ã¼ã¿ã表示ï¼ç»é¢ã®åæåæã« `activityIndicator` ããã¥ã¼ã«ã»ãããã¦ããå¿ è¦ãããï¼ activityIndicator.startAnimating() Session.sendRequest(request) { result in // ã¬ã¹ãã³ã¹ãåãåã£ããã¢ã¯ãã£ããã£ã¤ã³ã¸ã±ã¼ã¿ãé表示 activityIndicator.stopAnimating() // ãã¼ã¿åå¾å¾ã®å¦ç // ... }
HUD
ã¢ã¯ãã£ããã£ã¤ã³ã¸ã±ã¼ã¿ã®ä»ã«ã¯ãHUD ãèªã¿è¾¼ã¿ä¸ã® UI ã¨ãã¦åºã使ããã¦ãã¾ããSVProgressHUD ã MBProgressHUD ãªã©ã®ã©ã¤ãã©ãªã使ããã¨ã§ç°¡åã«å°å ¥ãããã¨ãã§ãã¾ãã
HUD ã¯ç»é¢ã®æåé¢ã«è¦ããã¶ããããã«è¡¨ç¤ºããããããã©ã®ãããªç»é¢ã§ã使ããã¨ãã§ããã¨ããæå³ã§ã¯ä¾¿å©ãªã®ã§ãããè¯ããæªããç®ç«ã¤ã®ã§ä½¿ãã©ããã«ã¯æ°ãã¤ããªãã¦ã¯ããã¾ãããä¾ãã°ç»é¢é·ç§»å¾ã®ãã¼ã¿èªã¿è¾¼ã¿ä¸ã«è¡¨ç¤ºãããã®ã¨ãã¦ã¯ãåè¿°ã®ã¢ã¯ãã£ããã£ã¤ã³ã¸ã±ã¼ã¿ã®ã»ããèªã¿è¾¼ã¿åå¾ã§ã®ç»é¢ã®å¤åãå°ãªãéåæãä¸ããªãããè¯ãããã§ããã¾ããHUD ã表示ãã¦ããæã¯ã¦ã¼ã¶ã®åä½ã妨ãã¦ããï¼ããã«è¦ããï¼ãããæ¬å½ã«ã¦ã¼ã¶ã«ä½ããããå¾ ãããã¹ãç®æãªã®ããèããå¿ è¦ãããã¾ãã
ããããè¸ã¾ããã¨ãHUD ã使ããã¨ã«é©ãã¦ããå ´é¢ã¯ãå¦çãçµãããã¨ã«æã注ç®ãã¦ãããå¦çãçµããã¾ã§ã¯ç»é¢é·ç§»ããã¹ãã§ãªãã¨ããã¨è¨ãããã§ãããã®ãããHoliday ã§ã¯èªã¿è¾¼ã¿ä¸ã¨ããããã以ä¸ã®ãã㪠POST ã PATCH ã®å¦çä¸ã®å ´é¢ã§ HUD ã使ã£ã¦ãã¾ãã
- ã¦ã¼ã¶ç»é²ããã°ã¤ã³å¦ç
- æåããã¾ã§å ã«é²ããã¨ãã§ããªã
- 失æããå ´åå¿ è¦ã§ããã°å ¥åé ç®ãæ¸ãæãã¦å度å®è¡ããå¿ è¦ããã
- ããç¨åº¦ããªã¥ã¼ã ã®ããå
容ã®æ稿
- æ稿ãå®äºããããã¨ã確èªããã¾ã§ã¯ã¦ã¼ã¶ãå®å¿ã§ããªã
- 失æããå ´åãªãã©ã¤ããå¿ è¦ããã
å¾è ã®å ·ä½ä¾ã¨ãã¦ã¯ããã©ãã¬ã *2 ãæ稿ããå ´é¢ãæãããã¾ããæ稿ããããã®ã¯æ稿ããæã¨åãç»é¢ã«è¡¨ç¤ºããããããµã¼ãå´ã®å¦çãå¾ ããã«ã¯ã©ã¤ã¢ã³ãå´ã§å ã«è¡¨ç¤ºãå¤ãã¦ãã¾ããã¨ãã§ãã¾ããããã®å ´åã¯å¦çãå®äºããã¾ã§ã«æéãããã *3 ãã¨ããå¦çä¸ã§ãããã¨ãæ確ã«ä¼ããã»ããå®å¿æããããã¨ãã¾ããã£ãããªã©ã®ããã«çãæéã§é£æãããã®ã§ã¯ãªããã¨ãªã©ãèæ ®ããå¦çä¸ã¯ HUD ã表示ãã¦å¦çãå®äºããå¾ã«æ稿å 容ãåæ ããã *4 æ¹æ³ãåãã¾ããã
// ãªã¯ã¨ã¹ããéãåã« HUD ã表示 SVProgressHUD.show() Session.sendRequest(request) { result in switch result { case .Success(let response): // HUD ãæ¶ã SVProgressHUD.dismiss() // æåçµæãç»é¢ã«åæ ããå¦ç // ... case .Failure(let error): // HUD ã§ã¨ã©ã¼ã¡ãã»ã¼ã¸ã表示 SVProgressHUD.showErrorWithStatus("éä¿¡ã§ãã¾ããã§ãããããä¸åº¦ã試ããã ããã") } }
ãã¬ã¼ã¹ãã«ã
ã¢ã¯ãã£ããã£ã¤ã³ã¸ã±ã¼ã¿ã HUD ããèªã¿è¾¼ã¿ä¸ã§ãããã¨ã¯ã¦ã¼ã¶ã«ä¼ãããããã®ã®ãå¤ç¨ããã¨ãã£ã¨ãããå°è±¡ãä¸ãã¦ãã¾ãã¾ãï¼æä½ã®åº¦ã« HUD ã表示ããããä¸ç»é¢å ã«è¤æ°ã®ã¢ã¯ãã£ããã£ã¤ã³ã¸ã±ã¼ã¿ã使ç¨ãããâ¦ï¼ããã®ãããããç¨åº¦èªã¿è¾¼ã¿ãçºçãã¦ãããã¨ãäºæã§ããããªå ´æã«é¢ãã¦ã¯ãèªã¿è¾¼ã¿ä¸ã§ãããã¨ãæ示ããªãã¨ããã®ãä¸ã¤ã®é¸æè¢ã§ãã
èªã¿è¾¼ã¿ä¸ã§ãããã¨ãäºæãããããã«ããã¬ã¼ã¹ãã«ãã使ãã¨å¹æçã§ãããã¬ã¼ã¹ãã«ãã使ããã¨ã§ããã¼ã¿ã®èªã¿è¾¼ã¿ã®å®äºãå¾ ããã«å ã«ã¬ã¤ã¢ã¦ãã ããç»é¢ä¸ã«åæ ããä½æèªã¿è¾¼ã¿é度ãä¸ããã¨åæã«ãã¼ã¿åå¾å¾ã®ç»é¢ã¨ã®å·®åãå°ãªããããã¨ãã§ãã¾ãã
ãã¬ã¼ã¹ãã«ãã¯èªã¿è¾¼ã¿ã«æéããããç»åã«å¯¾ãã¦è¯ãå©ç¨ããã¾ããç»åã®èªã¿è¾¼ã¿ã¾ã§ãã¬ã¼ã¹ãã«ãç»åã表示ããããã«ã¯ SDWebImage ã® sd_setImageWithURL:placeholderImage:
ã¡ã½ããã使ãã¨ç°¡åã«å®ç¾ã§ãã¾ãã
Holiday ã§ã¯ç»åã®ãã¬ã¼ã¹ãã«ãã ãã§ãªããããã¤ãã®ç»é¢ã§ã»ã«ã®ãã¬ã¼ã¹ãã«ããå©ç¨ãã¦ãã¾ããä¾ãã°ãã§ãããã©ã³è©³ç´°ç»é¢ã§ã¯ãã©ã³å ã®ã¹ããããã³ã¬ã¯ã·ã§ã³ãã¥ã¼ã»ã«ã§è¤æ°è¡¨ç¤ºãã¦ãã¾ãããäºåã«ã¹ãããã®æ°ã ãèªã¿è¾¼ãã§ããããã©ã³è©³ç´°ç»é¢ã§ã¯ã¹ãããã®å 容ãèªã¿è¾¼ã¾ããã¾ã§ã¹ãããã®æ°ã ãã»ã«ã®ãã¬ã¼ã¹ãã«ãã表示ãã¦ãã¾ãã
override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { // ååãã¼ãæ㯠Plan ã¢ãã«ã«ç´ã¥ã Spot ã¢ãã«ãåå¾ã§ãã¦ããªãã®ã§ãäºåã« Plan ã¢ãã«ã«ä¿åããã¦ããã¹ãããæ° `spotCounts` åã ãã»ã«ã表示 return plan.spots.count > 0 ? plan.spots.count : plan.spotCounts.toInt() } override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCellWithReuseIdentifier(SpotCollectionViewCell.reuseIdentifier, forIndexPath: indexPath) as SpotCollectionViewCell // ã¹ããããã¼ã¿ãåå¾ã§ãã¦ããã¨ãã¯ãã®ãã¼ã¿ã§ã»ã«ãæç»ããããã§ãªãå ´åã¯ç©ºãã¼ã¿ã§ã»ã«ãæç» let spot: Spot? = plan.spots.count > indexPath.item ? plan.spots[indexPath.item] : nil cell.updateWithSpot(spot) return cell }
ãã¾ãï¼æåã®ãã¬ã¼ã¹ãã«ã
ã»ã«ãç»åã ãã§ãªããæåé¨åããã¬ã¼ã¹ãã«ãã¨ãã¦è¡¨ç¤ºãããã¿ã¼ã³ãå°ãåããæµè¡ã£ã¦ä½¿ããç¶ãã¦ãã¾ã *5 ãæåä¸å¿ã®ã³ã³ãã³ãã ã¨ã»ã«ãç»åã®ãã¬ã¼ã¹ãã«ãã ã¨ã¹ã«ã¹ã«ã«ãªãããããã¼ã¿èªã¿è¾¼ã¿å¾ã®ã¤ã¡ã¼ã¸ãæ³èµ·ãããããã«ã¯æå¹ã§ããã¾ããFacebook ãªã©ã¯ãã¬ã¼ã¹ãã«ãé¨åã®è²ãã¢ãã¡ã¼ã·ã§ã³ã§è¥å¹²å¤åããããã¨ã«ããèªã¿è¾¼ã¿ä¸ã§ãããã¨ã示ãã¦ãã¾ãã
Holiday ã§ã¯èªã¿è¾¼ã¿ä¸ã®ãã¬ã¼ã¹ãã«ãã¨ãã¦ã¯å©ç¨ãã¦ãã¾ãããããã§ãããã©ã³æ稿ç»é¢ãªã©ã§ BLOKK ã¨ãããã©ã³ããç¨ãã¦æåã®ãã¬ã¼ã¹ãã«ããè¨ç½®ãã¦ãã¾ãã
ãããã«
ä»å㯠iOS ã¢ããªã®èªã¿è¾¼ã¿ä¸ã® UI ã®ä¸ã§ãåºæ¬çã§æ軽ã«å®ç¾ã§ãã3ã¤ã®ä¾ãç´¹ä»ãã¾ããããã¡ããããã§ç´¹ä»ãããã®ãæ£è§£ã¨ã¯æã£ã¦ããããå®ç¾ããããã¨ãéæããããã®ä¸ã¤ã®åèã«ãªãã°è¯ãã¨æã£ã¦ãã¾ãã
ãªããHoliday ã§ã¯ãããã¯ããè¯ããã®ã«ããããã«ãã ãããæã£ã¦ãµã¼ãã¹éçºããããã¨ã³ã¸ãã¢ãåéãã¦ãã¾ããèå³ããæã¡ããã ããæ¹ã¯ãã²ãå¿åãã ããã
*1:ã¯ãã¯ãããã®100%åä¼ç¤¾
*2:åçã¨ã²ã¨ãã¨ã§ãã§ãããã©ã³ä½è ã«æè¬ã®ãã£ã¼ãããã¯ãä¼ãããã¨ãã§ãããã®
*3:åçã®ã¢ãããã¼ããããã¯ã°ã©ã¦ã³ãã§å ã«è¡ãã¨éä¿¡å¾ã®å®äºæéã¯çããªãã¾ãããã¾ã ããã¾ã§ã¯å®ç¾ã§ãã¦ãã¾ãã
*4:å¦çãå®äºããæã¯æ稿ãããã®ãç»é¢ã«åæ ããããããHUD ã§æåããæ¨ã®ã¡ãã»ã¼ã¸ãåºãã¦ãã¾ãã
*5:Facebook, Slack, Medium, Booking Now, TVShow Time ãªã©ã§è¦ããã¨ãã§ãã¾ã