Skip to content

Instantly share code, notes, and snippets.

@cdzombak
Created January 22, 2015 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdzombak/eec288f79d2e012e3730 to your computer and use it in GitHub Desktop.
Save cdzombak/eec288f79d2e012e3730 to your computer and use it in GitHub Desktop.
Swift compilation issue that took some of my time today. Solution: https://gist.github.com/cdzombak/431cea0a4c0ced8042a5
public class Router : NSObject {
typealias VCPushBlock = (UIViewController) -> (Void)
init(context: NSManagedObjectContext, pushBlock: VCPushBlock) {
// ...
}
convenience init(context: NSManagedObjectContext, owningViewController: UIViewController) {
self.init(context: context, pushBlock: {
owningViewController.navigationController?.pushViewController($0, animated: true)
// compiler error on previous line: Could not find an overload for 'init' that accepts the supplied arguments
})
}
// ...
}
@cdzombak
Copy link
Author

This turned out to be because Void != Void?. See the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment