Share Xcode Templates
 with team

Share Xcode Templates
 with team

テンプレートの作成と共有を簡単にしよう

https://github.com/ngtk/xcode-template

88cc995ce5954b15c12ea14904258757?s=128

Kento Nagata

May 23, 2018
Tweet

Transcript

  1. ©2018 Wantedly, Inc. Share Xcode Templates
 with team potatotips #51


    23.May.2018 - @ngtk, Kento Nagata ςϯϓϨʔτͷ࡞੒ͱڞ༗Λ؆୯ʹ͠Α͏
  2. ©2018 Wantedly, Inc. Ӭా݈ਓ 8BOUFEMZ *OD&OHJOFFS !OHULOU !OHUL • Wantedly

    VisitͷΞϓϦΛ։ൃ͍ͯ͠·͢ • Swift/iOS։ൃΛ͸͡Ίͯ5ϲ݄͘Β͍ • ͦͷલ͸Rails, React, Reduxͱ͔΢Σϒͷ։ൃΛ΍͍ͬͯͨਓ • Potatotips͸લճʹଓ͖2ճ໨ ☺
  3. ©2018 Wantedly, Inc. XcodeͷςϯϓϨʔτػೳ
 ࢖ͬͨ͜ͱ͋Γ·͔͢ʁ

  4. ©2018 Wantedly, Inc. ҰൠʹɺςϯϓϨʔτػೳ͸
 ڞ௨ͷهड़Λॻ͔ͣʹࡁΉͷͰੜ࢈త

  5. ©2018 Wantedly, Inc. ΋ͪΖΜɺ
 ϓϩτίϧΤΫεςϯγϣϯ
 ίʔυࣗಈੜ੒
 ͳͲίʔυʹΑΔڞ௨ԽʹΑͬͯهड़ྔΛ
 ݮΒ͢͜ͱ͕લఏͰɺ
 ࢒Δஆ͔ຯ͕ςϯϓϨʔτ

  6. ©2018 Wantedly, Inc. XcodeͰ͸Ͳ͏ͳͷ͔ʁ

  7. ©2018 Wantedly, Inc. How to use Xcode template New File

    FIle > New > File…⌘N͔Β৽ن࡞੒͢Δͱ͖ʹબ΂ Δɻ
  8. ©2018 Wantedly, Inc. How to use Xcode template File Template

    Library XcodeͷӈԼʹ͋Δ΍ͭɺ͔͜͜Βυϥοάͯ͠ࠨ ΧϥϜͷσΟϨΫτϦ(Project Navigator)ʹυϩο ϓ͢Δͱ࡞੒Ͱ͖Δɻ
  9. ©2018 Wantedly, Inc. Αͦ͞͏Ͱ͢Ͷʂ

  10. ©2018 Wantedly, Inc. ͨͩ͠ɺΧελϜͰ௥Ճ͢Δํ๏΍
 ϓϩδΣΫτͰڞ༗͢Δํ๏͸ɺ
 ެࣜͷυΩϡϝϯτ͕ͳ͍ͨΊ ෼͔ΓͮΒ͍…

  11. ©2018 Wantedly, Inc. ͔͠΋ɺProject΍WorkspaceͰ
 ڞ༗͢Δ࢓૊Έ͸ఏڙ͞Ε͍ͯͳ͍

  12. ©2018 Wantedly, Inc. ڞ༗͢Δ࢓૊ΈΛ࡞Δ

  13. ©2018 Wantedly, Inc. 1. ৽ن௥Ճ:
 ϓϦηοτͰ༻ҙ͞Ε͍ͯΔ΋ͷΛίϐϖͯ͠ ࡞੒ 2. ڞ༗ํ๏:
 ϦϙδτϦʹνΣοΫΠϯͯ͠ɺ


    ద੾ͳ৔ॴʹϦϯΫ͢ΔεΫϦϓτΛॻ͘ ΍Δ΂͖͜ͱ
  14. ©2018 Wantedly, Inc. ϓϦηοτͷςϯϓϨʔτ(Swift File)Λ
 ϦϙδτϦʹίϐʔͯ͠௥Ճ A"QQMJDBUJPOT9DPEFBQQ$POUFOUT%FWFMPQFS-JCSBSZ9DPEF 5FNQMBUFT'JMFa5FNQMBUFT4PVSDF4XJGUa'JMFYDUFNQMBUFA

  15. ©2018 Wantedly, Inc.

  16. ©2018 Wantedly, Inc. ___FILEBASENAME___.swift

  17. ©2018 Wantedly, Inc. TemplateInfo.plist

  18. ©2018 Wantedly, Inc. ςϯϓϨʔτϑΝΠϧΛ
 ద੾ͳ৔ॴʹ഑ஔ͢Δ
 εΫϦϓτΛॻ͘

  19. ©2018 Wantedly, Inc. ద੾ͳ৔ॴ A)0.&-JCSBSZ%FWFMPQFS9DPEF5FNQMBUFTA

  20. ©2018 Wantedly, Inc. ೉͍͠ʂ

  21. ©2018 Wantedly, Inc. #!/bin/bash project_template_dir=$(cd $(dirname ${BASH_SOURCE:-$0})/../Templates; pwd) global_template_dir="$HOME/Library/Developer/Xcode/Templates" global_project_template_dir="$global_template_dir/visit-ios"

    function main() { prepare link_project_to_global echo "" echo "Installed✨ " echo "" show_instruction } function prepare() { if [ ! -e $global_template_dir ]; then mkdir -p $global_template_dir echo "+ Created template directory: $global_template_dir" fi } function link_project_to_global() { if [ -e "$global_project_template_dir" ]; then echo "Alread linked. $global_project_template_dir" echo "" show_instruction exit 1 fi ln -s $project_template_dir $global_project_template_dir echo "+ Linked to $global_project_template_dir" } function show_instruction() { echo "You can use it from \"File Template Library\"." echo "" echo " Xcode > View > Utilities > Show File Template Library" echo "" } main Install-template
  22. ©2018 Wantedly, Inc. ͋ͱ͸ΈΜͳʹ࣮ߦͯ͠΋Β͏͚ͩʂ

  23. ©2018 Wantedly, Inc. ΊͰͨ͠ɺΊͰͨ͠ʂ ✨

  24. ©2018 Wantedly, Inc. Μɺͪΐͬͱ଴ͬͯ

  25. ©2018 Wantedly, Inc. ͜Ε৽͘͠ςϯϓϨʔτ௥Ճ͢Δͷ
 ΊΜͲ͘͘͞ͳ͍ʁ

  26. ©2018 Wantedly, Inc. ଞͷϓϩδΣΫτͰ
 ࠶ݱͮ͠Β͍Α͏ͳ…

  27. ©2018 Wantedly, Inc. ͱ͍͏͜ͱͰɺίϚϯυʹ͠·ͨ͠

  28. ©2018 Wantedly, Inc. “xcode-template” ςϯϓϨʔτͷ࡞੒ͱڞ༗Λ؆୯ʹ IUUQTHJUIVCDPNOHULYDPEFUFNQMBUF

  29. ©2018 Wantedly, Inc. $ brew install ngtk/tools/xcode-template )PNFCSFXͰΠϯετʔϧͰ͖·͢ IUUQTHJUIVCDPNOHULYDPEFUFNQMBUF

  30. ©2018 Wantedly, Inc. $ xctemplate g UIViewController ςϯϓϨʔτΛ࡞੒ͯ͠ɺϓϩδΣΫτ಺ʹ഑ஔ
 IUUQTHJUIVCDPNOHULYDPEFUFNQMBUF

  31. ©2018 Wantedly, Inc. $ xctemplate link 9DPEFͰར༻Մೳʹ͢Δ
 IUUQTHJUIVCDPNOHULYDPEFUFNQMBUF

  32. ©2018 Wantedly, Inc.

  33. ©2018 Wantedly, Inc. ੋඇɺ࢖ͬͯΈ͍ͯͩ͘͞

  34. ©2018 Wantedly, Inc. ·ͱΊ

  35. ©2018 Wantedly, Inc. 1. ςϯϓϨʔτΛ࢖ͬͯޮ཰Խ͠Α͏ • ͦͷલʹίʔυͰͰ͖Δڞ௨Խ͸΍Ζ͏ʂ 2. νʔϜͰڞ༗͠Α͏ 3.

    xcode-templateͰ؆୯ʹ࡞੒ɾڞ༗Ͱ͖ΔΑ • https://github.com/ngtk/xcode-template • ࠓ೔࡞ͬͯ·ͩࡶͳͱ͜Ζ͕ଟ͍ͷͰɺ͜ͷޙ΋͏ͪΐͬͱؤுΓ·͢ ·ͱΊ
  36. ©2018 Wantedly, Inc. Thank you! ☺