First of all, here's my code:
let flickerFetcher : FlickrFetcher = FlickrFetcher()
var photos : UIImage[]? = UIImage[]() {
didSet { self.appsTableView.reloadData() }
}
func prepareImageViewController(ivc: ImageViewController, toDisplayPhoto photo: NSDictionary)
{
ivc.imageURL = flickerFetcher.URLforPhoto(photo, format: FlickrFetcher.FlickrPhotoFormat.Large)
ivc.title = photo.valueForKeyPath(flickerFetcher.FLICKR_PHOTO_TITLE) as String
}
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
// NSLog("Prepare for Segue beginning")
if sender!.isKindOfClass(UITableViewCell) {
// NSLog("Sender is UITableViewCell")
var indexPath : NSIndexPath = self.tableView.indexPathForCell(sender as UITableViewCell)
if indexPath != nil {
// NSLog("IndexPath is nil")
if segue!.identifier == "Display Photo"{
// NSLog("Segue Identified")
if segue!.destinationViewController.isKindOfClass(ImageViewController) {
NSLog("DestinationViewController is ImageViewController")
var destinationController = segue.destinationViewController as ImageViewController
if let photoDict = self.photos?[indexPath.row] as? NSDictionary {
self.prepareImageViewController(destinationController, toDisplayPhoto:photoDict)
}
}
}
}
}
}
I've narrowed the problem down to the implementation of the prepareImageViewController on the last line that gives me a crash linked to swift_dynamicCast. That I can't seem to figure out.