Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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.

Satoshi Hachiya

June 11, 2016
Tweet

More Decks by Satoshi Hachiya

Other Decks in Programming

Transcript

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

    Tokyo iOS Meetup - June iOS Meetup aka JPMartha
  2. Self-Introduction • I am a freelance. • I live in

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

    Command Line Tool with 
 the Swift Package Manager
  4. ⚠ PLEASE NOTE! ⚠ • “The Swift Package Manager is

    still in early design and development” (README) • My presentation will quickly be out of date.
  5. 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
  6. 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/
  7. 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.
  8. Module • We can provide namespaces by separating Swift files

    into subdirectories. Sources/ !"" Directory/ # $"" abc.swift $"" File/ $"" def.swift
  9. #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()
  10. 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
  11. 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.
  12. 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
  13. 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.
  14. try! Swift 3.0 Make Easy for You to Set Environment

    Variables Swift 3.0 ! But, this is another shell script. (Bash)