HeroTransitions / Hero

Elegant transition library for iOS & tvOS

Home Page:https://HeroTransitions.github.io/Hero/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring Modifier on dismiss view controller Hero.

mobileexpert1 opened this issue · comments

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