Installation my own framework with Carthage

Installation my own framework with Carthage

2015年12月22日に開催された「関西モバイルアプリ研究会#9」の発表資料です。

Carthageで自作クソライブラリをインストールしてみました。
ほぼ@ikesyoさんが発表済みの内容になります。
それでも自分で試したので発表します😅

5eee847529e8f5ec2f634a85075fd5aa?s=128

Satoshi Hachiya

December 22, 2015
Tweet

Transcript

  1. ؔ੢ϞόΠϧΞϓϦݚڀձ JPMartha *OTUBMMBUJPO NZPXOGSBNFXPSL XJUICarthage 

  2. CarthageͰ ࣗ࡞Ϋι ϥΠϒϥϦΛ Πϯετʔϧͯ͠Έ·ͨ͠ (Xcode 7.2, iOS 9.2, Carthage 0.11.0)

     https://github.com/Carthage/Carthage
  3. Carthage ͱ͍͑͹ @ikesyo͞Μ  https://github.com/Carthage/Carthage/pulse

  4. ΄΅@ikesyo͞Μ͕ ൃදࡁΈͷ಺༰ʹͳΓ·͢
 ʢҎԼ͸ͦͷଞΛؚΊͨࢀߟࢿྉʣ • Carthageʹ͍ͭͯ஌Γ͍ͨnݸͷ͜ͱ (@ikesyo)
 http://www.slideshare.net/syoikeda/carthagen • iOSͰͷFrameworkಋೖͷ͓͞Β͍ (@ikesyo)


    http://www.slideshare.net/syoikeda/iosframework • SwiftͰϥΠϒϥϦΛެ։͢Δ (@morizotter)
 http://qiita.com/morizotter/items/2e45f8f94c1010ebd69f • SwiftΛ࢖ͬͯϞμϯͳWeb APIΫϥΠΞϯτΛര଎Ͱ։ൃ͢Δ (@giginet)
 http://qiita.com/giginet/items/1e64f584f948661cffd1 • γϯϓϧͳґଘؔ܎؅ཧγεςϜ Carthage (Realm)
 https://realm.io/jp/news/swift-dependency-management-with-carthage/ 
  5. ͦΕͰ΋ࣗ෼Ͱࢼͨ͠ͷͰ ൃද͠·͢ 

  6. ࠓޙͷࣗ෼ͷ ؔϞόͰͷ՝୊͸ ϦϦʔε͢Δ͜ͱͰ͢ 

  7. ϦϦʔεͱ͍ͬͯ΋ ͍ͣΕʹͯ͠΋࣮ྗ࣍ୈͰ͕͢… ᶃ App StoreͰϦϦʔε ‣ ͓ͦΒ͘Ṷ͔Βͳ͍Ͱ͢ΑͶ… ᶄ GitHubͰϦϦʔε ‣

    Φʔϓϯιʔε׆ಈ͢Δํָ͕ͦ͠͏ 
  8. &·ͣࠓճ͸؀ڥ࡞ΓͰ͢ ʢࣗ࡞ϥΠϒϥϦͷத਎͸Ϋιʣ ⚠ Himotoki ͱ APIKit Λ࢖͍ͬͯ·͕͢ ܾͯͦ͠ΕΒͷ͜ͱͰ͸͋Γ·ͤΜɻ 

  9. ͱΓ͋͑ͣάάΓ·ͨ͠ w SwiftͰϥΠϒϥϦΛެ։͢Δ @morizotter  http://qiita.com/morizotter/items/2e45f8f94c1010ebd69f ‣ ґଘϓϩδΣΫτ͕͋Δέʔε͕ͳ͔ͳ͔ݟ౰ͨΓ·ͤΜ 

  10. Himotoki, APIKitΛ ͷ͍ͧͯΈ·ͨ͠ 

  11. git submodule .gitmodules͸ Carthage ͕
 ੜ੒͠·͢ɻ 

  12. Carthage/Checkouts/ CarthageͰbuildͯ͠
 GitHub΁Pushͨ͠Β
 ͜͏ͳΓ·͢ɻ 

  13. ͱΓ͋͑ͣϚω͠ͳ͕Β ΍ͬͯΈ·ͨ͠ 

  14. ࣗ࡞ϥΠϒϥϦଆ 

  15. ࣗ࡞ϥΠϒϥϦଆͰ΍Δ͜ͱ ᶃ FrameworkΛ࡞੒ ᶄ Carthage.pkgΛΠϯετʔϧʢ˞ࠓճলུʣ ᶅ CartfileΛ࡞੒ ᶆ carthage updateΛ࣮ߦ

    ᶇ carthage buildΛ࣮ߦ ᶈ GitHubͰrelease 
  16. ᶃFrameworkΛ࡞੒ ֎෦͔ΒࢀরͰ͖ΔΑ͏publicʹ͠·͢ɻ public final class Connpass {
 
 public static

    func sendSearchEventRequest() {
 
 // ͝ʹΐ͝ʹΐ
 
 }
 
 } 
  17. ᶃFrameworkΛ࡞੒ 

  18. ᶃFrameworkΛ࡞੒ Manage SchemesͰ☑Shared ʹ͠·͢ɻ 

  19. ᶃFrameworkΛ࡞੒  ⚠ ൃදޙ௥ิɿRun Script ͸ઃఆෆཁͰ͢ɻ
 ʮϑϨʔϜϫʔΫΛϑϨʔϜϫʔΫʹຒΊࠐ·ͣɺ ΞϓϦϨϕϧͰϦϯΫɺຒΊࠐΈΛ͠·͠ΐ͏ɻʯ(@ikesyo)
 http://www.slideshare.net/syoikeda/dynamic-frameworks-tips

  20. ᶅCartfileΛ࡞੒ github "ikesyo/Himotoki" ~> 1.3 github "ishkawa/APIKit" ~> 1.1.2 

  21. ᶆcarthage updateΛ࣮ߦ $ carthage update
 --use-submodules --platform iOS ⚠ Φϓγϣϯ͕ٯͩͱࣦഊ͠·ͨ͠ɻ

    ‣ Φϓγϣϯ —-use-submodules • ґଘϓϩδΣΫτΛGitͷαϒϞδϡʔϧͱͯ͠௥Ճ͠·͢ɻ —-platform iOS • ࠓճiOSͷΈΛର৅ͱͨ͠ͷͰࢦఆ͠·͢ɻ 
  22. ᶆcarthage updateΛ࣮ߦ Carthage/BuildͱCarthage/Checkouts ϑΥϧμ಺ʹͦΕͧΕͷFrameworkͷϑΝΠϧ͕ ੜ੒͞Ε·ͨ͠ɻ ‣ Himotoki ‣ APIKit ‣

    ResultʢAPIKit͕ґଘ͍ͯ͠Δʣ 
  23. ᶇ carthage buildΛ࣮ߦ $ carthage build
 —-no-skip-current --platform iOS ⚠

    Φϓγϣϯ͕ٯͩͱࣦഊ͠·ͨ͠ɻ ‣ Cathage/Build/iOS/ w ConnpassAPIClient.framework͕ੜ੒͞Ε·ͨ͠ɻ 
  24. .gitmodulesΛੜ੒ (Carthage) [submodule "Carthage/Checkouts/Himotoki"]
 path = Carthage/Checkouts/Himotoki
 url = https://github.com/ikesyo/Himotoki.git

    [submodule "Carthage/Checkouts/Result"]
 path = Carthage/Checkouts/Result
 url = https://github.com/antitypical/Result.git [submodule "Carthage/Checkouts/APIKit"]
 path = Carthage/Checkouts/APIKit
 url = https://github.com/ishkawa/APIKit.git
 ‣ࣗ෼Ͱઌʹ࡞͍ͬͯͨ৔߹͸௥ه͞Ε·ͨ͠ɻ 
  25. .git/configʹ௥ه (Carthage) Carthage/Checkouts/ {Framework໊}ͷ
 submodule͕௥ه͞Ε·ͨ͠ɻ 

  26. Carthage/Checkouts/  ⚠Himotoki΍APIKitͱಉ༷ʹͳΓ·͕ͨ͠ Ӆ͠ϑΝΠϧͳͲΛݟͯ΋࢓૊Έ͸Θ͔Γ·ͤΜ


  27. ᶇGitHubͰrelease w CarthageͰ͸ʮv1.2.3ʯͷΑ͏ʹׂΓ౰ͯ·͢ɻ ˠsemantic version 
 ʮv0.0.8-alphaʯͱλά෇͚ͯ͠
 Pre-release͠·ͨ͠ɻʢ-alpha΍-beta͸0,ʣ 

  28. ࢖͏ଆ 

  29. ࢖͏ଆͰ΍Δ͜ͱ ᶃ CartfileΛ࡞੒ ᶄ carthage updateΛ࣮ߦ ᶅ FrameworkΛ૊ΈࠐΈ 

  30. ʮv0.0.8-alphaʯΛର৅ͱ͢Δ৔߹͸
 ࣍ͷͱ͓Γهड़͠·͢ɻ github "JPMartha/ConnpassAPIClient" ~> 0.0.8 ᶃCartfileΛ࡞੒ 

  31. ᶄcarthage updateΛ࣮ߦ $ carthage update --platform iOS ‣ Carthage/Build/ w

    iOS, MacOS, tvOS, watchOS ‣ Carthage/Checkouts/ w Himotoki, ConnpassAPIClient 
  32. APIKit͸ϏϧυࡁΈόΠφϦ͕ μ΢ϯϩʔυ͞Ε·͢ *** Fetching ConnpassAPIClient *** Fetching Himotoki *** Fetching

    APIKit *** Fetching Result *** Checking out ConnpassAPIClient at "v0.0.8-alpha" *** Checking out Himotoki at "1.3.2" *** Downloading APIKit.framework binary at "1.1.2: Fix Content-Type" *** Downloading Result.framework binary at "1.0.1: A New Beginning" *** xcodebuild output can be found in ....log *** Building scheme "Himotoki-iOS" in Himotoki.xcodeproj *** Building scheme "ConnpassAPIClient" in ConnpassAPIClient.xcodeproj 
  33. APIKitͷrelease  ϏϧυࡁΈόΠφϦʢzipϑΝΠϧʣ͕͋ΔͨΊͰ͢ɻ

  34. ࢀߟɿHimotokiͷrelease 

  35. ᶅFrameworkΛ૊ΈࠐΈ 

  36. +࣮ફ 

  37. FrameworkΛimport࣮ͯ͠ߦ import UIKit import ConnpassAPIClient // ࣗ࡞ϥΠϒϥϦ class ViewController: UIViewController

    { @IBAction func buttonTapped(sender: UIButton) {
 // Connpass͔Β”ؔ੢ϞόΠϧΞϓϦݚڀձ”Λݕࡧ Connpass.sendSearchEventRequest() 
 } } 
  38. ㊗੒ޭ
 ʢ+40/Λσίʔυͯ͠ϩάग़ྗ͢Δ͚ͩͷΫιϥΠϒϥϦʣ results_returned: 9 results_available: 9 results_start: 1 event_id: 23958

    title: ؔ੢ϞόΠϧΞϓϦݚڀձ #9 description: <p>iOS/AndroidΞϓϦ։ൃऀ޲͚ͷษڧձͰ͢ɻ</p> <h1>ձ৔</h1> <p>͸ͯͳژ౎ΦϑΟε8F ηϛφʔϧʔϜ</p> <p>19࣌10෼ΑΓड෇Λ։࢝͠·͢ɻ</p> <h2>ೖΓํ</h2> <p>19࣌ʹͳΔͱϏϧͷਖ਼໘ೖΓޱͷγϟολʔ͕ԼΓ·͢ɻ޲͔ͬͯࠨखͷ௨Γʹ͋Δ௨༻ޱ͔Β͓ೖΓ͍ͩ͘͞ɻ௨༻ޱ͕ด·ͬ ͍ͯΔ৔߹ʹ͸Πϯλʔϗϯ͔Βʮ801ʯΛݺͼ͍ͩͯͩ͘͠͞ɻ</p> <h1>։࠵֓ཁ</h1> <p>࠷ߴͷϞόΠϧΞϓϦΛ࡞Γ͍ͨσϕϩούʔ͕ɺ͓ޓ͍ʹ࠷৽ͷ஌ݟΛ൸࿐ͯ͠ަྲྀ͢ΔݚڀձͰ͢ɻ</p> <p>ͦΕͧΕͷൃද͸࣋ͪ࣌ؒ5෼ͷϥΠτχϯάτʔΫʢLTʣܗࣜͱ͠·͢ɻݪଇͱͯ͠5෼Ҏ಺ʹɺҴ࠺ͷΑ͏ͳ଎͞ͱ੎͍Ͱ͓࿩ ͍͖ͨͩ͠·͢ɻ</p> <h1>࠙਌ձ</h1> <p>ൃදऴྃޙʹ࠙਌ձΛاը͍ͯ͠·͢ɻฃͬͯ͝ࢀՃ͍ͩ͘͞ɻ</p> <p>Ϗʔϧ΍ܰ৯Λ༻ҙ͍ͯ͠·͢ɻ</p> <h1>λΠϜςʔϒϧ</h1> <p>TBD</p> event_url: http://kanmoba.connpass.com/event/23958/ 
  39. ࠷ޙʹࣗ࡞ϥΠϒϥϦͰ͓ࢼ͠ $ carthage archive ConnpassAPIClient ‣࣮ߦ݁Ռ *** Found Carthage/Build/iOS/ConnpassAPIClient.framework ***

    Found Carthage/Build/iOS/ConnpassAPIClient.framework.dSYM *** Found Carthage/Build/iOS/2209388D-3339-30F6-B80B-A779B6C91550.bcsymbolmap *** Found Carthage/Build/iOS/3841BD75-0DB2-3250-8395-786A569C7368.bcsymbolmap *** Created ConnpassAPIClient.framework.zip ‣ϦϙδτϦͷ௚ԼʹzipϑΝΠϧ͕ੜ੒͞Ε·ͨ͠ɻ 
  40.  ‣ GitHub ͰΞοϓϩʔυ͢Ε͹ Carthage Ͱμ΢ϯϩʔυͰ͖·͢ɻ ‣ Push ͚ͨͩ͠Ͱ͸ࣗಈతʹઃఆ͞Ε·ͤΜɻ(Pushෆཁ)

  41. Ҏ্ ͋Γ͕ͱ͏͍͟͝·ͨ͠‼