I have a problem with the convert objective-c to swift.
For my train, i converted MMPaper to swift, but in the property :
objective-c
- (void)interactionBeganAtPoint:(CGPoint)point
{
// Very basic communication between the transition controller and the top view controller
// It would be easy to add more control, support pop, push or no-op
HASmallCollectionViewController *presentingVC = (HASmallCollectionViewController *)[self.navigationController topViewController];
HASmallCollectionViewController *presentedVC = (HASmallCollectionViewController *)[presentingVC nextViewControllerAtPoint:point];
if (presentedVC!=nil)
{
[self.navigationController pushViewController:presentedVC animated:YES];
}
else
{
[self.navigationController popViewControllerAnimated:YES];
}
}
Swift
func interactionBeganAtPoint(point: CGPoint) {
var presentingVC: HomeViewController! = (self.navigationController.topViewController as HomeViewController)
var presentedVC: HomeViewController! = (presentingVC.nextViewControllerAtPoint(point) as HomeViewController)
if (presentedVC != nil) {
self.navigationController.pushViewController(presentedVC!, animated: true)
} else {
self.navigationController.popViewControllerAnimated(true)
}
}
The result is (problem in bold) :
libswiftCore.dylib`swift_dynamicCastClassUnconditional:
...
0x10cf7da1e: leaq 0x36b3d(%rip), %rax ; "Swift dynamic cast failed"
0x10cf7da25: movq %rax, 0xb4a2c(%rip) ; gCRAnnotations + 8
0x10cf7da2c: int3
**0x10cf7da2d: movq %rdi, %rax**
.....
You have an idea ?