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

Embedded FrameworkからSPMへ 段階的移行の軌跡

ras0q
July 20, 2023

Embedded FrameworkからSPMへ 段階的移行の軌跡

2023/07/20のpixiv App Nightでの発表スライドです。
https://pixiv.connpass.com/event/288082/

ras0q

July 20, 2023
Tweet

More Decks by ras0q

Other Decks in Programming

Transcript

  1. Ras
    Embedded Framework͔ΒSPM΁


    ஈ֊తҠߦͷي੻

    View full-size slide

  2. ࣗݾ঺հ
    • Ras (Β͢)


    • {Twitter, GitHub, Scrapbox}: @ras0q


    • ඿দ͔Β্ژͯ͠4೥໨Ͱ͢


    • pixivࣄۀຊ෦/ΞϓϦΤϯδχΞϦϯάνʔϜ (ΞϧόΠτ)


    • Ҏલ·ͰSketchνʔϜʹ͍·ͨ͠ 👈 ࠓճ͸͜ͷͱ͖ͷ࿩


    • ౦ژ޻ۀେֶ B4 / σδλϧ૑࡞ಉ޷ձtraP


    • ීஈ͸GoͰόοΫΤϯυΛॻ͍͍ͯ·͢


    • iOSDC 2023ग़·͢ʂʂʂʂʂʂʂʂʂʂʂʂʂ

    View full-size slide

  3. Swift Package ManagerͰ


    ϓϩδΣΫτ؅ཧ͠·ͤΜ͔ʁ

    View full-size slide

  4. ͷલʹSwift Package Manager


    ʹ͍ͭͯগ͚ͩ͠

    View full-size slide

  5. Swift Package Manager (SPM)
    • Appleެࣜͷύοέʔδ؅ཧπʔϧ (2019~)


    • ͜Ε·Ͱ͸CocoaPods΍Carthage͕ओྲྀ


    • ϥΠϒϥϦ΍ϓϩμΫτΛSwiftϑΝΠϧͰ؅ཧͰ͖Δ


    • Package.swiftʹґଘؔ܎Λهड़Ͱ͖Δ


    • Մಡੑͷ޲্


    • ίϯϑϦΫτ͕ى͖ʹ͍͘


    • XcodeprojͰͷύοέʔδ؅ཧ͸සൟʹίϯϑϦΫτ͢Δ

    View full-size slide

  6. SPMΛϓϩδΣΫτʹ࢖͏ͱ…
    • ϓϩδΣΫτΛϞδϡʔϧʹ؆୯ʹ෼ׂͰ͖Δ


    • ϓϩδΣΫτͷmonorepoԽ


    • ґଘؔ܎͕ίʔυ্Ͱ໌֬ʹͳΔ


    • νʔϜ։ൃͰ΋ίϯϑϦΫτ͠ͳ͍


    • ͜Ε·Ͱ͸֤ϞδϡʔϧʹxcodeprojΛ഑ஔ (Embedded Framework)


    • ࡞੒ɾ؅ཧ͕େม

    View full-size slide

  7. Swift Package ManagerͰ


    ϓϩδΣΫτ؅ཧ͠·ͤΜ͔ʁ

    View full-size slide

  8. pixiv Sketch
    • ͓ֆ͔͖ίϛϡχέʔγϣϯΞϓϦ


    • ʮ೔ʑͷ͓ֆ͔͖Λ΋ͬͱָ͘͠ʯ


    • ΞϓϦ্Ͱֆ͕͔͚Δ


    • ίϝϯτػೳɺϥΠϒ഑৴ػೳͱ͔΋͋Δ


    • ຖ೔͓୊͕ߋ৽͞ΕΔ

    View full-size slide

  9. SketchͷϞδϡʔϧ؅ཧ
    • Embedded FrameworkͰ֤ϞδϡʔϧΛ؅ཧ


    • ৽نϞδϡʔϧͷ࡞੒͕େม


    • ίϯϑϦΫτ͕සൃ


    • SPMΛ࢖ͬͯϞμϯͰվमʹڧ͍Ϟδϡʔϧ؅ཧʹ੾Γସ͍͑ͨ


    • ҠߦͰ͖Δ෦෼Λஈ֊తʹҠߦͨ͠

    View full-size slide

  10. SketchͰͷSPMҠߦखॱ
    1. Ҡߦ͕೉ͦ͠͏ͳϞδϡʔϧͷચ͍ग़͠


    2. ҠߦͰ͖ͦ͏ͳϞδϡʔϧͷҠߦखॱΛܾΊΔ


    3. ϞδϡʔϧΛ·ͱΊΔύοέʔδΛ࡞੒


    4. ҠߦखॱʹԊͬͯ1ͭͣͭҠߦΛߦ͏

    View full-size slide

  11. SketchͰͷSPMҠߦखॱ
    1. Ҡߦ͕೉ͦ͠͏ͳϞδϡʔϧͷચ͍ग़͠


    2. ҠߦͰ͖ͦ͏ͳϞδϡʔϧͷҠߦखॱΛܾΊΔ


    3. ϞδϡʔϧΛ·ͱΊΔύοέʔδΛ࡞੒


    4. ҠߦखॱʹԊͬͯ1ͭͣͭҠߦΛߦ͏

    View full-size slide

  12. 1. Ҡߦ͕೉ͦ͠͏ͳϞδϡʔϧͷચ͍ग़͠
    • ґଘ͍ͯ͠ΔϥΠϒϥϦ͕SPMʹରԠ͍ͯ͠ͳ͍


    • UIपΓ͸Ұ୴์ஔ


    • storyboard΍xibϑΝΠϧͷҠߦ͕೉͍͠


    • ແཧ͗ͣ͢͠


    • Ҡߦ͕೉͍͠ͱ͜Ζ͸ͱΓ͋͑ͣͦͷ··Ͱ

    View full-size slide

  13. SketchͰͷSPMҠߦखॱ
    1. Ҡߦ͕೉ͦ͠͏ͳϞδϡʔϧͷચ͍ग़͠


    2. ҠߦͰ͖ͦ͏ͳϞδϡʔϧͷҠߦखॱΛܾΊΔ


    3. ϞδϡʔϧΛ·ͱΊΔύοέʔδΛ࡞੒


    4. ҠߦखॱʹԊͬͯ1ͭͣͭҠߦΛߦ͏

    View full-size slide

  14. 2. ҠߦͰ͖ͦ͏ͳϞδϡʔϧͷҠߦखॱΛܾΊΔ
    • ·ͣ͸ଞ΁ͷґଘ͕ͳ͍SketchModelΛҠߦ


    • ͦͷ࣍ʹUI΍഑৴΁ͷґଘ͕গͳ͍SketchCommon΍SketchAPIΛҠߦ


    • UI΍഑৴पΓ͸Ұ୴์ஔ

    View full-size slide

  15. SketchͰͷSPMҠߦखॱ
    1. Ҡߦ͕೉ͦ͠͏ͳϞδϡʔϧͷચ͍ग़͠


    2. ҠߦͰ͖ͦ͏ͳϞδϡʔϧͷҠߦखॱΛܾΊΔ


    3. ϞδϡʔϧΛ·ͱΊΔύοέʔδΛ࡞੒


    4. ҠߦखॱʹԊͬͯ1ͭͣͭҠߦΛߦ͏

    View full-size slide

  16. 3. ϞδϡʔϧΛ·ͱΊΔύοέʔδΛ࡞੒
    • ϝχϡʔόʔ͔ΒύοέʔδΛ࡞੒


    • ϓϩδΣΫτ௚Լʹ഑ஔ


    • xcworkspaceʹ௥Ճ


    • SketchͰ͸SketchPackageΛ࡞੒

    View full-size slide

  17. SketchͰͷSPMҠߦखॱ
    1. Ҡߦ͕೉ͦ͠͏ͳϞδϡʔϧͷચ͍ग़͠


    2. ҠߦͰ͖ͦ͏ͳϞδϡʔϧͷҠߦखॱΛܾΊΔ


    3. ϞδϡʔϧΛ·ͱΊΔύοέʔδΛ࡞੒


    4. ҠߦखॱʹԊͬͯ1ͭͣͭҠߦΛߦ͏

    View full-size slide

  18. 4. ҠߦखॱʹԊͬͯ1ͭͣͭSPMҠߦΛߦ͏
    ※ Ϟδϡʔϧ໊͸Moͱ͠·͢


    • project_root/MoΛSketchPackage/MoʹҠಈ͢Δ


    • Mo.xcodeprojΛ࡟আ


    • ֤targetͷґଘϥΠϒϥϦ͔ΒMo.frameworkΛ࡟আ & MoϞδϡʔϧΛ௥Ճ


    • assetϑΝΠϧͳͲ͸ೝࣝ͞Εͳ͍ͨΊ஫ҙ


    • reference error ى͖͕ͪ (࠶ىಈͰେମ࣏Γ·͢)

    View full-size slide

  19. ҠߦखॱΛܾΊͯ


    ແཧͤͣSPMҠߦ͠Α͏

    View full-size slide

  20. ࢀߟ
    • Swift.org - Package Manager


    • Swift Package centered project - Build and Practice - Speaker Deck


    • iOSΞϓϦͰSPMΛ༻͍ͨϚϧνϞδϡʔϧߏ੒Λࢼͯ͠Έͨ - Zenn

    View full-size slide

  21. ͓·͚
    • SPMͷϞδϡʔϧ෼ׂΛ࢖ͬͯݸਓΞϓϦΛ։ൃ͍ͯ͠·͢


    • github.com/ras0q/traq-ios-clone


    • traQͷiOSΫϥΠΞϯτ


    • ׬੒࣌ظ͸ະఆͰ͢

    View full-size slide