-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path68C6F7A0-0EA0-4639-A69A-A547EA293660.codesnippet
50 lines (43 loc) · 1.44 KB
/
68C6F7A0-0EA0-4639-A69A-A547EA293660.codesnippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDECodeSnippetCompletionPrefix</key>
<string>swizzle</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>TopLevel</string>
</array>
<key>IDECodeSnippetContents</key>
<string>#import <objc/runtime.h>
#import <objc/message.h>
void Swizzle(Class c, SEL orig, SEL new)
{
Method origMethod = class_getInstanceMethod(c, orig);
Method newMethod = class_getInstanceMethod(c, new);
if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod)))
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
else
method_exchangeImplementations(origMethod, newMethod);
}
@interface <#Class#> (swizzle)
- (<#return#>)<# Method Signature #>
@end
@implementation <#Class#> (swizzle)
- (<#return#>)<# Method Definition #>
{
<#code#>
}
@end</string>
<key>IDECodeSnippetIdentifier</key>
<string>68C6F7A0-0EA0-4639-A69A-A547EA293660</string>
<key>IDECodeSnippetLanguage</key>
<string>Xcode.SourceCodeLanguage.Objective-C</string>
<key>IDECodeSnippetTitle</key>
<string>Swizzle</string>
<key>IDECodeSnippetUserSnippet</key>
<true/>
<key>IDECodeSnippetVersion</key>
<integer>2</integer>
</dict>
</plist>