Skip to content

Instantly share code, notes, and snippets.

@cappuccino
Created April 29, 2010 21:05
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 cappuccino/384242 to your computer and use it in GitHub Desktop.
Save cappuccino/384242 to your computer and use it in GitHub Desktop.
Objective-J / Objective-C differences:
1. No @interfaces, just combine the @interface with @implementation:
@implementation MyGreatClass : CPObject
{
CPString myString;
}
- (id)init
{
self = [super init];
if (self)
{
myString = @"hello";
}
return self;
}
@end
2. No pointers (everything is a reference), and no more type declarations:
Instead of:
NSArray * x = [NSArray array];
Do:
var x = [CPArray array];
3. Instead of #import, use @import:
@import <Foundation/Foundation.j>
4. Instead of NS, use CP, only use CGRect (like iPhone)
myView = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 200.0)];
And that's it (aside from being able to use all the features of JavaScript if you choose to do so as well of course).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment