Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift incompatibility #24

Open
gholias opened this issue Oct 11, 2014 · 1 comment
Open

Swift incompatibility #24

gholias opened this issue Oct 11, 2014 · 1 comment

Comments

@gholias
Copy link

gholias commented Oct 11, 2014

Im trying to use the TTAlertView in a Swift project.

The .h is imported in the ObjC Bridge file, but the xcode complains of a build time error when Im trying to use like this:
let alert:TTAlertView = TTAlertView(title: "Oops", message: "Something is missing:\n" + errorMsg, delegate: nil, cancelButtonTitle: "OK", otherButtonTitles:nil)

The only way I can build is by removing the otherButtonTitles parameter
let alert:TTAlertView = TTAlertView(title: "Oops", message: "Something is missing:\n" + errorMsg, delegate: nil, cancelButtonTitle: "OK")

but this causes a run time crash
-[TTAlertView initWithTitle:message:delegate:cancelButtonTitle:]: unrecognized selector sent to instance 0x7fdffd2b7a20

Any ideias what is wrong?

@jeremyellison
Copy link

It looks like this is due to the use of variadic arguments in the constructor. I expect a minor refactor would fix this. Take a look at this S.O. answer, I think it describes the steps it would take to make this swift compatible: http://stackoverflow.com/questions/24195796/how-do-you-call-an-objective-c-variadic-method-from-swift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants