Allows a swipe on any part of the screen to start an interruptible pop animation to the previous view

Overview

Lazy Pop SwiftUI

Swiping on any part of the screen starts an interruptible pop animation to the previous view.

Forked from https://github.com/rishi420/SwipeRightToPopController and adapted for SwiftUI.

Also thanks to lyinsteve on this Reddit comment for suggesting I turn this into modifier.

App Store Demo

Download the Lazy Pop SwiftUI demo here!

Use

To make your view lazily poppable, just add the lazyPop() modifer to it.

struct DetailsViewWithLazyPop: View {
    var body: some View {
        Text("Lazy pop enabled. Swipe anywhere to dismiss.")
        .lazyPop()
    }
}

If you would like to toggle when the lazy pop is enabled, just pass it a boolean state.

struct DetailsViewWithToggleableLazyPop: View {
    @State var isEnabled: Bool = true
    var body: some View {
        Toggle(isOn: $isEnabled) {
            Text("Toggle lazy pop")
        }
        .lazyPop(isEnabled: $isEnabled)
    }
}

Install

Just inlude the two files under LazyPop in this repo. Here's a link to them https://github.com/joehinkle11/Lazy-Pop-SwiftUI/tree/master/Lazy%20Pop%20SwiftUI/Lazy%20Pop

If this gets enough use, I'll put this in a Swift Package or a Cocopod.

You might also like...
Swiftui-animation-observer - Track SwiftUI animation progress and completion via callbacks
Swiftui-animation-observer - Track SwiftUI animation progress and completion via callbacks

SwiftUI Animation Observer Track SwiftUI animation progress and completion via c

Letters animation allows you to click on different letters and accordingly it will animate letters in a cool way. It has a very attractive UI and is very easy to use.
Letters animation allows you to click on different letters and accordingly it will animate letters in a cool way. It has a very attractive UI and is very easy to use.

Letters Animation Cool Letters Animation in iOS written in Swift. Preview Table of content :- Description How to add in your project Requirement Licen

Numbers animation allows you to click on different numbers and accordingly it will animate numbers in a cool way. It has a very attractive UI and is very easy to use.
Numbers animation allows you to click on different numbers and accordingly it will animate numbers in a cool way. It has a very attractive UI and is very easy to use.

Numbers Animation Cool Numbers Animation in iOS written in Swift. Preview Table of content :- Description How to add in your project Requirement Licen

Reading animation allows you to click on the different page numbers and accordingly it will animate page changes in a cool way. It has a very attractive UI and is very easy to use.
Reading animation allows you to click on the different page numbers and accordingly it will animate page changes in a cool way. It has a very attractive UI and is very easy to use.

Reading Animation Cool Reading Animation in iOS written in Swift. Preview Table of content :- Description How to add in your project Requirement Licen

An easy way to add a simple, shimmering effect to any view in an iOS app.
An easy way to add a simple, shimmering effect to any view in an iOS app.

Shimmer Shimmer is an easy way to add a shimmering effect to any view in your app. It's useful as an unobtrusive loading indicator. Shimmer was origin

An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.
An easy way to add a shimmering effect to any view with just one line of code. It is useful as an unobtrusive loading indicator.

LoadingShimmer An easy way to add a shimmering effect to any view with just single line of code. It is useful as an unobtrusive loading indicator. Thi

Shimmer: A super-light modifier that adds a shimmering effect to any SwiftUI View
Shimmer: A super-light modifier that adds a shimmering effect to any SwiftUI View

SwiftUI-Shimmer ✨ Shimmer is a super-light modifier that adds a shimmering effec

ChainPageCollectionView  A custom View with two level chained collection views and fancy transition animation
ChainPageCollectionView A custom View with two level chained collection views and fancy transition animation

ChainPageCollectionView A custom View with two level chained collection views and fancy transition animation. Demo Requirements iOS 9.0+ Xcode 8 Insta

