Skip to content

Commit 2b54250

Browse files
committed
1 parent 15e4142 commit 2b54250

File tree

10 files changed

+122
-15
lines changed

10 files changed

+122
-15
lines changed

async.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
//
44
// IDECodeSnippetCompletionPrefix: dispatch_async
55
// IDECodeSnippetCompletionScopes: [CodeBlock]
6-
// IDECodeSnippetIdentifier: C86E89FA-6BAE-4BC2-8A98-FD6A9755987F
76
// IDECodeSnippetLanguage: Xcode.SourceCodeLanguage.C
87
// IDECodeSnippetUserSnippet: 1
98
// IDECodeSnippetVersion: 2
109
dispatch_async(dispatch_get_global_queue(<#dispatch_queue_priority_t priority#>, <#unsigned long flags#>), ^(void) {
1110
<#code#>
12-
11+
1312
dispatch_async(dispatch_get_main_queue(), ^(void) {
1413
<#code#>
1514
});
16-
});
15+
});

dispatch_main.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// dispatch main queue
2+
// Dispatch to do work in main queue.
3+
//
4+
// IDECodeSnippetCompletionPrefix: dispatch_main
5+
// IDECodeSnippetCompletionScopes: [CodeBlock]
6+
// IDECodeSnippetLanguage: Xcode.SourceCodeLanguage.C
7+
// IDECodeSnippetUserSnippet: 1
8+
// IDECodeSnippetVersion: 2
9+
dispatch_async(dispatch_get_main_queue(), ^(void) {
10+
<#code#>
11+
});

else_if.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// else if
2+
// else if statement
3+
//
4+
// IDECodeSnippetCompletionPrefix: elif
5+
// IDECodeSnippetCompletionScopes: [CodeBlock]
6+
// IDECodeSnippetLanguage: Xcode.SourceCodeLanguage.C
7+
// IDECodeSnippetUserSnippet: 1
8+
// IDECodeSnippetVersion: 2
9+
else if (<#condition#>) {
10+
<#statements-if-condition-true#>
11+
}

multi_if.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// multi if
22
// multi if statement
33
//
4-
// IDECodeSnippetCompletionPrefix: ifelseif
4+
// IDECodeSnippetCompletionPrefix: multiif
55
// IDECodeSnippetCompletionScopes: [CodeBlock]
6-
// IDECodeSnippetIdentifier: EA201D18-4DE9-4272-AEA2-3D37F42F2528
76
// IDECodeSnippetLanguage: Xcode.SourceCodeLanguage.C
87
// IDECodeSnippetUserSnippet: 1
98
// IDECodeSnippetVersion: 2

queue_async.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//
44
// IDECodeSnippetCompletionPrefix: queue_async
55
// IDECodeSnippetCompletionScopes: [CodeBlock]
6-
// IDECodeSnippetIdentifier: CCFDD2D4-0F42-46EA-8303-2B64081CE19F
76
// IDECodeSnippetLanguage: Xcode.SourceCodeLanguage.C
87
// IDECodeSnippetUserSnippet: 1
98
// IDECodeSnippetVersion: 2
@@ -13,4 +12,4 @@
1312
[[NSOperationQueue mainQueue]addOperationWithBlock:^{
1413
<#code#>
1514
}];
16-
}];
15+
}];

queue_main.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// queue_main
2+
// use operation queue to do work in the background, and then to the main queue with the results
3+
//
4+
// IDECodeSnippetCompletionPrefix: queue_main
5+
// IDECodeSnippetCompletionScopes: [CodeBlock]
6+
// IDECodeSnippetLanguage: Xcode.SourceCodeLanguage.C
7+
// IDECodeSnippetUserSnippet: 1
8+
// IDECodeSnippetVersion: 2
9+
10+
[[NSOperationQueue mainQueue]addOperationWithBlock:^{
11+
<#code#>
12+
}];

singleton.m

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
//
44
// IDECodeSnippetCompletionPrefix: shared
55
// IDECodeSnippetCompletionScopes: [ClassImplementation]
6-
// IDECodeSnippetIdentifier: 7A45EDFA-B00C-43BF-B204-BF1639AB8EF1
76
// IDECodeSnippetLanguage: Xcode.SourceCodeLanguage.Objective-C
87
// IDECodeSnippetUserSnippet: 1
98
// IDECodeSnippetVersion: 2
10-
+ (instancetype)shared<#name#> {
11-
static id _shared<#name#> = nil;
9+
+ (instancetype)shared<#instance#> {
10+
static id _shared<#instance#> = nil;
1211
static dispatch_once_t onceToken;
1312
dispatch_once(&onceToken, ^{
14-
_shared<#name#> = [[self alloc]init];
13+
_shared<#instance#> = [[self alloc]init];
1514
});
16-
17-
return _shared<#name#>;
15+
16+
return _shared<#instance#>;
1817
}

storng_self.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// strong self
2+
// strong self reference
3+
//
4+
// IDECodeSnippetCompletionPrefix: sself
5+
// IDECodeSnippetCompletionScopes: [CodeBlock]
6+
// IDECodeSnippetLanguage: Xcode.SourceCodeLanguage.Objective-C
7+
// IDECodeSnippetUserSnippet: 1
8+
// IDECodeSnippetVersion: 2
9+
__strong __typeof(weakSelf)strongSelf = weakSelf;

tableview_datasource_delegate.m

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// UITableViewDataSource&Delegate
2+
// Table view data source and deletate methods
3+
//
4+
// IDECodeSnippetCompletionPrefix: tableviewds
5+
// IDECodeSnippetCompletionScopes: [ClassImplementation]
6+
// IDECodeSnippetLanguage: Xcode.SourceCodeLanguage.Objective-C
7+
// IDECodeSnippetUserSnippet: 1
8+
// IDECodeSnippetVersion: 2
9+
#pragma mark - UITableViewDataSource
10+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
11+
return <#number of sections#>;
12+
}
13+
14+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
15+
16+
switch (section) {
17+
case 0:
18+
return <#number of rows#>;
19+
default:
20+
return 0;
21+
}
22+
}
23+
24+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
25+
static NSString *cellIdentifier = @"Cell";
26+
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
27+
28+
// Configure the cell...
29+
30+
return cell;
31+
}
32+
33+
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
34+
switch (section) {
35+
case 0:
36+
return <#title for first header#>;
37+
break;
38+
39+
default:
40+
break;
41+
}
42+
return <#default title#>;
43+
}
44+
45+
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section {
46+
switch (section) {
47+
case 0:
48+
return <#title for first footer#>;
49+
break;
50+
51+
default:
52+
break;
53+
}
54+
return <#default title#>;
55+
}
56+
57+
#pragma mark - UITableViewDelegate
58+
59+
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
60+
return <#row height#>;
61+
}
62+
63+
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
64+
// Tells the delegate the table view is about to draw a cell for a particular row.
65+
}
66+
67+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
68+
// Tells the delegate that the specified row is now selected.
69+
}

weak_self.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// weak self
22
// Weak self reference
33
//
4-
// IDECodeSnippetCompletionPrefix: weakSelf
4+
// IDECodeSnippetCompletionPrefix: wself
55
// IDECodeSnippetCompletionScopes: [CodeBlock]
6-
// IDECodeSnippetIdentifier: 717F5611-AC63-43D6-BB9A-4F68F1551102
76
// IDECodeSnippetLanguage: Xcode.SourceCodeLanguage.Objective-C
87
// IDECodeSnippetUserSnippet: 1
98
// IDECodeSnippetVersion: 2

0 commit comments

Comments
 (0)