Getting Started With The Swift Package Manager

Getting Started With The Swift Package Manager

Tokyo iOS Meetup - June iOS Meet up

It had taken a lot of time to translate Japanese into English. I'm sorry if I missed the up-to-date information.

5eee847529e8f5ec2f634a85075fd5aa?s=128

Satoshi Hachiya

June 11, 2016
Tweet

Transcript

  1. Getting Started With
 The Swift Package Manager June 11th, 2016

    Tokyo iOS Meetup - June iOS Meetup aka JPMartha
  2. Self-Introduction @JPMartha_jp JPMartha

  3. Self-Introduction • I am a freelance. • I live in

    Kobe, Japan. • I have contributed 
 the Swift Package Manager.
  4. Overview •Getting started with 
 the Swift Package Manager •A

    Command Line Tool with 
 the Swift Package Manager
  5. Swift Package Manager

  6. SwiftPM SPM

  7. ⚠ PLEASE NOTE! ⚠

  8. ⚠ PLEASE NOTE! ⚠ • “The Swift Package Manager is

    still in early design and development” (README) • My presentation will quickly be out of date.
  9. apple / swift-package-manager


  10. My Contribution

  11. Premise • Swift Version: 
 swift-DEVELOPMENT- SNAPSHOT-2016-06-06-a • “Swift Preview

    1 Snapshot” has been removed.
  12. Swift.org Mailing Lists “Unfortunately, there was some significant confusion about

    the nature of these snapshots, with some people thinking that this was the final build of Preview 1. These are obviously not — they are just snapshots of a branch. To avoid confusion, the download link has been removed until the final build for Preview 1 is posted. For those doing active experimentation with the Swift snapshots, I recommend users grabbing the snapshots of “master”.” https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20160530/002087.html
  13. Swift 3.0 Swift 3.0 is the first release to include

    the SwiftPM.
  14. Swift 3.0 Release Process • “Swift 3.0 is also the

    first release to include the Swift Package Manager. ” • “Swift 3.0 will ship in a future version of Xcode.” https://swift.org/blog/swift-3-0-release-process/
  15. Features I introduce some features of SwiftPM.

  16. Package • The third-party projects are called “LIBRARY”. • But

    it called “PACKAGE” in SwiftPM.
  17. No Xcode • We can build the whole package without

    Xcode. • SwiftPM doesn’t have an Archive command for now. • But, we can generate an Xcode project with SwiftPM.
  18. Module • We can provide namespaces by separating Swift files

    into subdirectories. Sources/ !"" Directory/ # $"" abc.swift $"" File/ $"" def.swift
  19. #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 Directory.isAccessible() File.isAccessible()
  20. Swift Evolution
 SE-0085 Package Manager Command Names https://github.com/apple/swift-evolution/blob/master/ proposals/0085-package-manager-command-name.md

  21. $ swift build --help

  22. $ swift package --help

  23. Cross-Platform (OS X, Linux) Testing on Travis CI

  24. .travis.yml

  25. External File

  26. Testing on Linux

  27. How To Contribute SwiftPM Development If you have an interest,

    please tell me later.
  28. Next

  29. Command Line Tool Built via SwiftPM tryswift on GitHub

  30. tryswiftdev A Command Line Tool for Open-Source Development

  31. $ swift package init

  32. README Generator Make Easy for You to Create a README.md

    of New Project ! • It duplicates an existing README.md • It replaces strings (e.g. Name) in a README.md
  33. None
  34. None
  35. Find it Help You Out of "image not found” !

    • It searches for a specified file in some directories. • It makes easy to compare our Xcode Build Settings and find a mistake.
  36. None
  37. Version Strings Updater Make Easy for You to Update Version

    Strings in Specified Files ! 1c1 < DEVELOPMENT-SNAPSHOT-2016-05-31-a --- > DEVELOPMENT-SNAPSHOT-2016-06-06-a
  38. None
  39. Development Snapshots Installer Make Easy for You to Install New

    Development 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.
  40. None
  41. try! Swift 3.0 Make Easy for You to Set Environment

    Variables Swift 3.0 ! But, this is another shell script. (Bash)
  42. None
  43. WORK IN PROGRESS $ https://github.com/tryswift/tryswiftdev

  44. Thanks!