Quick Fix on Error in Xcode (Could not cast value of type...)
- or -
Post a project like this1083
$15
- Posted:
- Proposals: 7
- Remote
- #3237468
- Awarded
Ranked # 1 in development on PeoplePerHour | iOS | Android | Flutter | SharePoint | React Native | 100% Client Feedback
Dubai
PPH TOP Website & App Developer✮LOGO & Graphic Designer✮Content Writer✮Translator
Dubai
379737332271522198836617227480432252295262699
Description
Experience Level: Entry
As this should be a quick fix, I am offering $15 to complete. If it is more involved, we can talk.
I have a project I am trying to get the working (it had worked in the past but not sure what I did to the code). I want to zip and send the project for someone to get working... I need the UIStoryboardSegue to work from the home page collectionview cells (you will see in the code). Here is a snippet of the code that is throwing the exception:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
guard let identifier = segue.identifier else { return }
switch identifier {
case "HomeToSection":
let destination = segue.destination as! SectionViewController
let indexPath = sender as! IndexPath ***HERE***
let section = sections[indexPath.row]
destination.section = section
destination.sections = sections
destination.indexPath = indexPath
destination.transitioningDelegate = self
let attributes = chapter1CollectionView.layoutAttributesForItem(at: indexPath)!
let cellFrame = chapter1CollectionView.convert(attributes.frame, to: view)
presentSectionViewController.cellFrame = cellFrame
presentSectionViewController.cellTransform = animateCell(cellFrame: cellFrame)
isStatusBarHidden = true
UIView.animate(withDuration: 0.5, animations: {
self.setNeedsStatusBarAppearanceUpdate()
})
case "Benefits":
segue.destination.view.translatesAutoresizingMaskIntoConstraints = false
default:
break
}
}
The error: Could not cast value of type 'mConnectVocab.SectionCollectionViewCell' (0x1099171d8) to 'NSIndexPath' (0x7fff86d860c0).
(Could not cast value of type'...NSIndexPath'
I have a project I am trying to get the working (it had worked in the past but not sure what I did to the code). I want to zip and send the project for someone to get working... I need the UIStoryboardSegue to work from the home page collectionview cells (you will see in the code). Here is a snippet of the code that is throwing the exception:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
guard let identifier = segue.identifier else { return }
switch identifier {
case "HomeToSection":
let destination = segue.destination as! SectionViewController
let indexPath = sender as! IndexPath ***HERE***
let section = sections[indexPath.row]
destination.section = section
destination.sections = sections
destination.indexPath = indexPath
destination.transitioningDelegate = self
let attributes = chapter1CollectionView.layoutAttributesForItem(at: indexPath)!
let cellFrame = chapter1CollectionView.convert(attributes.frame, to: view)
presentSectionViewController.cellFrame = cellFrame
presentSectionViewController.cellTransform = animateCell(cellFrame: cellFrame)
isStatusBarHidden = true
UIView.animate(withDuration: 0.5, animations: {
self.setNeedsStatusBarAppearanceUpdate()
})
case "Benefits":
segue.destination.view.translatesAutoresizingMaskIntoConstraints = false
default:
break
}
}
The error: Could not cast value of type 'mConnectVocab.SectionCollectionViewCell' (0x1099171d8) to 'NSIndexPath' (0x7fff86d860c0).
(Could not cast value of type'...NSIndexPath'
Bradley D.
100% (14)Projects Completed
6
Freelancers worked with
6
Projects awarded
63%
Last project
12 May 2021
United States
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies