Xcode6のFramework Templateについて

D72f33c62d4174992d1895ad1a3df9ab?s=47 haranicle
October 31, 2014

Xcode6のFramework Templateについて

D72f33c62d4174992d1895ad1a3df9ab?s=128

haranicle

October 31, 2014
Tweet

Transcript

  1. 9DPEFͷ 'SBNFXPSL 5FNQMBUF ʹ͍ͭͯ !IBSBOJDMF

  2. αϯϓϧίʔυ w IUUQTHJUIVCDPNIBSBOJDMF 4VTIJ,JU4BNQMF w IUUQTHJUIVCDPNIBSBOJDMF 4VTIJ.BOJBY

  3. ࣗݾ঺հ w !IBSBOJDMF w J04ΞϓϦ։ൃ ٕज़ࢧԉ w ͨ·ʹαʔόαΠυ (SBJMT 

    w ͱ͖Ͳ͖"OESPJE ಛघจࣈ ແྉҐ ϕετ৽ண"QQ 23ίʔυ Ϧʔμʔ ͑΋ελϯϓ ͨ΂Χϝϥ
  4. એ఻ ಛघจࣈΩʔϘʔυ J04ͷػछґଘจࣈΛ ऩ࿥ͨ͠ ΩʔϘʔυΞϓϦ ͥΜͥΜചΕͳ͍͔Β ࠓ೔͚ͩແྉʹͨ͠Αʂ "QQ4UPSFͰ ʮIBSBOJDMFʯͰݕࡧ

  5. એ఻ w IUUQZIJPTDPOOQBTTDPNFWFOU

  6. ΞδΣϯμ ✴'SBNFXPSLͱ͸ ✴'SBNFXPSL5FNQMBUFͱ͸ ✴'SBNFXPSL5FNQMBUF1SPKFDU ✴6OJWFSTBM'SBNFXPSLͷ࡞Γํ ✴&NCFEEFE'SBNFXPSL ✴ ͓·͚ -JWF3FOEFSJOH

  7. 'SBNFXPSLͱ͸ w ҎԼΛύοέʔδϯά͠ɺͭʹ·ͱΊͨ෺ ✴ϥΠϒϥϦ ✴TUPSZCPBSEϑΝΠϧ ✴OJCϑΝΠϧ ✴ը૾ϑΝΠϧ ✴ϩʔΧϥΠζϑΝΠϧ ✴ϔομϑΝΠϧ ✴υΩϡϝϯτ

    w IPHFGSBNFXPSLϑΝΠϧʹͳΔ
  8. 'SBNFXPSL5FNQMBUFͱ͸ w 9DPEF͔Β௥Ճ͞ΕͨJ04༻ͷ w ϓϩδΣΫτςϯϓϨʔτ w ͜ΕΛ࢖͑͹؆୯ʹJ04༻ͷ'SBNFXPSL͕ ࡞ΕΔ͸ͣ

  9. 'SBNFXPSL5FNQMBUF1SPKFDU w ίʔσΟϯά͢Δલʹʜ ͜͜Λ/Pʹ͢Δ

  10. 'SBNFXPSL5FNQMBUF1SPKFDU w ίʔσΟϯάͨ͠ޙͰʜ ެ։͍ͨ͠ϔομΛ 1VCMJDʹೖΕΔ w 'SBNFXPSL໊Iʹ w JNQPSU'SBNFXPSL໊ެ։͍ͨ͠Ϋϥε໊I w

    Λ௥ه ͋ͱ͸Ϗϧυ͢Δ͚ͩͰ'SBNFXPSL׬੒ ࡞ͬͨ΍ͭ
  11. 'SBNFXPSL5FNQMBUF1SPKFDU w ҎԼʹ'SBNFXPSLϑΝΠϧ͕ग़ྗ͞ΕΔ w 6TFSTϢʔβ໊-JCSBSZ%FWFMPQFS9DPEF %FSJWFE%BUBϓϩδΣΫτݻ༗ͷϥϯμϜͳจ ࣈྻ#VJME1SPEVDUT w ͷ഑Լʹʜ w

    %FCVHJQIPOFPT4VTIJ,JUGSBNFXPSL w %FCVHJQIPOFTJNVMBUPS4VTIJ,JUGSBNFXPSL w γϛϡ༻ͱ࣮ػ༻ͷGSBNFXPSLϑΝΠϧ͕ w ผʑʹͰ͖ͪΌ͏ʂ ࣮ػ༻ʹϏϧυͨ࣌͠ γϛϡ༻ʹϏϧυͨ࣌͠
  12. 6OJWFSTBM'SBNFXPSL w γϛϡͱ࣮ػͰ͸$16ͷΞʔΩςΫνϟ͕ ҟͳΔͷͰɺͦΕͧΕʹରԠͨ͠ 'SBNFXPSLϑΝΠϧ͕Ͱ͖ͨ w Ͱ΋ɺͭͷ'SBNFXPSLϑΝΠϧͰͲͬͪ Ͱ΋࢖͑ΔΑ͏ʹ͍ͨ͠ w MJQPίϚϯυͰγϛϡ༻ͱ࣮ػ༻ͷ

    'SBNFXPSLΛͭʹ·ͱΊΒΕΔΑʂ ͲͬͪͰ΋࢖͑Δ'SBNFXPSL͸ 6OJWFSTBM'SBNFXPSLͱݺ͹ΕΔ
  13. w ࣮ػ༻ͱγϛϡ༻ͦΕͧΕʹ9DPEFͰϏϧ υͨ͠ޙʹ w 6TFSTϢʔβ໊-JCSBSZ%FWFMPQFS 9DPEF%FSJWFE%BUBϓϩδΣΫτݻ༗ͷ ϥϯμϜͳจࣈྻ#VJME1SPEVDUT w ഑ԼͰԼهεΫϦϓτΛ࣮ߦ͢Δͱ 6OJWFSTBM'SBNFXPSLΛ࡞੒Ͱ͖Δ

    #!/bin/sh FrameworkName="SushiKit" rm -rf ./Debug mkdir ./Debug cp -r ./Debug-iphoneos/${FrameworkName}.framework 
 ./Debug/${FrameworkName}.framework lipo -create ./Debug-iphoneos/${FrameworkName}.framework/${FrameworkName} ./Debug- iphonesimulator/${FrameworkName}.framework/${FrameworkName} -output ./Debug/$ {FrameworkName}.framework/${FrameworkName} MJQPίϚϯυ IUUQTHJTUHJUIVCDPNIBSBOJDMF FEFBFEBF
  14. 'SBNFXPSLͷ૊ΈࠐΈํ w ࢖͍͍ͨΫϥεͷϔομͰJNQPSU w ྫ !JNQPSU4VTIJ,JU w ࣮૷ϑΝΠϧͰී௨ʹ࢖͑Δ w ྫ

    <4VTIJ#VUUPOOFX> ࡞ͬͨ6OJWFSTBM 'SBNFXPSLͷϑΝΠϧΛ 'JOEFS͔Β͜͜ʹ%%
  15. &NCFEEFE'SBNFXPSL w ϓϩδΣΫτʹλʔήοτͱͯ͠ w 'SBNFXPSLΛ௥Ճ͢Δ͜ͱ΋Ͱ͖Δ w Ϗϧυ࣌ʹΞϓϦʹόϯυϧ͞ΕΔ w ΞϓϦͱҰॹʹ'SBNFXPSL΋ಈ࡞؀ڥ w

    γϛϡPS࣮ػ ʹ߹ͬͨܗͰϏϧυͯ͠ ͘ΕΔ w
  16. &NCFEEFE'SBNFXPSL w ΞϓϦ಺Ͱ
 ෳ਺ϓϩδΣΫτͰڞ༗Ͱ͖ͳ͍ 
 'SBNFXPSL࡞ͬͯخ͍͠ͷ  w ಉ͡ϓϩδΣΫτ಺ʹෳ਺ݸͷϓϩμΫτ ͷλʔήοτ͕͋Δͱ͖ʹ༗༻

    w ͭ·Γʜ"QQ&YUFOTJPO $POUBJOJOH"QQͷλʔήοτ "QQ&YUFOTJPOͷλʔήοτ &NCFEEFE'SBNFXPSLͷλʔήοτ YDPEFQSPK ࢖༻
  17. &NCFEEFE'SBNFXPSLͷ࡞Γํ w ϓϩδΣΫτΛ࡞੒ͨ͠ޙʹ w 'JMF/FX5BSHFUʜ w $PDPB5PVDI'SBNFXPSL5FNQMBUF w "QQ&YUFOTJPOͰ΋ϥΠϒϥϦΛ࡞Γ͍ͨ ৔߹͸-JOLFE'SBNFXPSLTBOE-JCSBSJFT

    ʹ௥Ճ
  18. &NCFEEFE'SBNFXPSLͷ࡞Γํ w ίʔσΟϯάͨ͠ޙͰʜ ެ։͍ͨ͠ϔομΛ 1VCMJDʹೖΕΔ w 'SBNFXPSL໊Iʹ w JNQPSU'SBNFXPSL໊ެ։͍ͨ͠Ϋϥε໊I w

    Λ௥ه ͋ͱ͸Ϗϧυ͢Δ͚ͩͰ͍͍ײ͡ʹಈ͘
  19. ͓·͚

  20. -JWF3FOEFSJOH w ΧελϜͳ7JFXΛ4UPSZCPBSEͰ w -JWF3FOEFSJOHͰ͖ΔΑ͏ʹͳͬͨʂʂ w ΧελϜͳ7JFXͷίʔυΛ'SBNFXPSL಺ ʹؚΊͳ͍ͱͰ͖ͳ͍ͱࢥ͚ͬͯͨͲɺ
 ผʹ'SBNFXPSLʹؚΊͳͯ͘΋ಈ͘Αʂ w

    ؚΊͯ΋ಈ͘Αʂ
  21. -JWF3FOEFSJOH %FNP

  22. 4VTIJ#VUUPOI #import <UIKit/UIKit.h> IB_DESIGNABLE @interface SushiButton : UIButton @property(nonatomic) IBInspectable

    CGFloat borderWidth; @property(nonatomic) IBInspectable UIColor* borderColor; @property(nonatomic) IBInspectable CGFloat cornerRadius; @property(nonatomic) IBInspectable UIColor* ellipseColor; @end -JWF3FOEFSJOH͍ͨ͠ Ϋϥεʹ͚ͭΔ -JWF3FOEFSJOH͍ͨ͠ ϓϩύςΟʹ͚ͭΔ
  23. 4VTIJ#VUUPON - (void)setBorderWidth:(CGFloat)borderWidth { self.layer.borderWidth = borderWidth; } // தུ

    - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); // ӨΛඳը CGContextSetFillColor(context,CGColorGetComponents(self.ellips eColor.CGColor)); NSInteger padding = 20; CGRect frame = self.bounds; frame.origin = CGPointMake(padding, frame.size.height * 0.7); frame.size = CGSizeMake(frame.size.width - padding * 2, frame.size.height * 0.2); CGContextFillEllipseInRect(context, frame); }
  24. ࣮ߦ݁Ռ -JWF3FOEFSJOHͷ ݁Ռͷͱ͓Γ࣮ߦ͞ΕΔ 'SBNFXPSLʹؚΊΔͱ $POUBJOJOH"QQͱ "QQ&YUFOTJPOͰಉ͡ ίʔυΛ࢖͍ճͤΔ 'SBNFXPSLʹؚΊΔͱ $POUBJOJOH"QQͱ "QQ&YUFOTJPOͰಉ͡

    ίʔυΛ࢖͍ճͤΔ
  25. ·ͱΊ

  26. ✴9DPEF͔ΒJ04༻ͷ'SBNFXPSL 5FNQMBUF͕௥Ճ͞Εͯ؆୯ʹ'SBNFXPSL ͕࡞੒Ͱ͖ΔΑ͏ʹͳͬͨ ✴'SBNFXPSL5FNQMBUF1SPKFDUͰ 6OJWFSTBM'SBNFXPSLΛͭ͘Δͷ͸େม ͚ͩͲͰ͖ͳ͘͸ͳ͍ ✴&NCFEEFE'SBNFXPSLΛ࢖͑͹ɺ
 ҟͳΔλʔήοτؒͰίʔυΛڞ༗Ͱ͖Δ ✴ΧελϜͳ7JFXΛ4UPSZCPBSEͰ
 -JWF3FOEFSJOHͰ͖Δ

    ✴ಛघจࣈΩʔϘʔυΑΖ͘͠ʂ