-
Notifications
You must be signed in to change notification settings - Fork 236
/
QM_property_swizzle_assign.codesnippet
31 lines (30 loc) · 1.23 KB
/
QM_property_swizzle_assign.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
<?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>propertySwizzleAssign</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>ClassImplementation</string>
</array>
<key>IDECodeSnippetContents</key>
<string>static char kAssociatedObjectKey_<#property name#>;
- (void)set<#property name#> {
objc_setAssociatedObject(self, &kAssociatedObjectKey_<#property name#>, @(<#argument name#>), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- <#property getter#> {
return [((NSNumber *)objc_getAssociatedObject(self, &kAssociatedObjectKey_<#property name#>)) <#NSNumber value type for property#>];
}</string>
<key>IDECodeSnippetIdentifier</key>
<string>83D77BF6-443B-4513-A2C3-DAE9263D6995</string>
<key>IDECodeSnippetLanguage</key>
<string>Xcode.SourceCodeLanguage.Objective-C</string>
<key>IDECodeSnippetTitle</key>
<string>用swizzle方式创建assign类型的property的getter/setter</string>
<key>IDECodeSnippetUserSnippet</key>
<true/>
<key>IDECodeSnippetVersion</key>
<integer>2</integer>
</dict>
</plist>