Skip to content

Commit

Permalink
Update snippets. Add snippets for ARC projects
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos committed Nov 14, 2012
1 parent 9153d4a commit b128e72
Show file tree
Hide file tree
Showing 22 changed files with 433 additions and 17 deletions.
42 changes: 42 additions & 0 deletions Tools/Snippets/ARC/GHTestCase_subclass.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#pragma mark Object creation and destruction

- (void)dealloc
{
// Code
}

#pragma mark Accessors and mutators

#pragma mark Test setup and tear down

- (void)setUp
{
[super setUp];

// Code to be run before each test
}

- (void)tearDown
{
[super tearDown];

// Code to be run after each test
}

- (void)setUpClass
{
[super setUpClass];

// Code to be run before the first test
}

- (void)tearDownClass
{
[super tearDownClass];

// Code to be run after the last test
}

#pragma mark Tests

// Insert methods beginnning with test... here. Log with GHTestLog
33 changes: 33 additions & 0 deletions Tools/Snippets/ARC/HLSNibView_subclass.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma mark Object creation and destruction

- (id)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame])) {
// Code
}
return nil;
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
if ((self = [super initWithCoder:aDecoder])) {
// Code
}
return self;
}

- (void)dealloc
{
// Code
}

#pragma mark Accessors and mutators

#pragma mark View customisation

- (void)awakeFromNib
{
[super awakeFromNib];

// Code
}
25 changes: 25 additions & 0 deletions Tools/Snippets/ARC/HLSTableViewCell_subclass.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma mark Object creation and destruction

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
// Code
}
return self;
}

- (void)dealloc
{
// Code
}

#pragma mark Accessors and mutators

#pragma mark Cell customisation

- (void)awakeFromNib
{
[super awakeFromNib];

// Code
}
97 changes: 97 additions & 0 deletions Tools/Snippets/ARC/HLSViewController_subclass.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#pragma mark Object creation and destruction

- (id)init
{
if ((self = [super init])) {
// Code
}
return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder
{
if ((self = [super initWithCoder:aDecoder])) {
// Code
}
return self;
}

- (void)dealloc
{
// Code
}

- (void)releaseViews
{
[super releaseViews];

// Code
}

#pragma mark Accessors and mutators

#pragma mark View lifecycle

- (void)viewDidLoad
{
[super viewDidLoad];

// Code
}

- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];

// Code
}

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];

// Code
}

- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];

// Code
}

- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];

// Code
}

#pragma mark Orientation management

- (NSUInteger)supportedInterfaceOrientations
{
// Code, most probably one of:
// return [super supportedInterfaceOrientations] & UIInterfaceOrientationMaskAll;
// return [super supportedInterfaceOrientations] & UIInterfaceOrientationMaskPortrait;
// return [super supportedInterfaceOrientations] & UIInterfaceOrientationMaskLandscape;
// return [super supportedInterfaceOrientations] & UIInterfaceOrientationMaskAllButUpsideDown;
}

#pragma mark Memory warnings

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];

// Code
}

#pragma mark Localization

- (void)localize
{
[super localize];

// Code
}
File renamed without changes.
38 changes: 38 additions & 0 deletions Tools/Snippets/ARC/NSObject_subclass.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#pragma mark Class methods

+ (void)initialize
{
if (self != [ClassName class]) {
return;
}

// Code
}

#pragma mark Object creation and destruction

- (id)init
{
if ((self = [super init])) {
// Code
}
return self;
}

- (void)dealloc
{
// Code
}

#pragma mark Accessors and mutators

#pragma mark Description

- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p; field1: %@; field2: %@>",
[self class],
self,
field1,
field2];
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
63 changes: 63 additions & 0 deletions Tools/Snippets/non-ARC/HLSCursorDataSource_HLSCursorDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#pragma mark HLSCursorDataSource protocol implementation

- (NSUInteger)numberOfElementsForCursor:(HLSCursor *)cursor
{

}

- (UIView *)cursor:(HLSCursor *)cursor viewAtIndex:(NSUInteger)index selected:(BOOL)selected
{

}

- (NSString *)cursor:(HLSCursor *)cursor titleAtIndex:(NSUInteger)index
{

}

- (UIFont *)cursor:(HLSCursor *)cursor fontAtIndex:(NSUInteger)index selected:(BOOL)selected
{

}

- (UIColor *)cursor:(HLSCursor *)cursor textColorAtIndex:(NSUInteger)index selected:(BOOL)selected
{

}

- (UIColor *)cursor:(HLSCursor *)cursor shadowColorAtIndex:(NSUInteger)index selected:(BOOL)selected
{

}

- (CGSize)cursor:(HLSCursor *)cursor shadowOffsetAtIndex:(NSUInteger)index selected:(BOOL)selected
{

}

#pragma mark HLSCursorDelegate protocol implementation

- (void)cursor:(HLSCursor *)cursor didMoveFromIndex:(NSUInteger)index
{

}

- (void)cursor:(HLSCursor *)cursor didMoveToIndex:(NSUInteger)index
{

}

- (void)cursorDidStartDragging:(HLSCursor *)cursor
{

}

- (void)cursor:(HLSCursor *)cursor didDragNearIndex:(NSUInteger)index
{

}

- (void)cursorDidStopDragging:(HLSCursor *)cursor
{

}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,15 @@ - (void)viewDidDisappear:(BOOL)animated
// Code
}

- (void)viewDidUnload
{
[super viewDidUnload];

// Code
}

#pragma mark Orientation management

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
if (! [super shouldAutorotateToInterfaceOrientation:toInterfaceOrientation]) {
return NO;
}

- (NSUInteger)supportedInterfaceOrientations
{
// Code, most probably one of:
// return toInterfaceOrientation == UIInterfaceOrientationPortrait;
// return UIInterfaceOrientationIsPortrait(toInterfaceOrientation);
// return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
// return YES;
// return [super supportedInterfaceOrientations] & UIInterfaceOrientationMaskAll;
// return [super supportedInterfaceOrientations] & UIInterfaceOrientationMaskPortrait;
// return [super supportedInterfaceOrientations] & UIInterfaceOrientationMaskLandscape;
// return [super supportedInterfaceOrientations] & UIInterfaceOrientationMaskAllButUpsideDown;
}

#pragma mark Memory warnings
Expand Down
21 changes: 21 additions & 0 deletions Tools/Snippets/non-ARC/NSManagedObject_subclass.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma mark Non-trivial default values for new records

- (void)awakeFromInsert
{
[super awakeFromInsert];

// Code
}

#pragma mark Accessors and mutators

#pragma mark Description

- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p; field1: %@; field2: %@>",
[self class],
self,
field1,
field2];
}
File renamed without changes.
Loading

0 comments on commit b128e72

Please sign in to comment.