Slide 1

Slide 1 text

Useful Command Line Tools in Swift 3 potatotips #34 @giginet

Slide 2

Slide 2 text

@giginet • iOS Engineer @ Cookpad • ։ൃج൫΍ͬͯ·͢ • झຯɿήʔϜ։ൃ

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

giginet/Toybox

Slide 9

Slide 9 text

$ toybox create Snippet $ toybox create $ toybox create —-platform macos $ toybox open Snippet $ toybox list https://github.com/giginet/Toybox

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

CLI with Swift 3

Slide 12

Slide 12 text

Architecture • Carthage/Commandant toybox ToyboxKit.framework

Slide 13

Slide 13 text

Carthage/Commandant struct ListOptions: OptionsProtocol { typealias ClientError = ToyboxError let platform: Platform? static func create(_ platform: Platform?) -> ListOptions { return self.init(platform: platform) } static func evaluate(_ m: CommandMode) -> Result> { return create <*> m <| Option(key: "platform", defaultValue: nil, usage: "Platform to list (ios/mac/tvos)") } } struct ListCommand: CommandProtocol { typealias Options = ListOptions typealias ClientError = ToyboxError let verb = "list" let function = "List the Playground" func run(_ options: Options) -> Result<(), ToyboxError> { // Do Something return .success() } }

Slide 14

Slide 14 text

Distribution

Slide 15

Slide 15 text

Distribution • HomebrewͰ഑෇͢Δ • Makefile • Homebrew Formula • Bottle

Slide 16

Slide 16 text

Makefile • CarthageͷౕΛύΫΔ $ make prefix_install PREFIX=`brew —-prefix`

Slide 17

Slide 17 text

class Toybox < Formula desc "Xcode Playground management made easy" homepage "https://github.com/giginet/Toybox" url "https://github.com/giginet/Toybox.git", :tag => "0.1.0", :revision => "e65059061cd33bdbc01fe9883e6e4d2c863979f4", :shallow => false head "https://github.com/giginet/Toybox.git", :shallow => false depends_on :xcode => ["8.0", :build] depends_on 'carthage' => :build def install system "make", "prefix_install", "PREFIX=#{prefix}" bash_completion.install "Sources/Scripts/toybox-bash- completion" => "toybox" zsh_completion.install "Sources/Scripts/toybox-zsh-completion" => "_toybox" end test do system bin/"toybox" end end

Slide 18

Slide 18 text

Homebrew Bottle $ brew install giginet/toybox/toybox —- build-bottle $ brew bottle toybox

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

ײ૝ • Swift 3ॻ͖΍͍͢ • Commandantศར • ഑෇ͭΒ͍

Slide 21

Slide 21 text

brew install giginet/ toybox/toybox

Slide 22

Slide 22 text

͝ਗ਼ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