Skip to content

Commit 8f75583

Browse files
committed
更新 extend/override/block 系列 Code Snippets
1 parent 940d28b commit 8f75583

14 files changed

+179
-27
lines changed

Diff for: QMUI_extendNonVoidReturnNonArgv.codesnippet

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<plist version="1.0">
44
<dict>
55
<key>IDECodeSnippetCompletionPrefix</key>
6-
<string>extend_return_nonArgv</string>
6+
<string>extend_return_non_argv</string>
77
<key>IDECodeSnippetCompletionScopes</key>
88
<array>
9-
<string>All</string>
9+
<string>CodeBlock</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
1212
<string>ExtendImplementationOfNonVoidMethodWithoutArguments([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), &lt;#returnType#&gt;, ^&lt;#returnType#&gt;(&lt;#targetClass#&gt; *selfObject, &lt;#returnType#&gt; originReturnValue) {

Diff for: QMUI_extendNonVoidReturnSingleArgv.codesnippet

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<plist version="1.0">
44
<dict>
55
<key>IDECodeSnippetCompletionPrefix</key>
6-
<string>extend_return_argv</string>
6+
<string>extend_return_single_argv</string>
77
<key>IDECodeSnippetCompletionScopes</key>
88
<array>
9-
<string>All</string>
9+
<string>CodeBlock</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
1212
<string>ExtendImplementationOfNonVoidMethodWithSingleArgument([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), &lt;#argumentType#&gt;, &lt;#returnType#&gt;, ^&lt;#returnType#&gt;(&lt;#targetClass#&gt; *selfObject, &lt;#argumentType#&gt; firstArgv, &lt;#returnType#&gt; originReturnValue) {

Diff for: QMUI_extendNonVoidReturnTwoArgvs.codesnippet

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDECodeSnippetCompletionPrefix</key>
6+
<string>extend_return_two_argvs</string>
7+
<key>IDECodeSnippetCompletionScopes</key>
8+
<array>
9+
<string>CodeBlock</string>
10+
</array>
11+
<key>IDECodeSnippetContents</key>
12+
<string>ExtendImplementationOfNonVoidMethodWithTwoArguments([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), &lt;#argumentType1#&gt;, &lt;#argumentType2#&gt;, &lt;#returnType#&gt;, ^&lt;#returnType#&gt;(&lt;#targetClass#&gt; *selfObject, &lt;#argumentType1#&gt; firstArgv, &lt;#argumentType2#&gt; secondArgv, &lt;#returnType#&gt; originReturnValue) {
13+
return &lt;#custom extend#&gt;;
14+
});</string>
15+
<key>IDECodeSnippetIdentifier</key>
16+
<string>DFCA59C1-07E0-4857-AE4D-3C9045016712</string>
17+
<key>IDECodeSnippetLanguage</key>
18+
<string>Xcode.SourceCodeLanguage.Objective-C</string>
19+
<key>IDECodeSnippetTitle</key>
20+
<string>Extend Implementation Of Non Void Return Two Arguments</string>
21+
<key>IDECodeSnippetUserSnippet</key>
22+
<true/>
23+
<key>IDECodeSnippetVersion</key>
24+
<integer>0</integer>
25+
</dict>
26+
</plist>

Diff for: QMUI_extendVoidReturnNonArgv.codesnippet

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<plist version="1.0">
44
<dict>
55
<key>IDECodeSnippetCompletionPrefix</key>
6-
<string>extend_void_nonA</string>
6+
<string>extend_void_non_argv</string>
77
<key>IDECodeSnippetCompletionScopes</key>
88
<array>
9-
<string>All</string>
9+
<string>CodeBlock</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
1212
<string>ExtendImplementationOfVoidMethodWithoutArguments([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), ^(&lt;#targetClass#&gt; *selfObject) {

Diff for: QMUI_extendVoidReturnSingleArgv.codesnippet

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<plist version="1.0">
44
<dict>
55
<key>IDECodeSnippetCompletionPrefix</key>
6-
<string>extend_void_argv</string>
6+
<string>extend_void_single_argv</string>
77
<key>IDECodeSnippetCompletionScopes</key>
88
<array>
9-
<string>All</string>
9+
<string>CodeBlock</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
1212
<string>ExtendImplementationOfVoidMethodWithSingleArgument([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), &lt;#argumentType#&gt;, ^(&lt;#targetClass#&gt; *selfObject, &lt;#argumentType#&gt; firstArgv) {

Diff for: QMUI_extendVoidReturnTwoArgvs.codesnippet

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDECodeSnippetCompletionPrefix</key>
6+
<string>extend_void_two_argvs</string>
7+
<key>IDECodeSnippetCompletionScopes</key>
8+
<array>
9+
<string>CodeBlock</string>
10+
</array>
11+
<key>IDECodeSnippetContents</key>
12+
<string>ExtendImplementationOfVoidMethodWithTwoArguments([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), &lt;#argumentType1#&gt;, &lt;#argumentType2#&gt;, ^(&lt;#targetClass#&gt; *selfObject, &lt;#argumentType1#&gt; firstArgv, &lt;#argumentType2#&gt; secondArgv) {
13+
&lt;#custom extend#&gt;
14+
});</string>
15+
<key>IDECodeSnippetIdentifier</key>
16+
<string>61426012-95A0-401A-A3AC-89F229A9B831</string>
17+
<key>IDECodeSnippetLanguage</key>
18+
<string>Xcode.SourceCodeLanguage.Objective-C</string>
19+
<key>IDECodeSnippetTitle</key>
20+
<string>Extend Implementation Of Void Return Two Arguments</string>
21+
<key>IDECodeSnippetUserSnippet</key>
22+
<true/>
23+
<key>IDECodeSnippetVersion</key>
24+
<integer>0</integer>
25+
</dict>
26+
</plist>

Diff for: QMUI_overrideNonVoidReturnNonArgv.codesnippet

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
<plist version="1.0">
44
<dict>
55
<key>IDECodeSnippetCompletionPrefix</key>
6-
<string>override_return_nonA</string>
6+
<string>override_return_non_argv</string>
77
<key>IDECodeSnippetCompletionScopes</key>
88
<array>
9-
<string>All</string>
9+
<string>CodeBlock</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
12-
<string>OverrideImplementation([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP originIMP) {
12+
<string>OverrideImplementation([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP (^originalIMPProvider)(void)) {
1313
return ^&lt;#returnType#&gt;(&lt;#targetClass#&gt; *selfObject) {
1414
// call super
1515
&lt;#returnType#&gt; (*originSelectorIMP)(id, SEL);
16-
originSelectorIMP = (&lt;#returnType#&gt; (*)(id, SEL))originIMP;
16+
originSelectorIMP = (&lt;#returnType#&gt; (*)(id, SEL))originalIMPProvider();
1717
&lt;#returnType#&gt; result = originSelectorIMP(selfObject, originCMD);
1818

1919
// avoid superclass

Diff for: QMUI_overrideNonVoidReturnSingleArgv.codesnippet

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
<plist version="1.0">
44
<dict>
55
<key>IDECodeSnippetCompletionPrefix</key>
6-
<string>override_return_argv</string>
6+
<string>override_return_single_argv</string>
77
<key>IDECodeSnippetCompletionScopes</key>
88
<array>
9-
<string>All</string>
9+
<string>CodeBlock</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
12-
<string>OverrideImplementation([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP originIMP) {
12+
<string>OverrideImplementation([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP (^originalIMPProvider)(void)) {
1313
return ^&lt;#returnType#&gt;(&lt;#targetClass#&gt; *selfObject, &lt;#argumentType#&gt; firstArgv) {
1414

1515
// call super
1616
&lt;#returnType#&gt; (*originSelectorIMP)(id, SEL, &lt;#argumentType#&gt;);
17-
originSelectorIMP = (&lt;#returnType#&gt; (*)(id, SEL, &lt;#argumentType#&gt;))originIMP;
17+
originSelectorIMP = (&lt;#returnType#&gt; (*)(id, SEL, &lt;#argumentType#&gt;))originalIMPProvider();
1818
&lt;#returnType#&gt; result = originSelectorIMP(selfObject, originCMD, firstArgv);
1919

2020
// avoid superclass

Diff for: QMUI_overrideNonVoidReturnTwoArgvs.codesnippet

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDECodeSnippetCompletionPrefix</key>
6+
<string>override_return_two_argvs</string>
7+
<key>IDECodeSnippetCompletionScopes</key>
8+
<array>
9+
<string>CodeBlock</string>
10+
</array>
11+
<key>IDECodeSnippetContents</key>
12+
<string>OverrideImplementation([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP (^originalIMPProvider)(void)) {
13+
return ^&lt;#returnType#&gt;(&lt;#targetClass#&gt; *selfObject, &lt;#argumentType1#&gt; firstArgv, &lt;#argumentType2#&gt; secondArgv) {
14+
15+
// call super
16+
&lt;#returnType#&gt; (*originSelectorIMP)(id, SEL, &lt;#argumentType1#&gt;, &lt;#argumentType2#&gt;);
17+
originSelectorIMP = (&lt;#returnType#&gt; (*)(id, SEL, &lt;#argumentType1#&gt;, &lt;#argumentType2#&gt;))originalIMPProvider();
18+
&lt;#returnType#&gt; result = originSelectorIMP(selfObject, originCMD, firstArgv, secondArgv);
19+
20+
// avoid superclass
21+
if (![selfObject isKindOfClass:originClass]) return result;
22+
23+
return &lt;#custom override#&gt;
24+
};
25+
});</string>
26+
<key>IDECodeSnippetIdentifier</key>
27+
<string>03686901-F803-4AB2-82AB-BD507D7403DB</string>
28+
<key>IDECodeSnippetLanguage</key>
29+
<string>Xcode.SourceCodeLanguage.Objective-C</string>
30+
<key>IDECodeSnippetTitle</key>
31+
<string>Override Implementation Of Non Void Return Two Arguments</string>
32+
<key>IDECodeSnippetUserSnippet</key>
33+
<true/>
34+
<key>IDECodeSnippetVersion</key>
35+
<integer>0</integer>
36+
</dict>
37+
</plist>

Diff for: QMUI_overrideVoidReturnNonArgv.codesnippet

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
<plist version="1.0">
44
<dict>
55
<key>IDECodeSnippetCompletionPrefix</key>
6-
<string>override_void_nonArgv</string>
6+
<string>override_void_non_argv</string>
77
<key>IDECodeSnippetCompletionScopes</key>
88
<array>
9-
<string>All</string>
9+
<string>CodeBlock</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
12-
<string>OverrideImplementation([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP originIMP) {
12+
<string>OverrideImplementation([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP (^originalIMPProvider)(void)) {
1313
return ^(&lt;#targetClass#&gt; *selfObject) {
1414

1515
// call super
1616
void (*originSelectorIMP)(id, SEL);
17-
originSelectorIMP = (void (*)(id, SEL))originIMP;
17+
originSelectorIMP = (void (*)(id, SEL))originalIMPProvider();
1818
originSelectorIMP(selfObject, originCMD);
1919

2020
// avoid superclass

Diff for: QMUI_overrideVoidReturnSingleArgv.codesnippet

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
<plist version="1.0">
44
<dict>
55
<key>IDECodeSnippetCompletionPrefix</key>
6-
<string>override_void_argv</string>
6+
<string>override_void_single_argv</string>
77
<key>IDECodeSnippetCompletionScopes</key>
88
<array>
9-
<string>All</string>
9+
<string>CodeBlock</string>
1010
</array>
1111
<key>IDECodeSnippetContents</key>
12-
<string>OverrideImplementation([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP originIMP) {
12+
<string>OverrideImplementation([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP (^originalIMPProvider)(void)) {
1313
return ^(&lt;#targetClass#&gt; *selfObject, &lt;#argumentType#&gt; firstArgv) {
1414

1515
// call super
1616
void (*originSelectorIMP)(id, SEL, &lt;#argumentType#&gt;);
17-
originSelectorIMP = (void (*)(id, SEL, &lt;#argumentType#&gt;))originIMP;
17+
originSelectorIMP = (void (*)(id, SEL, &lt;#argumentType#&gt;))originalIMPProvider();
1818
originSelectorIMP(selfObject, originCMD, firstArgv);
1919

2020
// avoid superclass

Diff for: QMUI_overrideVoidReturnTwoArgvs.codesnippet

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDECodeSnippetCompletionPrefix</key>
6+
<string>override_void_two_argvs</string>
7+
<key>IDECodeSnippetCompletionScopes</key>
8+
<array>
9+
<string>CodeBlock</string>
10+
</array>
11+
<key>IDECodeSnippetContents</key>
12+
<string>OverrideImplementation([&lt;#targetClass#&gt; class], @selector(&lt;#targetSelector#&gt;), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP (^originalIMPProvider)(void)) {
13+
return ^(&lt;#targetClass#&gt; *selfObject, &lt;#argumentType1#&gt; firstArgv, &lt;#argumentType2#&gt; secondArgv) {
14+
15+
// call super
16+
void (*originSelectorIMP)(id, SEL, &lt;#argumentType1#&gt;, &lt;#argumentType2#&gt;);
17+
originSelectorIMP = (void (*)(id, SEL, &lt;#argumentType1#&gt;, &lt;#argumentType2#&gt;))originalIMPProvider();
18+
originSelectorIMP(selfObject, originCMD, firstArgv, secondArgv);
19+
20+
// avoid superclass
21+
if (![selfObject isKindOfClass:originClass]) return;
22+
23+
&lt;#custom override#&gt;
24+
};
25+
});</string>
26+
<key>IDECodeSnippetIdentifier</key>
27+
<string>BD790850-4DC6-4F53-AAB1-FF21AAE2BE74</string>
28+
<key>IDECodeSnippetLanguage</key>
29+
<string>Xcode.SourceCodeLanguage.Objective-C</string>
30+
<key>IDECodeSnippetTitle</key>
31+
<string>Override Implementation Of Void Return Two Arguments</string>
32+
<key>IDECodeSnippetUserSnippet</key>
33+
<true/>
34+
<key>IDECodeSnippetVersion</key>
35+
<integer>0</integer>
36+
</dict>
37+
</plist>

Diff for: QM_block_as_argument.codesnippet

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plist version="1.0">
44
<dict>
55
<key>IDECodeSnippetCompletionPrefix</key>
6-
<string>blockArguments</string>
6+
<string>blockParameterInMethod</string>
77
<key>IDECodeSnippetCompletionScopes</key>
88
<array>
99
<string>All</string>
@@ -15,9 +15,9 @@
1515
<key>IDECodeSnippetLanguage</key>
1616
<string>Xcode.SourceCodeLanguage.Objective-C</string>
1717
<key>IDECodeSnippetSummary</key>
18-
<string>方法参数里的block</string>
18+
<string>OC方法参数里的 block 声明</string>
1919
<key>IDECodeSnippetTitle</key>
20-
<string>define block as method arguments</string>
20+
<string>block as OC method parameter</string>
2121
<key>IDECodeSnippetUserSnippet</key>
2222
<true/>
2323
<key>IDECodeSnippetVersion</key>

Diff for: QM_block_as_argument_in_Function.codesnippet

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDECodeSnippetCompletionPrefix</key>
6+
<string>blockParameterInFunction</string>
7+
<key>IDECodeSnippetCompletionScopes</key>
8+
<array>
9+
<string>All</string>
10+
</array>
11+
<key>IDECodeSnippetContents</key>
12+
<string>&lt;#returnType#&gt; (^&lt;#blockName#&gt;)(&lt;#parameterTypes#&gt;)</string>
13+
<key>IDECodeSnippetIdentifier</key>
14+
<string>F0EEA7C4-643E-4347-BE1C-762B578B6929</string>
15+
<key>IDECodeSnippetLanguage</key>
16+
<string>Xcode.SourceCodeLanguage.Objective-C</string>
17+
<key>IDECodeSnippetSummary</key>
18+
<string>C函数参数里的 block 声明</string>
19+
<key>IDECodeSnippetTitle</key>
20+
<string>block as C function parameter</string>
21+
<key>IDECodeSnippetUserSnippet</key>
22+
<true/>
23+
<key>IDECodeSnippetVersion</key>
24+
<integer>0</integer>
25+
</dict>
26+
</plist>

0 commit comments

Comments
 (0)