Skip to content

Instantly share code, notes, and snippets.

View McZonk's full-sized avatar

Max McZonk

  • Germany
View GitHub Profile
#import <Foundation/Foundation.h>
@interface MyObject : NSObject
- (id)initWithName:(NSString*)name;
@property (nonatomic, retain) NSString* name;
@end
#import <Foundation/Foundation.h>
@interface MyObject : NSObject
- (id)initWithName:(NSString*)name;
@property (nonatomic, retain) NSString* name;
@end
- (void)myMethod {
NSError* error = [NSError errorWithDomain:@"myDomain" code:42 userInfo:@{ @"Foo": @"Bar" }];
NSString* file = [NSBundle.mainBundle pathForResource:@"Info" ofType:@"plist"];
NSData* data = [NSData dataWithContentsOfFile:file options:0 error:&error];
// safe
if(data == nil) {
// only access error if data was nil
//
// UIPCenteredScrollView.m
// Plus
//
// Created by Maximilian Christ on 5/30/12.
// Copyright (c) 2012 mczonk.de. All rights reserved.
//
#import "UIPCenteredScrollView.h"
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath {
NotificationCell* cell = [tableView dequeueReusableCellWithIdentifier:NotificationCell.defaultReuseIdentifier forIndexPath:indexPath];
cell.notification = self.notifications[indexPath.row];
return cell;
}
@McZonk
McZonk / gist:4556864
Created January 17, 2013 15:43
instancetype benefits
@interface Octopus : NSObject
+ (instancetype)octopus;
- (instancetype)init;
@property (nonatomic, assign) int legs;
@end