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

RxSwift, Codable, Moya で API クッキング!

Akio Itaya
April 19, 2018

RxSwift, Codable, Moya で API クッキング!

potatotips 50

Akio Itaya

April 19, 2018
Tweet

More Decks by Akio Itaya

Other Decks in Technology

Transcript

  1. AKKEY / AKIO ITAYA
    Cyberagent, Inc.
    RxSwift, Codable, Moya
    API cookingʂ

    View full-size slide

  2. ໊લɿ൘୩ ߊྑɹ/ɹ͖͋ͬʔʢAKKEYʣ
    ৬छɿiOS
    ׆ಈɿ@AkkeyLab
    Ұݴɿప໷։ൃޙͷԾ຾தʹίʔσΟϯά͠·ͤΜʁ
    ࣗݾ঺հ
    ※ֶੜ࣌୅ͷݸਓ։ൃʹͯ

    View full-size slide

  3. ֶੜ࣌୅ͷݸਓ։ൃ͕ݩͷ͓࿩
    ʻ ஫ҙ ʼ

    View full-size slide

  4. ٕज़બఆ
    • RxSwift

    ɹɹʔʼɹKVO ຣফܭըͰ΋ͬͱษڧ͍ͨ͠ͱࢥͬͨ

    • Codable

    ɹɹʔʼɹApple ७ਖ਼ʹऒ͔Εͯ

    • Moya

    ɹɹʔʼɹAlamofire Λར༻ͯ͠ Rx Ͱॻ͖͔ͨͬͨ

    View full-size slide

  5. YouTube API Λͨͨ͘

    View full-size slide

  6. TargetType protocol
    ڞ௨߲໨Λ extension Ͱఆٛ
    Codable

    View full-size slide

  7. TargetType protocol
    ↓API ϦΫΤετͷ1ͭˣ
    Response Λ Codable Ͱࢦఆ

    View full-size slide

  8. TargetType protocol - MultiTarget
    Singleton Ͱ provider ։์ʹΑΔ subscribe ෆՄΛ๷ࢭ
    Singleton

    View full-size slide

  9. TargetType protocol - MultiTarget
    Singleton Ͱ provider ։์ʹΑΔ subscribe ෆՄΛ๷ࢭ
    Singleton
    TargetType ͷܕʹґଘ͠ͳ͍

    View full-size slide

  10. TargetType protocol - MultiTarget
    Singleton Ͱ provider ։์ʹΑΔ subscribe ෆՄΛ๷ࢭ
    Response Λ subscribe Մೳ
    Singleton
    TargetType ͷܕʹґଘ͠ͳ͍

    View full-size slide

  11. TargetType protocol - MultiTarget
    Singleton Ͱ provider ։์ʹΑΔ subscribe ෆՄΛ๷ࢭ
    Response ͷ Json ΛϚοϐϯά
    Response Λ subscribe Մೳ
    Singleton
    TargetType ͷܕʹґଘ͠ͳ͍

    View full-size slide

  12. Codable
    ↓API ϦΫΤετͷ1ͭˣ

    View full-size slide

  13. API ͷݺͼग़͠
    Rx ͳॲཧͰγϯϓϧʹهड़Մ
    औಘ݅਺

    View full-size slide

  14. API ͷݺͼग़͠
    Rx ͳॲཧͰγϯϓϧʹهड़Մ
    औಘ݅਺
    ֤छ஋Λར༻ͨ͠ݸਓతͳ࣮૷

    View full-size slide

  15. Result
    YouTube ranking Top 50 !!

    View full-size slide

  16. ࠷ۙͷ͓ؾʹೖΓͰ͢ʢস

    View full-size slide

  17. GitHub / Qiita : @AkkeyLab

    View full-size slide

  18. Thank you !!

    View full-size slide