Diversity is Good

A77456b262557e22986345f6d0555c58?s=47 nakajijapan
October 23, 2015
89

Diversity is Good

Shibuya Swift #01

A77456b262557e22986345f6d0555c58?s=128

nakajijapan

October 23, 2015
Tweet

Transcript

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

    swift
  2. About Me

  3. @nakajijapan Software Engineer GMO PEPABO inc. iOS / Web /

    OS X
  4. None
  5. GitHub

  6. Talk about

  7. PhotoSlider

  8. Talk about • ެ։ • ͳͥ࡞੒ͨ͠ͷ͔ • ӡ༻ϑΣʔζ • εϫΠϓͰ࡟আͰ͖ΔΑ͏ʹͳΔ·Ͱ

    • Ճ଎౓ͷௐ੔ • ΋ͬͱؾ࣋ͪྑ͘ • ެ։͔ͯ͠Βͷ൓Ԡ
  9. Why?

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

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

  12. PhotoSlider 193

  13. PhotoSlider 30

  14. PhotoSlider • OSSʹࣅͨΑ͏ͳ΋ͷ͸ͳ͍΋ͷ͔ • IDMPhotoBrowser • Facebook, TwitterͷΠϯλϥΫγϣϯΛऔΓೖΕͯྑͦ͞͏ • MWPhotoBrowserͷ೿ੜܥ

    • εϫΠϓͰ࡟আ͢ΔඍົͳΞχϝʔγϣϯ͕ؾʹ৯Θͳ͍ • ϝϯς͞Ε͍ͯͳ͍… • ྑ͍ײ͡ͷ΋ͷ͕ͳ͍
  15. SwiftͰʂ

  16. Release as OSS

  17. Maintenance • ΠϯλϥΫγϣϯͷվળ • CollectionView໰୊ • εΫϩʔϧͷ଎౓Ͱը໘Λ࡟আ͍ͨ͠ • PhotoSliderʹը໘ભҠ࣌ͷΞχϝʔγϣϯ(Transition) •

    ؆୯ͳUI Testingಋೖ • ϦϦʔε࣌ͷόʔδϣχϯά
  18. CollectionView ಋೖࣦഊ

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

  20. CollectionViewಋೖࣦഊ

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

  22. *NBHF CollectionViewಋೖࣦഊ • ScrollViewΛ޿͛Δ • ҧ࿨ײͳ͍εΫϩʔϧ͕࣮ݱͰ͖Δ *NBHF *NBHF *NBHF *NBHF

    ScrollView ্Լʹ΋εϫΠϓͰ͖Δ͔ͷΑ͏ʹ͢Δ
  23. CollectionViewಋೖࣦഊ • ΋͔ͨ͠͠ΒUIPangestureRecognizerར༻͢Ε͹UIScrollView޿͛ͳ͘ ͯ΋࣮ݱͰ͖͔ͨ΋͠Εͳ͍ɻɻɻ

  24. ScrollViewʹมߋ

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

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

  27. εΫϩʔϧͷ଎౓Ͱ࡟আ • ΑΓ௚ײతͳΠϯλϥΫγϣϯ͕͍ͨ͠ • UIScrollView͕ϓϩύςΟͱͯ͠UIPanGestureRecognizerΛ͍࣋ͬͯΔ let velocity = scrollView.panGestureRecognizer.velocityInView(scrollView) GVODWFMPDJUZ*O7JFX

    @WJFX6*7JFX $(1PJOU 6*1BO(FTUVSF3FDPHOJ[FS
  28. εΫϩʔϧͷ଎౓Ͱ࡟আ 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) } } }
  29. ViewController Transitions

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

  31. 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) }
  32. 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) } } }
  33. 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 }
  34. 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 }
  35. RMPZoomTransitionAnimator

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

  37. Versioning

  38. Versioning • Versioning͢Δͱ͖ͷ࡞ۀ • xxx.podspecͷόʔδϣϯมߋ • git tag x.x.x •

    ҙ֎ͱͩΔ͍ͷͰbumpͷpodspec൛࡞ͬͨ(RubyͰ) • ࣮͸ɻɻɻ
  39. @azu͞Μ͕npmͰग़͍ͯͨ͠

  40. Versioning • Versioning͢Δͱ͖ͷ࡞ۀ • xxx.podspecͷόʔδϣϯมߋ • git tag x.x.x •

    ҙ֎ͱͩΔ͍ͷͰbumpͷpodspec൛࡞ͬͨ(RubyͰ) • RubyͰ͋ͬͯ΋͍͍΍Μ
  41. Subsequently

  42. Subsequently • ެ։͔ͯ͠ΒΆͪΆͪStar͕૿͑࢝Ίͨ • ཁ๬͕དྷΔΑ͏ʹͳͬͨ • ਺ϲ݄ͯ͠pull request͕དྷΔΑ͏ʹͳͬͨ • ஍ಓʹमਖ਼΍Βճ౴΍Β

    • ࢖ͬͯ͘Ε͍ͯΔͱ͍͏ϞνϕʔγϣϯͰܧଓத
  43. Subsequently • Test • UI Testingͷ͓͔͛ͰUI ܥͷϓϥάΠϯͰ΋ςετ͕Ͱ͖Δʂ • Travis CIͰ͚͜Δͷ͕Α͘Θ͔ͬͯͳ͍

  44. Conclusion

  45. Diversity is Good

  46. Enjoy OSS

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

  48. Thanks.