Latest 0.1.6
Homepage https://github.com/tattn/SwipeTransition
License MIT
Platforms ios 8.0
Frameworks UIKit
Authors

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/ku7vwyq8ud61fdezt7njpw8r7m

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.

When setting manually without Method Swizzling, please use SwipeTransition.framework only.

Features

  • [x] Swipe back anywhere.
  • [x] Swipe to dismiss anywhere.
  • [x] Apply to all view controllers automatically!

Requirements

  • Xcode 9.x
  • Swift 4.x
  • iOS 8.0+

Installation

Carthage

github "tattn/SwipeTransition"

CocoaPods

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

Swipe back

Notes: when 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)
    }
}

Swipe to dismiss

Make it work on UIScrollview

class TableVC: UIViewController, UITableViewDataSource {
    @IBOutlet private var tableView: UITableView!

    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.dataSource = self
        swipeToDismiss?.setScrollViews([tableView])

        // in case of presenting a navigationController
        // navigationController?.swipeToDismiss?.setScrollViews([tableView])
    }
}

Manually setting

Notes: when 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 = .overFullScreen
        swipeToDismiss = SwipeToDismissController(viewController: self)
    }
}

Enable/Disable gestures

Use isEnabled property.

navigationController?.swipeBack?.isEnabled = false
navigationController?.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

License

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

Latest podspec

{
    "name": "SwipeTransition",
    "version": "0.1.6",
    "summary": "Allows trendy transitions using swipe gesture such as "swipe back".",
    "description": "SwipeTransition allows trendy transitions using swipe gesture such as "swipe back".",
    "homepage": "https://github.com/tattn/SwipeTransition",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "git": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tattn/SwipeTransition.git",
        "tag": "0.1.6"
    },
    "social_media_url": "https://twitter.com/tanakasan2525",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Sources/SwipeTransition/**/*",
    "public_header_files": "Sources/SwipeTransition/**/*.h",
    "frameworks": "UIKit",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This