Create a smooth transition between any two SwiftUI Views

Overview

GZMatchedTransformEffect

Create a smooth transition between any two SwiftUI Views. It is very similar to the built-in .matchedGeometryEffect() modifier, but the effect is much smoother.

Installation

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/gongzhang/GZMatchedTransformEffect", .upToNextMajor(from: "1.0.0"))
]

Quick Start

  1. Use the same .matchedTransformEffect() modifier on both views.
  2. Control the appearance and disappearance of two views in a withAnimation block
import SwiftUI
import GZMatchedTransformEffect

struct Example: View {
    @State private var flag = true
    @Namespace private var ns

    var view1: some View { ... }
    var view2: some View { ... }

    var body: some View {
        VStack {
            if flag {
                view1
                    .fixedSize()
                    .id("view1")
                    .matchedTransformEffect(id: "transition", in: ns) // ⬅️
            }
            
            Spacer()

            if !flag {
                view2
                    .fixedSize()
                    .id("view2")
                    .matchedTransformEffect(id: "transition", in: ns) // ⬅️
            }

            Button(action: { withAnimation { flag.toggle() } }) {
                Text("Toggle")
            }
        }
    }
}
You might also like...
Library for creating swipe actions for any SwiftUI View

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

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

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

 Garland View seamlessly transitions between multiple lists of content.
Garland View seamlessly transitions between multiple lists of content.

Garland View seamlessly transitions between multiple lists of content. We specialize in the designing and coding of custom UI for Mobile

An experiment for using SwiftUI's custom timing Animation to create an orbital-like animation.
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

SwiftUI iOS application allowing users to create profiles and meet and chat with people
SwiftUI iOS application allowing users to create profiles and meet and chat with people

FindR SwiftUI iOS application allowing users to create profiles and meet and cha

FloatingBubbles is a customizable views that float like zero gravity animation.
FloatingBubbles is a customizable views that float like zero gravity animation.

Floating Bubbles FloatingBubbles is a customizable views that float like zero gravity animation. $ pod try FloatingBubbles Features Create Multiple V

Various view's effects for iOS, written in Swift. Allows you to animate views nicely with easy to use extensions
Various view's effects for iOS, written in Swift. Allows you to animate views nicely with easy to use extensions

Various view's effects for iOS, written in Swift. Allows you to animate views nicely with easy to use extensions. Every animation is randomized. Currently supported animations:

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

Releases(v1.0.0)
Owner
Gong Zhang
👨🏻‍💻 Indie Developer 苹果独立开发者:📱HiCoffee / 📱HiWater / 📱分形的奥秘 / 📱北京限行助手 / ⌚️禅计数,专注闭门造轮子二十年
Gong Zhang
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

Yansong Li 775 Dec 7, 2022
iOS framework for impressive transition animations between views.

CoreTransition iOS framework for impressive transition animations between views. Built using Swift, and supports a lot of animations to navigate to a

Ahmed Abdelkarim 4 Nov 17, 2022
Add smooth water waves to your views.

WXWaveView Add pretty and smooth waves to your views! The wave can be added to any type of view. 中文说明 e.g. Integration Cocoapods: pod 'WXWaveView' Or

Welkin Xie 347 Dec 28, 2022
Appstore card animation transition. UICollectionView and UITableView card expand animated transition

Appstore card animation transition. UICollectionView and UITableView card expand animated transition. This library tries to add the appstore transition to your own app. The goal is to be as simple as possible to integrate in an app while keeping the flexibility and customization alive.

appssemble 544 Dec 28, 2022
An Objective-C animation library used to create floating image views.

JRMFloatingAnimation [![CI Status](http://img.shields.io/travis/Caroline Harrison/JRMFloatingAnimation.svg?style=flat)](https://travis-ci.org/Caroline

Caroline Harrison 233 Dec 28, 2022
Design and prototype customized UI, interaction, navigation, transition and animation for App Store ready Apps in Interface Builder with IBAnimatable.

Design and prototype customized UI, interaction, navigation, transition and animation for App Store ready Apps in Interface Builder with IBAnimatable.

IBAnimatable 8.6k Jan 2, 2023
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
Transition animation for ViewController

XTransitionKit Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 9.0+ Swift 5

Leo 2 Dec 17, 2021
Keynote-style Magic Move transition animations

MagicMove All the magic of Keynote Magic Move transitions brought to iOS. Demo Magic Move Transition Spin Transition Fade Transition TODO MagicMove Tr

Patrick Reynolds 15 Sep 6, 2018
jasu 29 Dec 20, 2022