Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iOS開発に慣れてきた時にやりがちあるある

 iOS開発に慣れてきた時にやりがちあるある

10.25 and factory BeerBash#4 での@domonrさんのスライドです。

andfactory, inc.

October 25, 2018
Tweet

More Decks by andfactory, inc.

Other Decks in Programming

Transcript

  1. 6

  2. func setup(adInfoList: [AdInfo]) { for adInfo in adInfoList { switch

    adInfo.asp { case .imobile: // ॳظԽॲཧ case .amoad: // ॳظԽॲཧ default: break } } } 7 "E.BOBHFSͷ4FUVQͰશ޿ࠂͷॳظԽΛߦͬͯɺ
  3. func showAd(adInfo: AdInfo) { switch adInfo.asp { case .imobile: //

    ޿ࠂදࣔॲཧ case .amoad: // ޿ࠂදࣔॲཧ default: break } } 8 ࢦఆͷ޿ࠂͷදࣔॲཧ͚ͩΛߦ͍͕ͬͯͨɺ
  4. 14

  5. protocol RequestProtocol { var dict: [String: String] { get }

    } extension CommonRequestProtocol { var dict: [String: String] { // ͍࣋ͬͯΔશม਺Λ഑ྻʹͯ͠ฦ͢ॲཧ } } protocol CommonRequestProtocol: RequestProtocol { var dict: [String: String] { get } } extension CommonRequestProtocol { var dict: [String: String] { // RequestProtocolͷdictʹΞΫηε͔͕ͨͬͨ͠ɺɺɺ return self.dict.merging(["key": Const.Key], uniquingKeysWith: +) } } 15 EJDUͷதͰEJDUʹΞΫηεͯ͠ແݶϧʔϓʹʜ
  6. 19

  7. switch p { case .free(let isRental): if isRental { …

    } case .ticket(let isRental): if isRental { … } } 20 ৗʹͭͷ৚݅Λҙࣝ͠ͳ͖Ό͍͚ͳ͍ͷͰॲཧ͕ෳࡶʹʜ
  8. enum PublishingType { case free case ticket … } let

    isRead: Bool 21 ͦΕͧΕผʑͷཁૉͳΜ͔ͩΒͦΕͧΕ࣋ͬͨ΄͏͕γϯϓϧʜ