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

Diversity is Good

nakajijapan
October 23, 2015
310

Diversity is Good

Shibuya Swift #01

nakajijapan

October 23, 2015
Tweet

Transcript

  1. Diversity is Good
    Shibuya.swift #1
    @nakajijapan
    Introducing to PhotoSlider for swift

    View full-size slide

  2. @nakajijapan
    Software Engineer
    GMO PEPABO inc.
    iOS / Web / OS X

    View full-size slide

  3. Talk about
    • ެ։
    • ͳͥ࡞੒ͨ͠ͷ͔
    • ӡ༻ϑΣʔζ
    • εϫΠϓͰ࡟আͰ͖ΔΑ͏ʹͳΔ·Ͱ
    • Ճ଎౓ͷௐ੔
    • ΋ͬͱؾ࣋ͪྑ͘
    • ެ։͔ͯ͠Βͷ൓Ԡ

    View full-size slide

  4. PhotoSlider
    • ༷ʑͳձࣾͰར༻͞Ε͍ͯΔը૾ʹϑΥʔΧεͨ͠ɺݟΔઐ༻ͷը໘
    • ͚ͦͬͳ͍
    • ଞͱมΘΒͳ͍
    • ΋ͬͱྑ͍ײ͡ʹ͍ͨ͠

    View full-size slide

  5. PhotoSlider
    • OSSʹࣅͨΑ͏ͳ΋ͷ͸ͳ͍΋ͷ͔

    View full-size slide

  6. PhotoSlider
    193

    View full-size slide

  7. PhotoSlider
    30

    View full-size slide

  8. PhotoSlider
    • OSSʹࣅͨΑ͏ͳ΋ͷ͸ͳ͍΋ͷ͔
    • IDMPhotoBrowser
    • Facebook, TwitterͷΠϯλϥΫγϣϯΛऔΓೖΕͯྑͦ͞͏
    • MWPhotoBrowserͷ೿ੜܥ
    • εϫΠϓͰ࡟আ͢ΔඍົͳΞχϝʔγϣϯ͕ؾʹ৯Θͳ͍
    • ϝϯς͞Ε͍ͯͳ͍…
    • ྑ͍ײ͡ͷ΋ͷ͕ͳ͍

    View full-size slide

  9. Release as OSS

    View full-size slide

  10. Maintenance
    • ΠϯλϥΫγϣϯͷվળ
    • CollectionView໰୊
    • εΫϩʔϧͷ଎౓Ͱը໘Λ࡟আ͍ͨ͠
    • PhotoSliderʹը໘ભҠ࣌ͷΞχϝʔγϣϯ(Transition)
    • ؆୯ͳUI Testingಋೖ
    • ϦϦʔε࣌ͷόʔδϣχϯά

    View full-size slide

  11. CollectionView
    ಋೖࣦഊ

    View full-size slide

  12. *NBHF
    CollectionViewಋೖࣦഊ
    • ࣮૷͸؆୯ʹͰ͖ͨ
    • εΫϩʔϧ࣌ʹࢦͱϏϡʔʹ͕ࠩग़͖ͯͨ
    *NBHF

    View full-size slide

  13. CollectionViewಋೖࣦഊ

    View full-size slide

  14. CollectionViewಋೖࣦഊ
    • ScrollViewͰ࡞Γ௚͠
    • ͨͩ͜Ε͚ͩͩͱCollectionViewͱಉ͡ݱ৅ʹͳΔ
    *NBHF *NBHF *NBHF *NBHF
    *NBHF

    View full-size slide

  15. *NBHF
    CollectionViewಋೖࣦഊ
    • ScrollViewΛ޿͛Δ
    • ҧ࿨ײͳ͍εΫϩʔϧ͕࣮ݱͰ͖Δ
    *NBHF *NBHF *NBHF
    *NBHF
    ScrollView
    ্Լʹ΋εϫΠϓͰ͖Δ͔ͷΑ͏ʹ͢Δ

    View full-size slide

  16. CollectionViewಋೖࣦഊ
    • ΋͔ͨ͠͠ΒUIPangestureRecognizerར༻͢Ε͹UIScrollView޿͛ͳ͘
    ͯ΋࣮ݱͰ͖͔ͨ΋͠Εͳ͍ɻɻɻ

    View full-size slide

  17. ScrollViewʹมߋ

    View full-size slide

  18. εΫϩʔϧͷ
    Ճ଎౓ͰClose

    View full-size slide

  19. εΫϩʔϧͷ଎౓Ͱ࡟আ
    • ΑΓ௚ײతͳΠϯλϥΫγϣϯ͕͍ͨ͠
    • UIScrollView͕ϓϩύςΟͱͯ͠UIPanGestureRecognizerΛ͍࣋ͬͯΔ
    scrollView.panGestureRecognizer.velocityInView(scrollView)
    GVODWFMPDJUZ*O7JFX @WJFX6*7JFX
    $(1PJOU
    6*1BO(FTUVSF3FDPHOJ[FS

    View full-size slide

  20. εΫϩʔϧͷ଎౓Ͱ࡟আ
    • ΑΓ௚ײతͳΠϯλϥΫγϣϯ͕͍ͨ͠
    • UIScrollView͕ϓϩύςΟͱͯ͠UIPanGestureRecognizerΛ͍࣋ͬͯΔ
    let velocity = scrollView.panGestureRecognizer.velocityInView(scrollView)
    GVODWFMPDJUZ*O7JFX @WJFX6*7JFX
    $(1PJOU
    6*1BO(FTUVSF3FDPHOJ[FS

    View full-size slide

  21. εΫϩʔϧͷ଎౓Ͱ࡟আ
    public func scrollViewDidEndDragging(scrollView: UIScrollView,
    willDecelerate decelerate: Bool) {
    if self.scrollMode == .Vertical {
    let velocity = scrollView.panGestureRecognizer
    .velocityInView(scrollView)
    if velocity.y < -500 {
    self.scrollView.frame = scrollView.frame
    self.closePhotoSlider(true)
    } else if velocity.y > 500 {
    self.scrollView.frame = scrollView.frame
    self.closePhotoSlider(false)
    }
    }
    }

    View full-size slide

  22. ViewController
    Transitions

    View full-size slide

  23. ViewController Transitions
    7JFX$POUSPMMFS
    "OJNBUPS6*7JFX$POUSPMMFS"OJNBUFE5SBOTJUJPOJOH
    7JFX$POUSPMMFS

    View full-size slide

  24. ViewController Transitions
    7JFX$POUSPMMFS
    "OJNBUPS6*7JFX$POUSPMMFS"OJNBUFE5SBOTJUJPOJOH
    7JFX$POUSPMMFS
    public protocol UIViewControllerAnimatedTransitioning : NSObjectProtocol {
    public func transitionDuration(transitionContext: UIViewControllerContextTransitioning?)
    ->
    NSTimeInterval
    public func animateTransition(transitionContext: UIViewControllerContextTransitioning)
    optional public func animationEnded(transitionCompleted: Bool)
    }

    View full-size slide

  25. ViewController Transitions
    "OJNBUPS6*7JFX$POUSPMMFS"OJNBUFE5SBOTJUJPOJOH
    public class ZoomingAnimationController: NSObject, UIViewControllerAnimatedTransitioning {
    var present = true
    public var sourceTransition: ZoomingAnimationControllerTransitioning?
    public var destinationTransition: ZoomingAnimationControllerTransitioning?
    public init(present: Bool) {
    super.init()
    self.present = present
    }
    public func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
    return 0.2
    }
    public func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
    if self.present {
    self.animatePresenting(transitionContext)
    } else {
    self.animateDismiss(transitionContext)
    }
    }
    }

    View full-size slide

  26. ViewController Transitions
    4PVSDF7JFX$POUSPMMFS
    // Using transition
    let photoSlider = PhotoSlider.ViewController(imageURLs: self.imageURLs)
    photoSlider.delegate = self
    photoSlider.currentPage = indexPath.row
    photoSlider.transitioningDelegate = self
    self.presentViewController(photoSlider, animated: true) { () -> Void in
    // Something
    }

    View full-size slide

  27. ViewController Transitions
    4PVSDF7JFX$POUSPMMFS
    // MARK: UIViewControllerTransitioningDelegate
    func animationControllerForDismissedController(dismissed: UIViewController) ->
    UIViewControllerAnimatedTransitioning? {
    let animationController = PhotoSlider.ZoomingAnimationController(present: false)
    animationController.sourceTransition = dismissed as? ZoomingAnimationControllerTransitioning
    animationController.destinationTransition = self
    return animationController
    }
    func animationControllerForPresentedController(presented: UIViewController, presentingController
    presenting: UIViewController, sourceController source: UIViewController) ->
    UIViewControllerAnimatedTransitioning? {
    let animationController = PhotoSlider.ZoomingAnimationController(present: true)
    animationController.sourceTransition = source as? ZoomingAnimationControllerTransitioning
    animationController.destinationTransition = presented as? ZoomingAnimationControllerTransitioning
    return animationController
    }

    View full-size slide

  28. RMPZoomTransitionAnimator

    View full-size slide

  29. ViewController Transitions
    • @_mpon͞Μ͔Β঺հ͞Εͯ࡞Γͨ͘ͳͬͨ
    • Ͳͬ΀Γࢀߟʹ͍͖ͤͯͨͩ͞·ͨ͠

    View full-size slide

  30. Versioning
    • Versioning͢Δͱ͖ͷ࡞ۀ
    • xxx.podspecͷόʔδϣϯมߋ
    • git tag x.x.x
    • ҙ֎ͱͩΔ͍ͷͰbumpͷpodspec൛࡞ͬͨ(RubyͰ)
    • ࣮͸ɻɻɻ

    View full-size slide

  31. @azu͞Μ͕npmͰग़͍ͯͨ͠

    View full-size slide

  32. Versioning
    • Versioning͢Δͱ͖ͷ࡞ۀ
    • xxx.podspecͷόʔδϣϯมߋ
    • git tag x.x.x
    • ҙ֎ͱͩΔ͍ͷͰbumpͷpodspec൛࡞ͬͨ(RubyͰ)
    • RubyͰ͋ͬͯ΋͍͍΍Μ

    View full-size slide

  33. Subsequently

    View full-size slide

  34. Subsequently
    • ެ։͔ͯ͠ΒΆͪΆͪStar͕૿͑࢝Ίͨ
    • ཁ๬͕དྷΔΑ͏ʹͳͬͨ
    • ਺ϲ݄ͯ͠pull request͕དྷΔΑ͏ʹͳͬͨ
    • ஍ಓʹमਖ਼΍Βճ౴΍Β
    • ࢖ͬͯ͘Ε͍ͯΔͱ͍͏ϞνϕʔγϣϯͰܧଓத

    View full-size slide

  35. Subsequently
    • Test
    • UI Testingͷ͓͔͛ͰUI ܥͷϓϥάΠϯͰ΋ςετ͕Ͱ͖Δʂ
    • Travis CIͰ͚͜Δͷ͕Α͘Θ͔ͬͯͳ͍

    View full-size slide

  36. Diversity is Good

    View full-size slide

  37. We are hiring!!!
    http://pepabo.com/recruit/career/#jobs
    ⚠ ⚠

    View full-size slide