Allows trendy transitions using swipe gesture such as "swipe back anywhere".
SwipeTransition allows trendy transitions using swipe gesture such as “swipe back”.
Try the demo on the web (appetize.io): https://appetize.io/app/pebm8kveqhfj3wn204adn0xu8r
UIScrollView
, UITableView
, UICollectionView
and so on.You can install this package with Swift Package Manager.
pod "SwipeTransition"
pod "SwipeTransitionAutoSwipeBack" # if needed
pod "SwipeTransitionAutoSwipeToDismiss" # if needed
Just setting these frameworks in the Linked Frameworks and Libraries
, it works. (if you use Swift Package Manager)
Notes: these frameworks use Method Swizzling.
If you want to set up manually without Method Swizzling, please use SwipeTransition
only.
Just use SwipeBackNavigationController
instead of UINavigationController
. Of course, you can set it with Interface Builder.
let viewController = UIViewController()
let navigationController = SwipeBackNavigationController(rootViewControlelr: viewController)
Another way is to set swipeBack
.
class CustomNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
swipeBack = SwipeBackController(navigationController: self)
}
}
Just use SwipeToDismissNavigationController
instead of UINavigationController
. Of course, you can set it with Interface Builder.
let viewController = UIViewController()
let navigationController = SwipeToDismissNavigationController(rootViewControlelr: viewController)
Another way is to set swipeToDismiss
.
class CustomNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
modalPresentationStyle = .fullScreen
swipeToDismiss = SwipeToDismissController(viewController: self)
}
}
Use isEnabled
property.
self.navigationController?.swipeBack?.isEnabled = false
self.swipeToDismiss?.isEnabled = false
You can also change the behavior such as animation.
SwipeBackConfiguration.shared.parallaxFactor = 0.6
SwipeToDismissConfiguration.shared.dismissHeightRatio = 0.5
Inheriting the configure class, you can set it with computed property.
class CustomSwipeBackConfiguration: SwipeBackConfiguration {
override var transitionDuration: TimeInterval {
get { return 1.5 }
set { super.transitionDuration = newValue }
}
}
SwipeBackConfiguration.shared = CustomSwipeBackConfiguration()
See this wiki
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
Donating to help me continue working on this project.
.modalPresentationStyle
supportSwipeTransition is released under the MIT license. See LICENSE for details.