Swift Package Manager (SwiftPM, SPM)

Swift Package Manager (SwiftPM, SPM)

potatotips #29

5eee847529e8f5ec2f634a85075fd5aa?s=128

Satoshi Hachiya

May 25, 2016
Tweet

Transcript

  1. Swift Package Manager (SwiftPM, SPM) 2016-05-25 potatotips #29 JPMartha 1

  2. ࣗݾ঺հ @JPMartha_jp JPMartha 2

  3. Swift Package Manager 3

  4. ࿩͢͜ͱ ᶃ Swift Package Manager ೖ໳ ᶄ ͜ΕΛۦ࢖ͨ͠πʔϧ঺հ 4

  5. apple / swift-package-manager
 (GitHub) 5

  6. Merged ! 6

  7. ͨͩ͠։ൃ͢Δʹ͸ apple / master ͷ࠷৽͕ඞཁ ʢDevelopment Snapshots ͸ෆཁʣ ͍Ζ͍Ζ΍΍͍͜͠ͷͰ ڵຯ͕͋Δํ͸ͷͪ΄Ͳฉ͍͍ͯͩ͘͞ɻ

    7
  8. ͝ଘ஌ͳ͍ํ޲͚ʹ • ैདྷͷϥΠϒϥϦΛύοέʔδͱݺͼ·͢ɻ • CocoaPods, Carthage ͷΑ͏ʹϥΠϒϥϦΛ؅ཧ ͢ΔπʔϧͰ͢ɻ • ͨͩ͠গ͠ҧ͍·͢ɻ

    8
  9. ύοέʔδΛ Ϗϧυ͢Δ $ swift build 9

  10. $ swift build • Xcode Λ࢖Θͳ͍ͰύοέʔδશମΛϏϧυ͠·͢ɻ • Swift 3.0-devʢSwift 2.2

    ʹ͸ͳ͍ʣͰ͢ɻ • Apple ͷϦϙδτϦʹকདྷ૾͕هࡌ͞Ε͍ͯ·͕͢۩ମ తʹ͸·ͩΘ͔Γ·ͤΜɻ • Archive ͕ͳ͍Ͱ͕͢ Xcode ϓϩδΣΫτΛੜ੒͢ΔίϚ ϯυ͕͋Γ·͢ɻ`$ swift build -X`
 ʢকདྷతʹ Xcode ʹ૊Έࠐ·ΕΔΑ͏Ͱ͢ʣ 10
  11. Tips ୯ʹʮ͜͏͍͏͜ͱ͕Ͱ͖·͢ʯͱ͍͏࿩Ͱ͢ɻ 11

  12. Module • Sources ͱ Tests ҎԼΛσΟϨΫτϦͰΘ͚Δ͜ͱ ʹΑΓɺ໊લۭؒΛΘ͚Δ͜ͱ͕Ͱ͖·͢ɻ Directory.isAccessible() File.isAccessible() •

    αʔυύʔςΟͷϥΠϒϥϦͰ໊લ͕όοςΟϯ άͯ͠΋Αͦ͞͏Ͱ͢ɻʢσΟϨΫτϦ͕ผʣ 12
  13. Directory / File #if os(Linux) import Glibc #else import Darwin

    #endif #if os(Linux) public func isAccessible(name: String) -> Bool { guard !name.isEmpty else { return false } return access(name, F_OK) == 0 } #else public func isAccessible(path: String) -> Bool { guard !path.isEmpty else { return false } return access(path, F_OK) == 0 } #endif 13
  14. Travis CI Cross-Platform (OS X, Linux) 14

  15. .travis.yml 15

  16. run-tests.sh 16

  17. JPMartha / FounDarwin 17

  18. ͜͜·Ͱ͕ Swift Package Manager ೖ໳ͷ ࿩Ͱͨ͠ɻ 18

  19. Swift Package Manager Ͱ ίϚϯυϥΠϯπʔϧΛ ࡞੒͠·ͨ͠ tryswift on GitHub 19

  20. tryswiftdev Φʔϓϯιʔε༻ίϚϯυϥΠϯπʔϧ܈Ͱ͢ɻ 20

  21. README Generator ৽͍͠ϓϩδΣΫτͷ README Λ؆୯ʹ࡞Ε·͢ʂ • It duplicates an existing

    README.md • It replaces strings (e.g. Name) in a README.md 21
  22. 

  23. 

  24. Find it "image not found” Λ୳͠·͢ʂ • "Find It" searches

    for a specified file in some directories. • It makes easy for you to compare your Xcode Build Settings and find a mistake. 24
  25. 

  26. Version Strings Updater ֤छυΩϡϝϯτͷόʔδϣϯ จࣈྻΛҰׅม׵͠·͢ʂ 26

  27. 

  28. Development Snapshots Installer ৽͍͠ Snapshots Λ؆୯ʹΠϯετʔϧͰ͖·͢ʂ • It downloads a

    specified Developer Snapshot into your current working directory. • It installs the package via the sudo command. • It removes the pkg file. 28
  29. 

  30. try! Swift 3.0 Swift 3.0 ޲͚ͷ؀ڥม਺Λ؆୯ʹ ઃఆͰ͖·͢ʂ 30

  31. 

  32. A WORK IN PROGRESS " 32

  33. Thanks! 33