Skip to content
Allows trendy transitions using swipe gesture such as "swipe back anywhere".
Branch: master
Clone or download
Latest commit de5c204 Oct 30, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Examples Fix example app Oct 1, 2018
Sources UISlider & swipe back gesture fix Oct 30, 2018
SwipeTransition.xcodeproj Set SWIFT_VERSION to 4.2 Sep 21, 2018
Tests
docs/assets Add files via upload Jun 17, 2018
scripts
.gitignore Update .gitignore Aug 28, 2018
.swift-version Update Swift 4.0 to Swift 4.2 Sep 19, 2018
.swiftlint.yml Update swiftlint configuration Sep 19, 2018
.travis.yml fix ci Sep 19, 2018
Dangerfile Add danger-lgtm Dec 31, 2017
Gemfile
Gemfile.lock
LICENSE
README.md Update README Sep 19, 2018
SwipeTransition.podspec 0.3.3 Oct 30, 2018
SwipeTransitionAutoSwipeBack.podspec
SwipeTransitionAutoSwipeToDismiss.podspec 0.3.3 Oct 30, 2018
codecov.yml Add codecov.yml Dec 31, 2017

README.md

logotype-a

Build Status Carthage compatible pods Platform Swift Version Objective-C compatible

SwipeTransition allows trendy transitions using swipe gesture such as "swipe back".

Demo

Try the demo on the web (appetize.io): https://appetize.io/app/pebm8kveqhfj3wn204adn0xu8r

Features

  • Swipe back anywhere.
  • Swipe to dismiss anywhere.
  • Apply to all view controllers automatically!
  • No conflict of gestures on UIScrollView, UITableView, UICollectionView and so on.

Requirements

  • Xcode 10
  • Swift 4.2+
  • iOS 8.0+

Installation

Carthage

github "tattn/SwipeTransition"

CocoaPods

pod "SwipeTransition"
pod "SwipeTransitionAutoSwipeBack"      # if needed
pod "SwipeTransitionAutoSwipeToDismiss" # if needed

Usage

The easiest way to use

Just setting these frameworks in the Linked Frameworks and Libraries, it works. (if you use Carthage)

Linked Frameworks and Libraries

Notes: these frameworks use Method Swizzling.

If you want to set up manually without Method Swizzling, please use SwipeTransition.framework only.

Manually set up

Notes: if you use `AutoSwipeBack.framework`, these are unnecessary.

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)
    }
}
Notes: if you use `AutoSwipeToDismiss.framework`, these are unnecessary.

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)
    }
}

Enable/Disable gestures

Use isEnabled property.

self.navigationController?.swipeBack?.isEnabled = false
self.swipeToDismiss?.isEnabled = false

Configuration

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()

Other usage

See this wiki

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Support this project

Donating to help me continue working on this project.

Donate

ToDo

  • All .modalPresentationStyle support
  • Animation support (fade / custom)
  • Some transition styles support (e.g. right to left swipe transition)

License

SwipeTransition is released under the MIT license. See LICENSE for details.

You can’t perform that action at this time.