Skip to content

chanonly123/app-store-transition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

App store transition

Almost similar app store transition.

Demo

alt tag

Usage

Step 1: Drag and drop Transition folder project

Transition/DismissBehaviour.swift
Transition/Presenter.swift
Transition/UIViewTouchFeedback.swift

Step 2: implement HomeController protocol

extension HomeViewController: HomeController {
    var linkView: UIView { sharedView }
}

Step 3: implement DetailController protocol

extension DetailViewController: DetailController {

}

Step 4: create Presenter and hold strong

presenter = Presenter(params: .init(from: home, to: detail))
presenter.present()

Optional bounce: Enable touch feedback

cardView.enableTouchFeedback(enable: true) { (down, view) in
    UIView.animate(withDuration: 0.6, delay: 0.0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.0, options: [.allowUserInteraction], animations: {
        view.transform = down ? CGAffineTransform.init(scaleX: 0.97, y: 0.97) : CGAffineTransform.identity
    }, completion: nil)
}

Optional drag down to dismiss: set scrollView from detail controller and implemtent delegate

presenter?.scrollView = scrollView
scrollView.delegate = self

extension DetailViewController: UIScrollViewDelegate {
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        presenter?.behaviour.scrollViewDidScroll(scrollView)
    }

    func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
        presenter?.behaviour.scrollViewWillEndDragging(scrollView, withVelocity: velocity, targetContentOffset: targetContentOffset)
    }
}

For more info please look at demo project


Thanks to

Github: iOS 11 App Store Transition
Raywenderlich: Custom View Controller Presentation Transitions


Feedbacks

Looking forward to hear from you

About

iOS app store transition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages