Slide 1

Slide 1 text

,ZPCBTIJTXJGUY",*#"TXJGU !OBLBKJKBQBO Shari minneʹಋೖͯ̍͠೥

Slide 2

Slide 2 text

AKIBA.swift Kyobashi.swift Shibuya.swift

Slide 3

Slide 3 text

@nakajijapan GMO PEPABO inc. Principal Engineer iOS / Web / OS X About Me Daichi Nakajima

Slide 4

Slide 4 text

ϋϯυϝΠυ࡞඼Λ ചΕΔɺങ͑Δɻ ࠃ಺࠷େڃͷ ϋϯυϝΠυϚʔέοτ

Slide 5

Slide 5 text

NKJMultiMovieCaptureView NKJMovieComposer NKJPagerViewController PhotoSlider Teiten GitHub Sengiri Shari frustration.me Kazaguruma

Slide 6

Slide 6 text

Shari

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

ࣷར • ਣ൧ • ωλͷҾཱ͖ͯ໾

Slide 9

Slide 9 text

What is Shari?

Slide 10

Slide 10 text

UI Component IUUQTHJUIVCDPNOBLBKJKBQBO4IBSJ

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Why?

Slide 13

Slide 13 text

Why • Χʔτͷࡏݿมߋ • UIPickerViewΛར༻͍ͯͨ͠ • ૢ࡞͕̍εςοϓ஗͍ • தԝ഑ஔ͕ετϨε

Slide 14

Slide 14 text

Why • Χʔτͷࡏݿมߋ • UIPickerViewΛར༻͍ͯͨ͠ • ૢ࡞͕̍εςοϓ஗͍ • தԝ഑ஔ͕ετϨε ࡏݿมߋʹ̍ɺ͕̎΄ͱΜͲ

Slide 15

Slide 15 text

ղܾ͍ͤͨ͞

Slide 16

Slide 16 text

Want • UIPickerViewͷ୅ସ • ͳΔ΂͘؆୯ʹ • େྔͷࡏݿΛબ୒͢ΔϢʔβ΋ߟྀ

Slide 17

Slide 17 text

Goal

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

Try!

Slide 20

Slide 20 text

Animation

Slide 21

Slide 21 text

UIPercentDrivenInte ractiveTransition

Slide 22

Slide 22 text

UIPercentDrivenInteractiveTransition • Interactively control view controller • Percent Driven • update(_:), cancel(), finish() • Using gesture recognizger $MBTT IUUQTEFWFMPQFSBQQMFDPNSFGFSFODFVJLJUVJQFSDFOUESJWFOJOUFSBDUJWFUSBOTJUJPO

Slide 23

Slide 23 text

UIViewControllerAni matorTransitioning

Slide 24

Slide 24 text

UIViewControllerAnimatorTransitioning • Custom ViewController Transition • Define how animation you want to make 1SPUPDPM

Slide 25

Slide 25 text

Πέϧ

Slide 26

Slide 26 text

ΠέφΠ

Slide 27

Slide 27 text

Problem

Slide 28

Slide 28 text

Problem • ࠷ॳ͔Β࠷ޙ·Ͱͷදݱ͔͠Ͱ͖ͳ͍ • ్தͷUIͷ੍ޚ͕ೖΕΒΕͳ͍

Slide 29

Slide 29 text

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Implementation • Using Container View Controller

Slide 32

Slide 32 text

Half

Slide 33

Slide 33 text

Implementation modalNavigationController.parentNavigationController = navigationController navigationController?.si.presentViewController( toViewController: modalNavigationController ) • Call Customized Container View Controller

Slide 34

Slide 34 text

Implementation func presentViewController(toViewController:UIViewController) { toViewController.beginAppearanceTransition(true, animated: true) ModalAnimator.present(toView: toViewController.view, fromView: parentTargetView) { [weak self] in guard let strongSelf = self else { return } toViewController.endAppearanceTransition() toViewController.didMove(toParentViewController: strongSelf.base) } let tapGestureRecognizer = UITapGestureRecognizer(target: base, action: #selector(UINavigationController.overlayViewDidTap(gestureRecognizer:))) let overlayView = ModalAnimator.overlayView(fromView: parentTargetView) overlayView!.addGestureRecognizer(tapGestureRecognizer) }

Slide 35

Slide 35 text

Implementation func presentViewController(toViewController:UIViewController) { toViewController.beginAppearanceTransition(true, animated: true) ModalAnimator.present(toView: toViewController.view, fromView: parentTargetView) { [weak self] in guard let strongSelf = self else { return } toViewController.endAppearanceTransition() toViewController.didMove(toParentViewController: strongSelf.base) } let tapGestureRecognizer = UITapGestureRecognizer(target: base, action: #selector(UINavigationController.overlayViewDidTap(gestureRecognizer:))) let overlayView = ModalAnimator.overlayView(fromView: parentTargetView) overlayView!.addGestureRecognizer(tapGestureRecognizer) } ൒෼͚ͩදࣔ͢ΔΞχϝʔγϣϯ

Slide 36

Slide 36 text

Transition Background option

Slide 37

Slide 37 text

Implementation public class ShariNavigationController: UINavigationController { func handlePanGesture(gestureRecognizer: UIPanGestureRecognizer) { (..snip..) case .changed: var frame = view.frame frame.origin.y += degreeY frame.size.height += -degreeY view.frame = frame ModalAnimator.transitionBackgroundView( overlayView: backgroundView, location: location) (..snip..) • Get frame using UIPanGestureRecognizer

Slide 38

Slide 38 text

Implementation public class func transitionBackgroundView(overlayView: UIView, location:CGPoint) { let screenShotView = ModalAnimator.screenShotView(overlayView: overlayView) let scale = self.map( value: location.y, inMin: 0, inMax: UIScreen.main.bounds.height, outMin: 0.9, outMax: 1.0) let transform = CATransform3DMakeScale(scale, scale, 1) screenShotView.layer.removeAllAnimations() screenShotView.layer.transform = transform screenShotView.layoutIfNeeded() } • Transition in real time 5SBOTGFSBNPVOUPGNPWFNFOU (FU*NBHF

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

Conclusion

Slide 41

Slide 41 text

Conclusion • ؆୯ʂʁ • ঢ়گΛ఻͑ͯϑΟʔυόοΫΛఏڙͰ͖Δ • ίϯςΩετΛҡ࣋Ͱ͖Δ • ϛεΛࣄલʹ๷͛Δ

Slide 42

Slide 42 text

Conclusion • minneͷσβΠϯίϯϙʔωϯτͷҰͭ • Χʔτ - ࡏݿมߋ • ചΕͨ΋ͷ - ߜΓࠐΈ • ࡞඼ը໘ - Φϓγϣϯબ୒

Slide 43

Slide 43 text

Shari

Slide 44

Slide 44 text

Thanks.