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

Libraries for the Swift

Libraries for the Swift

Libraries for the Swift

Acbf3391de0494432a92221ffe89f34e?s=128

yohei sugigami

May 13, 2015
Tweet

More Decks by yohei sugigami

Other Decks in Technology

Transcript

  1. Libraries for the Swift yohei SUGIGAMI

  2. None
  3. We are selecting the library for a New App

  4. HTTP + JSON ˔"MBNPpSF˒  ɹɹIUUQTHJUIVCDPN"MBNPpSF"MBNPpSF ˔4XJGUZ+40/˒  ɹɹIUUQTHJUIVCDPN4XJGUZ+40/4XJGUZ+40/ ˔"SHP˒

    ɹɹIUUQTHJUIVCDPNUIPVHIUCPU"SHP ˔+40/&YQPSU˒ ɹɹIUUQTHJUIVCDPN"INFE"MJ+40/&YQPSU 3FGT4XJGUͷ+40/Λѻ͏ϥΠϒϥϦ·ͱΊ
  5. JSONExport 3FGT4XJGUͷ+40/Λѻ͏ϥΠϒϥϦ·ͱΊ 4XJGU$MBTTFT5PVTFXJUI4XJGUZ+40/MJCSBSZ 4XJGU$MBTTFT5PVTFXJUI3FBMN

  6. ˔3FBDUJWF$PDPB#FUB˒  ɹɹIUUQTHJUIVCDPN3FBDUJWF$PDPB3FBDUJWF$PDPB ˔4XJGU5BTL˒ ɹɹIUUQTHJUIVCDPN3FBDU,JU4XJGU5BTL ˔#SJHIU'VUVSFT˒ ɹɹIUUQTHJUIVCDPN5IPNWJT#SJHIU'VUVSFT ˔'VUVSF,JU˒ ɹɹIUUQTHJUIVCDPN'VUVSF,JU'VUVSF,JU Promise

    / Future
  7. ˔3FBDUJWF$PDPB#FUB˒  ɹɹIUUQTHJUIVCDPN3FBDUJWF$PDPB3FBDUJWF$PDPB ˔3FBDU,JU˒ ɹɹIUUQTHJUIVCDPN3FBDU,JU3FBDU,JU ˔3Y4XJGU˒ ɹɹIUUQTHJUIVCDPNKTQBISTVNNFST3Y4XJGU ˔3Y4XJGU˒ ɹɹIUUQTHJUIVCDPNL[BIFS3Y4XJGU Reactive

  8. SwiftTask func auth() -> AuthTask { return self.getAccessToken() .then({ (token:

    String?, errorInfo: ResponseTask.ErrorInfo?) -> AuthTask in return AuthTask { progress, fulfill, reject, configure in if let errorInfo = errorInfo { reject(errorInfo.error!) return } if let token = token { self.ref.authWithCustomToken(token) { (error: NSError!, autData: AuthData!) in if let error = error { reject(error) return } if let autData = autData { fulfill(autData) } } } } }) }
  9. ViewBinding ˔3FBDUJWF$PDPB#FUB˒  ɹɹIUUQTHJUIVCDPN3FBDUJWF$PDPB3FBDUJWF$PDPB ˔4XJGU#POE˒ ɹɹIUUQTHJUIVCDPN4XJGU#POE#POE ˔3FBDU,JU˒ ɹɹIUUQTHJUIVCDPN3FBDU,JU3FBDU,JU

  10. SwiftBond class LoginViewController: UIViewController { @IBOutlet weak var activityIndicator: UIActivityIndicatorView!

    @IBOutlet weak var usernameTextField: UITextField! @IBOutlet weak var passwordTextField: UITextField! @IBOutlet weak var loginButton: UIButton! let viewModel = LoginViewModel() override func viewDidLoad() { viewModel.username <->> usernameTextField viewModel.password <->> passwordTextField viewModel.activityIndicatorVisible ->> activityIndicator viewModel.loginButtonEnabled ->> loginButton viewModel.loginState ->| loginStateChangedObserver loginButton.dynEvent .filter(==, .TouchUpInside) ->| loginButtonTapObserver }
  11. SwiftBond var tableViewDataSourceBond: UITableViewDataSourceBond<UITableViewCell>! override func viewDidLoad() { super.viewDidLoad() tableViewDataSourceBond

    = UITableViewDataSourceBond(tableView: self.tableView) repositories.map { [unowned self] (repository: Repository) -> UITableViewCell in let cell = self.tableView .dequeueReusableCellWithIdentifier("cell") as UITableViewCell repository.name ->> cell.nameLabel repository.photo ->> cell.avatarImageView return cell } ->> tableViewDataSourceBond }
  12. Functional tool kit ˔%PMMBSBOE$FOU˒  ɹɹIUUQTHJUIVCDPNBOLVSQ%PMMBSTXJGU ˔4XJGU[˒  ɹɹIUUQTHJUIVCDPNUZQFMJGU4XJGU[ ˔&Y4XJGU˒

     ɹɹIUUQTHJUIVCDPNQ/SF&Y4XJGU
  13. Date Helper ˔4XJGU.PNFOU˒ ɹɹIUUQTHJUIVCDPNBLPTNB4XJGU.PNFOU ˔5JNFQJFDF˒ ɹɹIUUQTHJUIVCDPNOBPUZ5JNFQJFDF ˔"'%BUF)FMQFS˒ ɹɹIUUQTHJUIVCDPNNFMWJUBY"'%BUF)FMQFS ˔5FNQP˒ ɹɹIUUQTHJUIVCDPNSFNJSPCFSU5FNQP

  14. Logger ˔9$(-PHHFS˒ ɹɹIUUQTHJUIVCDPN%BWF8PPE$PN9$(-PHHFS ˔4XFMM˒ ɹɹIUUQTHJUIVCDPNIVCFSUS4XFMM

  15. XCGLogger with Aspects let logger = XCGLogger.defaultInstance() logger.setup(logLevel: .Verbose, showLogLevel:

    true, showFileNames: true, showLineNumbers: true, writeToFile: nil) let hooks = ["viewDidLoad", "viewWillAppear:", "viewWillDisappear:"] UIViewController.aspect_hookLoggers(hooks) { (_className: String?, _methodName: String?) in if var className = _className { if var methodName = _methodName { let items = className.componentsSeparatedByString(".") className = items.count > 1 ? items[1] : items[0] logger.verbose("\(className)#\(methodName)") } } }
  16. XCGLogger with Aspects 2015-05-10 16:18:57.847 [Info] XCGLogger Version: 2.0 -

    LogLevel: Verbose 2015-05-10 16:18:57.978 [Verbose] [AppDelegate.swift:87] UITabBarController#viewDidLoad 2015-05-10 16:18:57.995 [Verbose] [AppDelegate.swift:87] UITabBarController#viewWillAppear: 2015-05-10 16:18:58.005 [Verbose] [AppDelegate.swift:87] UITableViewController#viewDidLoad 2015-05-10 16:18:58.005 [Verbose] [AppDelegate.swift:87] UITableViewController#viewWillAppear:
  17. Architecture

  18. Architecture 7JFX $POUSPMMFS 7JFX.PEFM .PEFM 3FBDU,JU 4XJGU5BTL 4XJGUZ+40/ 4XJGU#POE .77.

  19. Find a library

  20. GitHub Search Repositories

  21. GitHub Trending Repositories

  22. Awesome Swift

  23. Swift Toolbox

  24. CocoaControls

  25. Enjoy your library life.