Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Modifier on dismiss view controller Hero. #763

Open
mobileexpert1 opened this issue Jul 19, 2023 · 0 comments
Open

Spring Modifier on dismiss view controller Hero. #763

mobileexpert1 opened this issue Jul 19, 2023 · 0 comments

Comments

@mobileexpert1
Copy link

mobileexpert1 commented Jul 19, 2023

It's working fine while i present the controller and presented Hero View springs well and fine. But while i am dismissing the view controller, dismissed Hero View doesn't springs. I am presenting the view from collectionview cell and dismissing to same view from ViewProduct named View.

I am ussing below code for this.

While presenting :-

CellForItemAt(){
cell.HeroId = "Cell(indexpath.row)"
}

DidSelectItemAt(){
let indxPath = IndexPath(row: indexPath.item, section: 0)
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ProductListCollectionViewCell", for: indxPath) as! ProductListCollectionViewCell
LocalStore.shared.HeroID = "Cell(indexPath.row + 1)"
cell.hero.modifiers = [.useNoSnapshot, .spring(stiffness: 250, damping: 15)]
self.performSegue(withIdentifier: "second", sender: self)
}

Dismiss ViewController:-
viewDidLoad(){
viewProduct.heroModifiers = [.forceNonFade, .spring(stiffness: 250, damping: 15), .useGlobalCoordinateSpace]
}

DimissAction(){
let currentPosition = CGPoint(x: translation.x + viewProduct.center.x, y: translation.y * (1.0 - progress) + viewProduct.center.y)
let modifiers: [HeroModifier] = [.position(currentPosition), .forceNonFade, .opacity(0.99), .cornerRadius(20), .spring(stiffness: 250, damping: 15), .useGlobalCoordinateSpace]
Hero.shared.apply(modifiers: modifiers, to: viewProduct)
hero.dismissViewController()
}

RPReplay_Final1689752948.MP4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant