Skip to content

Spring Modifier on dismiss view controller Hero. #763

Description

@mobileexpert1

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions