Advertisement
Advertisement

More Related Content

Advertisement
Advertisement

Command Line Tool in swift

  1. Command Line Tool in Swift Mercari Inc. @kitasuke
  2. CLI tool or script might be needed for pre-action before build
  3. Why using Swift?
  4. First step to use Swift in your project
  5. CLI tool, not Script 4 dependency management 4 flexible extension
  6. How developing with Xcode?
  7. References Carthage, SwiftCov
  8. Framework Commandant is a Swift framework for parsing command-line arguments
  9. Project directory 4 Carthage 4 xcodeproj 4 xcworkspace 4 Makefile 4 script
  10. Workspace structure 4 Main target 4 Static framework target 4 Test target 4 xcconfigs 4 framework projects
  11. Configurations
  12. Create a project
  13. Clean up files and add main.swift
  14. Add a framework
  15. Run Carthage carthage update --use-submodules github "Carthage/Commandant" github "jspahrsummers/xcconfigs" github "ishkawa/APIKit" github "ikesyo/Himotoki"
  16. Set xcconfigs
  17. Run bootstrap script objc-build-scripts: standardize how Objective-C projects are bootstrapped after cloning
  18. New workspace Add all the projects into here
  19. Add frameworks General → Linked Frameworks and Libraries
  20. Copy frameworks in Build Phrases Destination is frameworks
  21. Runpath in Buld Settings for main target /Library/Frameworks/***.framework/ Versions/Current/Frameworks/
  22. Embedded Content Contains Swift Code for framework target Set to YES, default is NO
  23. Add components.plist for pkgbuild command <plist version="1.0"> <array> <dict> <key>BundleIsVersionChecked</key> <false/> <key>BundleOverwriteAction</key> <string>upgrade</string> <key>ChildBundles</key> <array> <dict> <key>BundleOverwriteAction</key> <string></string> <key>RootRelativeBundlePath</key> <string>Library/Frameworks/***.framework/Versions/A/Frameworks/***.framework</string> </dict> </array> <key>RootRelativeBundlePath</key> <string>Library/Frameworks/***.framework</string> </dict> </array> </plist>
  24. Run install command pkgbuild --component-plist --identifier --install-location --root --version
  25. Adding command
  26. Using Commandant public protocol CommandType { typealias ClientError /// The action that users should specify to use this subcommand (e.g., /// `help`). var verb: String { get } /// A human-readable, high-level description of what this command is used /// for. var function: String { get } /// Runs this subcommand in the given mode. func run(mode: CommandMode) -> Result<(), CommandantError<ClientError>> }
  27. Debugging
  28. Arguments Passed on Launch in scheme setting
  29. Demo
  30. Start your Swift life from now !
  31. Thank you
Advertisement