Skip to content

Commit facc5d9

Browse files
dmaclachadrianheine
authored andcommitted
[clike mode] Add a better Objective C demo
Shows off some newer Objective C features and makes "visual" testing new features easier.
1 parent e0fae82 commit facc5d9

1 file changed

Lines changed: 26 additions & 6 deletions

File tree

mode/clike/index.html

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,36 @@ <h2>Objective-C example</h2>
147147
That spans two lines
148148
*/
149149

150-
#import <Test/Test.h>
150+
#import "MyClass.h"
151+
#import <AFramework/AFrameork.h>
152+
@import BFrameworkModule;
153+
154+
NS_ENUM(SomeValues) {
155+
aValue = 1;
156+
};
157+
158+
// A Class Extension with some properties
159+
@interface MyClass ()<AProtocol>
160+
@property(atomic, readwrite, assign) NSInteger anInt;
161+
@property(nonatomic, strong, nullable) NSString *aString;
162+
@end
163+
151164
@implementation YourAppDelegate
152165

153-
// This is a one-line comment
166+
- (instancetype)initWithString:(NSString *)aStringVar {
167+
if ((self = [super init])) {
168+
aString = aStringVar;
169+
}
170+
return self;
171+
}
154172

155-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
156-
char myString[] = "This is a C character array";
157-
int test = 5;
158-
return YES;
173+
- (BOOL)doSomething:(float)progress {
174+
NSString *myString = @"This is a ObjC string %f ";
175+
myString = [[NSString stringWithFormat:myString, progress] stringByAppendingString:self.aString];
176+
return myString.length > 100 ? NO : YES;
159177
}
178+
179+
@end
160180
</textarea></div>
161181

162182
<h2>Java example</h2>

0 commit comments

Comments
 (0)