Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Diversity is Good
nakajijapan
October 23, 2015
0
94
Diversity is Good
Shibuya Swift #01
nakajijapan
October 23, 2015
Tweet
Share
More Decks by nakajijapan
See All by nakajijapan
nakajijapan
3
1.5k
nakajijapan
4
2.8k
nakajijapan
0
71
nakajijapan
1
1.2k
nakajijapan
1
800
nakajijapan
0
1.2k
nakajijapan
1
1.9k
nakajijapan
0
180
nakajijapan
0
420
Featured
See All Featured
brad_frost
156
6.4k
tmm1
61
8.4k
danielanewman
200
20k
kneath
219
15k
dougneiner
119
7.8k
mojombo
358
62k
colly
187
14k
destraynor
223
47k
addyosmani
310
21k
rasmusluckow
318
18k
zakiwarfel
88
3.3k
pauljervisheath
196
15k
Transcript
Diversity is Good Shibuya.swift #1 @nakajijapan Introducing to PhotoSlider for
swift
About Me
@nakajijapan Software Engineer GMO PEPABO inc. iOS / Web /
OS X
None
GitHub
Talk about
PhotoSlider
Talk about • ެ։ • ͳͥ࡞ͨ͠ͷ͔ • ӡ༻ϑΣʔζ • εϫΠϓͰআͰ͖ΔΑ͏ʹͳΔ·Ͱ
• Ճͷௐ • ͬͱؾ࣋ͪྑ͘ • ެ։͔ͯ͠ΒͷԠ
Why?
PhotoSlider • ༷ʑͳձࣾͰར༻͞Ε͍ͯΔը૾ʹϑΥʔΧεͨ͠ɺݟΔઐ༻ͷը໘ • ͚ͦͬͳ͍ • ଞͱมΘΒͳ͍ • ͬͱྑ͍ײ͡ʹ͍ͨ͠
PhotoSlider • OSSʹࣅͨΑ͏ͳͷͳ͍ͷ͔
PhotoSlider 193
PhotoSlider 30
PhotoSlider • OSSʹࣅͨΑ͏ͳͷͳ͍ͷ͔ • IDMPhotoBrowser • Facebook, TwitterͷΠϯλϥΫγϣϯΛऔΓೖΕͯྑͦ͞͏ • MWPhotoBrowserͷੜܥ
• εϫΠϓͰআ͢ΔඍົͳΞχϝʔγϣϯ͕ؾʹ৯Θͳ͍ • ϝϯς͞Ε͍ͯͳ͍… • ྑ͍ײ͡ͷͷ͕ͳ͍
SwiftͰʂ
Release as OSS
Maintenance • ΠϯλϥΫγϣϯͷվળ • CollectionView • εΫϩʔϧͷͰը໘Λআ͍ͨ͠ • PhotoSliderʹը໘ભҠ࣌ͷΞχϝʔγϣϯ(Transition) •
؆୯ͳUI Testingಋೖ • ϦϦʔε࣌ͷόʔδϣχϯά
CollectionView ಋೖࣦഊ
*NBHF CollectionViewಋೖࣦഊ • ࣮؆୯ʹͰ͖ͨ • εΫϩʔϧ࣌ʹࢦͱϏϡʔʹ͕ࠩग़͖ͯͨ *NBHF
CollectionViewಋೖࣦഊ
CollectionViewಋೖࣦഊ • ScrollViewͰ࡞Γ͠ • ͨͩ͜Ε͚ͩͩͱCollectionViewͱಉ͡ݱʹͳΔ *NBHF *NBHF *NBHF *NBHF *NBHF
*NBHF CollectionViewಋೖࣦഊ • ScrollViewΛ͛Δ • ҧײͳ͍εΫϩʔϧ͕࣮ݱͰ͖Δ *NBHF *NBHF *NBHF *NBHF
ScrollView ্ԼʹεϫΠϓͰ͖Δ͔ͷΑ͏ʹ͢Δ
CollectionViewಋೖࣦഊ • ͔ͨ͠͠ΒUIPangestureRecognizerར༻͢ΕUIScrollView͛ͳ͘ ࣮ͯݱͰ͖͔ͨ͠Εͳ͍ɻɻɻ
ScrollViewʹมߋ
εΫϩʔϧͷ ՃͰClose
εΫϩʔϧͷͰআ • ΑΓײతͳΠϯλϥΫγϣϯ͕͍ͨ͠ • UIScrollView͕ϓϩύςΟͱͯ͠UIPanGestureRecognizerΛ͍࣋ͬͯΔ scrollView.panGestureRecognizer.velocityInView(scrollView) GVODWFMPDJUZ*O7JFX @WJFX6*7JFX $(1PJOU 6*1BO(FTUVSF3FDPHOJ[FS
εΫϩʔϧͷͰআ • ΑΓײతͳΠϯλϥΫγϣϯ͕͍ͨ͠ • UIScrollView͕ϓϩύςΟͱͯ͠UIPanGestureRecognizerΛ͍࣋ͬͯΔ let velocity = scrollView.panGestureRecognizer.velocityInView(scrollView) GVODWFMPDJUZ*O7JFX
@WJFX6*7JFX $(1PJOU 6*1BO(FTUVSF3FDPHOJ[FS
εΫϩʔϧͷͰআ 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) } } }
ViewController Transitions
ViewController Transitions 7JFX$POUSPMMFS "OJNBUPS6*7JFX$POUSPMMFS"OJNBUFE5SBOTJUJPOJOH 7JFX$POUSPMMFS
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) }
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) } } }
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 }
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 }
RMPZoomTransitionAnimator
ViewController Transitions • @_mpon͞Μ͔Βհ͞Εͯ࡞Γͨ͘ͳͬͨ • ͲͬΓࢀߟʹ͍͖ͤͯͨͩ͞·ͨ͠
Versioning
Versioning • Versioning͢Δͱ͖ͷ࡞ۀ • xxx.podspecͷόʔδϣϯมߋ • git tag x.x.x •
ҙ֎ͱͩΔ͍ͷͰbumpͷpodspec൛࡞ͬͨ(RubyͰ) • ࣮ɻɻɻ
@azu͞Μ͕npmͰग़͍ͯͨ͠
Versioning • Versioning͢Δͱ͖ͷ࡞ۀ • xxx.podspecͷόʔδϣϯมߋ • git tag x.x.x •
ҙ֎ͱͩΔ͍ͷͰbumpͷpodspec൛࡞ͬͨ(RubyͰ) • RubyͰ͍͍͋ͬͯΜ
Subsequently
Subsequently • ެ։͔ͯ͠ΒΆͪΆͪStar͕૿͑࢝Ίͨ • ཁ͕དྷΔΑ͏ʹͳͬͨ • ϲ݄ͯ͠pull request͕དྷΔΑ͏ʹͳͬͨ • ಓʹमਖ਼ΒճΒ
• ͬͯ͘Ε͍ͯΔͱ͍͏ϞνϕʔγϣϯͰܧଓத
Subsequently • Test • UI Testingͷ͓͔͛ͰUI ܥͷϓϥάΠϯͰςετ͕Ͱ͖Δʂ • Travis CIͰ͚͜Δͷ͕Α͘Θ͔ͬͯͳ͍
Conclusion
Diversity is Good
Enjoy OSS
We are hiring!!! http://pepabo.com/recruit/career/#jobs ⚠ ⚠
Thanks.