Coder Social home page Coder Social logo

tattn / swipetransition Goto Github PK

View Code? Open in Web Editor NEW
306.0 11.0 40.0 21.07 MB

Allows trendy transitions using swipe gesture such as "swipe back anywhere".

License: MIT License

Swift 65.41% Objective-C 23.16% Ruby 10.89% Shell 0.33% C 0.21%
ios swift objective-c trendy-transitions swipe swipe-gestures transition

swipetransition's Introduction

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.2 (10.0+)
  • Swift 5 (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.

swipetransition's People

Contributors

abllogra avatar andrewsb avatar dependabot[bot] avatar rnishimu22001 avatar shmakovigor avatar tattn avatar tobaloidee avatar vandat0599 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swipetransition's Issues

SwipeTransition broke animation

animation like this dont work with pod :((

class ColorCell : UICollectionViewCell {

override var isHighlighted: Bool{
    didSet{
        if isHighlighted{
            //self.alpha = 0.5
                            UIView.animate(withDuration: 0.27, delay: 0.0, usingSpringWithDamping: 1, initialSpringVelocity: 1.0, options: [.curveEaseOut, .beginFromCurrentState], animations: {
                                self.transform = self.transform.scaledBy(x: 0.92, y: 0.92)
                            }, completion: nil)
        } else {
            //self.alpha = 1
                            UIView.animate(withDuration: 0.27, delay: 0.0, usingSpringWithDamping: 1, initialSpringVelocity: 1.0, options: [.curveEaseOut, .beginFromCurrentState], animations: {
                                self.transform = CGAffineTransform.identity
                            }, completion: nil)
        }
    }
}

}

Can not disable swipeToDismiss

Line 56

    func updateDragging(withOffset offset: CGFloat) {
        guard let view = target?.view, isEnabled else { return }

add isEnabled in SwipeToDismissContext class

Ambiguous use of 'swipeBack'

Sorry if I'm asking a dumb question, as I'm a beginner developer.
My code was working well before, but After I updated my XCode to 12, it fails to build saying

Ambiguous use of 'swipeBack'

On

self.navigationController?.swipeBack?.isEnabled = false

2020-09-27_00-46-42

Any advise will be appreciated. thank you

In iOS 13 there is a problem with the dismiss function.

It's a favorite solution. Thanks for sharing. In iOS 13 there is a problem with the dismiss function. In the sample, dismiss does not apply for the TableViewController. Also, even if it's applied, it will crash as the dismiss is done and the view below it disappears. Can you solve this problem?

Objective-c support stoped work after swift 4.2

I cant access the property isEnabled anymore

before i had to use #import <SwipeTransition/SwipeTransition-Swift.h>, but not, xcode cant find it, instead i have access to #import <SwipeTransition/SwipeTransition.h>

captura de tela 2018-09-20 as 13 40 11

Swift 5 support ?

I could see there were some commits w.r.t to swift. but 0.4.3 still points swift 4.2.
so any update on the swift 5?

Objective-c support

I'm trying to disable the pull to dismiss in some VCs, but can't find the property swipeToDismiss

#import <SwipeTransition/SwipeTransition-Swift.h>

- (void)viewDidLoad {
    [super viewDidLoad];
    self.swipeToDismiss.isEnabled = NO;
    ...
}

All screens are working without any code typed. But i need to disable in some of them.

Is swipeToDismiss to disable the pull down, right?

captura de tela 2018-03-27 as 23 52 35

formSheet crash

let viewController = ViewController() viewController.modalPresentationStyle = .formSheet viewController.popoverPresentationController?.sourceView = view present(viewController, animated: true, completion: nil)

In case of screen transition, swipe the crash of the navigation bar

Block swipe gesture in some area

I have UISlider and if user slightly miss it then swipe transition is fired, can I block swipe transition in some container view of UISlider?

UIWebView used in one place

The UIWebView is being used in one place. SwipeToDismissController.swift file line no 110. I am receiving the UIWebView deprecation warning whenever i upload a build. Is there a possibility that the usage of the UIWebView here has anything to do with the warning?

Swipe gesture is disabled when isEnabled set true

If already set true in isEnabled, thepanGestureRecognizer was removed and disabled the swipe gesture when set the same value(true) in isEnabled.

I expect, when set the same value, nothing and continue swipe gesture to be able.

Swiping back when both controllers have a UISearchController makes them both disappear.

Hello, I hope you are doing well! After some testing, I have discovered that when both the root controller and the one pushed on screen have search bars as the navigationItem.titleView and the user swipes back on screen both of the search bars in both controllers disappear, however if the user taps on the blank navigation bar it will still interact as though the search bar is visible. However, when the user taps the "< Back" button in the navigation bar instead of using the swipe anywhere feature, the search bar stays visible as it should. Cheers!

Setting swipe edge size

Are there any way to set edge size for swipeToDismiss swipe reaction? For example for swipe from left to right i want to dismiss only when swipe begins from left part of screen, not from whole screen. Is it possible now?

Logo Design Proposal

Greetings Sir @tattn , I am a graphics designer and i passed by your nice project and i noticed it doesn't have a logo yet. I want to propose a logo design for it as a gift for free, if you will give me permission i will start immediately and show you here. Thanks and best regards! - tobaloidee

'SwipeTransition/SwipeTransition-Swift.h' file not found

I got an error 'SwipeTransition/SwipeTransition-Swift.h' file not found
Error location in UINavigationController+AutoSwipeBack.m

I have include SwipeTransition library to in my podfile.

any idea why this happening?

Podfile

   pod "SwipeTransition", "0.5.0"
   pod "SwipeTransitionAutoSwipeBack", "0.5.0"

Keep crashing

I tried below code

let settingHomeNC = UINavigationController(rootViewController: settingHomeVC)
        settingHomeNC.swipeToDismiss = SwipeToDismissController()
        present(settingHomeNC, animated: true, completion: nil)

and this

let settingHomeNC = SwipeToDismissNavigationController(rootViewController: settingHomeVC)
        present(settingHomeNC, animated: true, completion: nil)

It works sometimes but then starts crashing after pod update every time.

Weird behavior since August update

Hi & thanks for the good work I've been using for some time :)

Just updated my cocoapods and now the swipe to go back move does not really work anymore:

  • slow, reactive, swipe does not work (ie controlling the animation with your finger)
  • only thing that work is that if i do a quick swipe at the center of the screen, I still go back. But I cannot control the animation with my finger
    This results in a pretty bad user experience.

Any idea how to fix this?

Thanks

Some details on my setup:

  • My project is written is swift
  • I use SwipeTransitionAutoSwipeBack in my linked frameworks to setup everything automatically
  • The view from which I need to swipe back contains a WKWebBrowser

[Q] How To Use With UITableViewController / UITableView?

First of all thank you so much for the great library.

Noob question: I am trying to make swipe right to go back work on a table view / UITableViewController, so swiping right anywhere on the table will interactive pop. Can you point me in the right direction on how to do this?

Thank you!

UISlider stops working

Hello! I have UISlider inside view controller and interactive pop gesture enabled. When I try to drag thumb right it ignores finger movement and pop gesture occurres.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.