Reputation: 3072
extension SlideInAnimator: UIViewControllerAnimatedTransitioning {
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
// This works
UIView.animate(withDuration: 0.3, animations: { }) { transitionContext.completeTransition($0) }
// transitionContext.completeTransition causes the error
UIView.animate(withDuration: 0.3, animations: { }, completion: transitionContext.completeTransition)
}
}
Xcode isn't showing any errors but while compiling, it causes the error shown in the title (even after cleaning). Whenever I comment out the second animation, the error won't show up. Is this a bug or I'm just not allowed to use it like the second animation?
Upvotes: 2
Views: 5225
Reputation: 1
I've just spent a couple of hours trying to identify the cause of a swiftc exit code 1. After reading several posts, cleaning the project & restarting xcode several times, commenting out new chunks of code etc., I gave up and started to create a fresh project.
When I copied the first .swift file from old to new project I noticed that I had two .swift files with the same name in different folders. I tidied up my files and the project compiled OK.
In summary, as has been stated in other posts, Exit code 1 seems to be a catchall for when the compiler finds something weird & unexpected that it doesn't handle properly.
Upvotes: 0
Reputation: 2741
Simple Solution For This With xcode 8.2 and swift 3.0
Enjoy Happy Coding!!!
Upvotes: 2
Reputation: 8802
The swiftc failed with exit code 1
message indicates that the compiler crashed due to an internal problem. In my experience, that may or may not indicate that there's some type of syntax error with your code (although what you posted looks fine to me), but either way, the compiler can't handle it as you have it written.
The Swift toolchain is still very buggy unfortunately, and sometimes you have to "help it out" by trying a different syntax for whatever you're doing.
You may want to check https://bugs.swift.org and see if there's a bug already reported for it, and add one if not.
Upvotes: 3