HeroTransitions / HeroTransitions/Hero
Spring Modifier on dismiss view controller Hero.
- Dominant language
- Swift
- Stars
- 22.5k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
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()
}
https://github.com/HeroTransitions/Hero/assets/9291694/01e697e9-4724-4c31-8576-b94dc3d5de42
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.