Yalantis / DisplaySwitcher

Custom transition between two collection view layouts
https://yalantis.com
MIT License
2.33k stars 190 forks source link

Crash #40

Open AtulKrt94 opened 6 years ago

AtulKrt94 commented 6 years ago

Could not cast value of type 'UICollectionViewTransitionLayout' (0x10b5dbb08) to 'DisplaySwitcher.TransitionLayout' (0x1087e88f8).

In this function

open func startInteractiveTransition() { UIApplication.shared.beginIgnoringInteractionEvents() transitionLayout = collectionView.startInteractiveTransition(to: destinationLayout) { success, finish in if success && finish { self.collectionView.reloadData() UIApplication.shared.endIgnoringInteractionEvents() } } as! TransitionLayout transitionLayout.layoutState = layoutState createUpdaterAndStart() }

aditee94 commented 5 years ago

update this method:

func collectionView(_ collectionView: UICollectionView, transitionLayoutForOldLayout fromLayout: UICollectionViewLayout, newLayout toLayout: UICollectionViewLayout) -> UICollectionViewTransitionLayout { let customTransitionLayout = TransitionLayout(currentLayout: fromLayout, nextLayout: toLayout) return customTransitionLayout }

it worked for me.

AtulKrt94 commented 5 years ago

update this method:

func collectionView(_ collectionView: UICollectionView, transitionLayoutForOldLayout fromLayout: UICollectionViewLayout, newLayout toLayout: UICollectionViewLayout) -> UICollectionViewTransitionLayout { let customTransitionLayout = TransitionLayout(currentLayout: fromLayout, nextLayout: toLayout) return customTransitionLayout }

it worked for me.

I tried this but, it didn't work.