CCMRadarView uses the IBDesignable tools to make an easy customizable radar view with animation
CCMRadarView uses the IBDesignable tools to make an easy customizable radar view with animation

CCMRadarView CCMRadarView is a simple to use view that uses the new IBDesignable and IBInspectable features of XCode6 to easily configure the icon in

Comments
  • The navigation bar display abnormal when cancel pop with `navigationBarHidden`

    The navigation bar display abnormal when cancel pop with `navigationBarHidden`

    • The example code is
    struct Example: View {
        @State var selection = 0
        var body: some View {
            ZStack {
                Color.blue.edgesIgnoringSafeArea(.all)
            }
            .lazyPop()
            .frame(maxWidth: .infinity, maxHeight: .infinity)
            .edgesIgnoringSafeArea(.all)
            .navigationBarHidden(true)
        }
    }
    
    • When swipe half then cancel swipe, the result is IMG_0722
    opened by bougieL 1
  • When LazyPop is canceled, other actions in the view are disabled.

    When LazyPop is canceled, other actions in the view are disabled.

    Hello there is a look like the following. LazyPop is active. The problem is as follows: The user can come back to the previous view by sliding from anywhere on the screen. But if the user gives up and cancels lazypop, the view locks. My "Test 2" button becomes unclickable. How can I solve this?

            Button(action: {
                // Actions:
                self.mode.wrappedValue.dismiss()
            }, label: {
                Text("Test 2")
            })
        }
        .lazyPop()
        .navigationBarHidden(true)
        .navigationBarBackButtonHidden(true)
        
    }
    
    opened by keremcesme 8
Owner
Joe Hinkle
App and game developer. Working on https://appmakerios.com and https://crate.as
Joe Hinkle
Inspired by Fabric - Answers animation. Allows to "build" given view with pieces. Allows to "destroy" given view into pieces

ADPuzzleAnimation Whats inside Custom animation for UIView inspired by Fabric - Answers animation. Easy to use To create your first animation you need

Anton 126 Dec 25, 2022
Library for creating swipe actions for any SwiftUI View

SwipeActions Library for creating swipe actions for any SwiftUI View, similar to

Alexander Kraev 24 Dec 26, 2022
A lightweight loading animation that can be applied to any SwiftUI view with 1 line of code.

SimpleAFLoader A lightweight loading animation that can be applied to any SwiftUI view with 1 line of code. All animations are built using the SwiftUI

Fahim Rahman 2 Aug 25, 2022
MGFlipView allows to create flipping view in easy way without worrying about flipping animation and flipping logic.

MGFlipView About If you are looking for an easy way of implement 3D flipping view, you are in the right place. MGFlipView allows to create flipping vi

Maciej Gomółka 47 Sep 28, 2022
ZoomTransitioning provides a custom transition with image zooming animation and swiping the screen edge.

ZoomTransitioning Overview ZoomTransitioning provides a custom transition with image zooming animation. When you use this library with UINavigationCon

WorldDownTown 673 Dec 27, 2022
Facebook's Pop Framework, By Examples

Facebook's Pop Framework, By Examples --- This project is a tutorial (Check tutorial here) for how to use Pop framework by Facebook. Its very easy and

Hossam Ghareeb 183 Aug 1, 2022
Simple Interface Core Animation. Run type-safe animation sequencially or parallelly

Simple Interface Core Animation Sica can execute various animations sequentially or parallelly. Features Animation with duration and delay parallel /

CATS Open Source Softwares 1k Nov 10, 2022
An experiment for using SwiftUI's custom timing Animation to create an orbital-like animation.

Orbital-SwiftUI-Animation An experiment for using SwiftUI's custom timing curve to create an orbital-like animation. How it looks: How it works: Apply

Mostafa Abdellateef 7 Jan 2, 2023
SwiftUI-Text-Animation-Library - Text animation library for SwiftUI

⚠️ This repository is under construction. SwiftUI Text Animation Library Make yo

null 28 Jan 8, 2023