Closed ianhlavats closed 8 years ago
Ian, Hi!
What you entered is valid objective-c code. But is it a valid objective-c program?
What I'm saying is: would that compile in Xcode? Think about it. ;-)
And the simple answer is: No, it wouldn't. It is valid code, but not a valid program. iSwift processes and "compiles" programs as a whole, not just a single statement (which wouldn't qualify as a valid program anyway).
if you did it like this (like a correct Objective-C program) though, it would work:
@implementation someClass
- (void)someFunc {
if ([someObject someValue] != nil) {
}
}
@end
Please let me know in case anything is unclear :)
Thanks for the reply. I thought I was missing something obvious. ;)
You may want to add support for converting code fragments if it's not too much trouble! It would save a lot of time for users like me.
Regards, Ian
Well, Glad we sorted this one out! :)
As for your suggestion, to be honest, I've thought of it (to avoid mis-interpretations of what the app does, like this one), but given that it's built like a regular compiler-parser and based on the official (as unofficial and in-existent as it may be lol) Objective-C specifications (or at least trying to, as much as possible), this could make it a bit messy.
In any case, I'll add a "recheck" tag here - to revisit the issue at some later point, and not forget that it may still confuse people.
Thanks a lot for the input - keep it coming! ;-)
Issue moved here:
When attempting to convert this simple if statement it results in an error message:
Am I doing something wrong?