This repository has been archived by the owner on Jan 27, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattributes.html
382 lines (298 loc) · 19.1 KB
/
attributes.html
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<!-- seems to be needed -->
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
<title>@property( attributes) – De Re @property</title>
<meta name="description" content="Attributes define the behavior of the property and the code generated for the accessors. The default
attributes of a property are assign, nonserializable, readwrite.
">
<meta name="keywords" content="">
<!-- Twitter Cards -->
<meta name="twitter:title" content="@property( attributes)">
<meta name="twitter:description" content="Attributes define the behavior of the property and the code generated for the accessors. The default attributes of a property are assign, nonserializable, readwrite. For non-object properties you can omit attributes. For object properties choose copy, if the Class supports the NSCopying protocol. Otherwise default to retain. Everything else is...">
<meta name="twitter:site" content="@mulle_nat">
<meta name="twitter:creator" content="@mulle_nat">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://www.mulle-kybernetik.com/de-re-property/images/thumbs/attributes.png">
<!-- Open Graph -->
<meta property="og:locale" content="en_US">
<meta property="og:type" content="article">
<meta property="og:title" content="@property( attributes)">
<meta property="og:description" content="Attributes define the behavior of the property and the code generated for the accessors. The default attributes of a property are assign, nonserializable, readwrite. For non-object properties you can omit attributes. For object properties choose copy, if the Class supports the NSCopying protocol. Otherwise default to retain. Everything else is...">
<meta property="og:url" content="https://www.mulle-kybernetik.com/attributes.html">
<meta property="og:site_name" content="De Re @property">
<meta property="og:image" content="https://www.mulle-kybernetik.com/de-re-property/images/thumbs/attributes.png">
<meta property="og:logo" content="https://www.mulle-kybernetik.com/de-re-property/images/logo.png">
<link href="/de-re-property/atom.xml" type="application/atom+xml" rel="alternate" title="De Re @property Feed">
<link href="/de-re-property/index.rdf" type="application/rss+xml" rel="alternate" title="De Re @property Feed">
<link rel="canonical" href="https://www.mulle-kybernetik.com/attributes.html">
<!-- Mobile Specific Metas
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/skeleton.css">
<!-- Code Color
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="css/monokai.css">
<!-- Site custom css -->
<link rel="stylesheet" href="css/custom.css">
<!-- local FONT
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="css/junction.css">
<!-- Favicon
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="icon" type="image/svg" href="images/favicon.svg">
<!-- This tag allows for activation of ClearType in Mobile IE for smoothing fonts.-->
<meta http-equiv="cleartype" content="on">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- For all browsers -->
</head>
<body class="post">
<div class="container">
<div class="row">
<div id="post-first" class="four columns">
<div class="sideline">
<div class="bio">
<div class="bio-photo-container" style="display: inline-block">
<img src="images/dog-pic.jpg" class="bio-photo" alt="Nat! bio photo">
</div>
<div style="display: inline-block; padding-left: 8px">
<h4>Nat!</h4>
<p>Senior Mull</p>
</div>
<div class="author-social"><a href="//www.mulle-kybernetik.com" target="_blank" class="link"><img class="inline-img" src="images/homepage-svgrepo-com.svg"></a> <a href="//www.mulle-kybernetik.com" target="_blank" class="link">WWW</a></div>
<div class="author-social"><a href="mailto:[email protected]" target="_blank"><img class="inline-img" src="images/email-svgrepo-com.svg"></a> <a href="mailto:[email protected]" target="_blank" class="link">Email</a></div>
<div class="author-social"><a href="//twitter.com/mulle_nat" target="_blank"><img class="inline-img" src="images/twitter-svgrepo-com.svg"></a> <a href="//twitter.com/mulle_nat" target="_blank" class="link">Twitter</a></div>
<div class="author-social"><a href="//github.com/mulle-nat" target="_blank"><img class="inline-img" src="images/github-svgrepo-com.svg"></a> <a href="//github.com/mulle-nat" target="_blank" class="link">Github</a></div>
<div class="author-social"><a href="//twitch.tv/Mulle_kybernetiK_TV" target="_blank"><img class="inline-img" src="images/twitch-svgrepo-com.svg"></a> <a href="//twitch.tv/Mulle_kybernetiK_TV" target="_blank" class="link">Twitch</a></div>
</div> <!-- bio -->
<div class="title">
<div>
<h2>De Re @property <div style="font-size:10px; display: inline-block;">0.0.1</div> <a href="feed.xml"><img class="inline-img" src='images/feed-icon-28x28.png'></a></h2>
</div>
<h6>© 2025 by Nat!, Mulle kybernetiK. All rights reserved.</h6>
<p>
</div> <!-- title -->
<div class="contents">
<h4>Contents</h4>
<ul>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/intro.html" title="Intro">Intro</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/declaration.html" title="@property declaration">@property declaration</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/attributes.html" title="@property( attributes)">@property( attributes)</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/definition.html" title="@property definition">@property definition</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/access.html" title="@property access">@property access</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/runtime.html" title="@property signature">@property signature</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/class-inheritance.html" title="@property inheritance by class">@property inheritance by class</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/protocol-inheritance.html" title="@property inheritance by protocol">@property inheritance by protocol</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/protocolclass-inheritance.html" title="@property inheritance by protocolclass">@property inheritance by protocolclass</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/redeclaration.html" title="@property redeclaration">@property redeclaration</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/synthesize-directive.html" title="@synthesize">@synthesize</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/dynamic-directive.html" title="@dynamic">@dynamic</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/outro.html" title="Outro">Outro</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/assign.html" title="Reference: assign">Reference: assign</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/container.html" title="Reference: container">Reference: container</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/copy.html" title="Reference: copy">Reference: copy</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/dynamic.html" title="Reference: dynamic">Reference: dynamic</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/observable.html" title="Reference: observable">Reference: observable</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/nonatomic.html" title="Reference: nonatomic">Reference: nonatomic</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/readonly.html" title="Reference: readonly">Reference: readonly</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/retain.html" title="Reference: retain">Reference: retain</a>
</article>
<article>
<li class="no-bullet"><a class="internal-link" href="/de-re-property/serializable.html" title="Reference: serializable">Reference: serializable</a>
</article>
</ul>
<h5> Or read it like a <a href="book.html"><b>book</b></a>.</h6>
</div> <!-- contents -->
</div> <!-- sideline -->
</div>
<div id="post-second" class="eight columns">
<div class="title">
<div>
<h2>De Re @property <div style="font-size:10px; display: inline-block;">0.0.1</div> <a href="feed.xml"><img class="inline-img" src='images/feed-icon-28x28.png'></a></h2>
</div>
<h6>© 2025 by Nat!, Mulle kybernetiK. All rights reserved.</h6>
<p>
</div> <!-- title -->
<p>
<div id="main" role="main">
<article>
<h1>@property( attributes)</h1>
<div>
<p>Attributes define the behavior of the property and the code generated for the accessors. The default
attributes of a property are <code class="language-plaintext highlighter-rouge">assign</code>, <code class="language-plaintext highlighter-rouge">nonserializable</code>, <code class="language-plaintext highlighter-rouge">readwrite</code>.</p>
<p>For non-object properties you can omit attributes. For object properties choose <code class="language-plaintext highlighter-rouge">copy</code>, if
the Class supports the <code class="language-plaintext highlighter-rouge">NSCopying</code> protocol. Otherwise default to <code class="language-plaintext highlighter-rouge">retain</code>.
Everything else is a special case.</p>
<h2 id="general-attributes">General attributes</h2>
<p>In MulleObjC, the attributes you can use on all property types (e.g. <code class="language-plaintext highlighter-rouge">int</code>, <code class="language-plaintext highlighter-rouge">char *</code>, <code class="language-plaintext highlighter-rouge">struct CGPoint</code>, <code class="language-plaintext highlighter-rouge">id</code>) are:</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="assign.html"><code class="language-plaintext highlighter-rouge">assign</code></a></td>
<td>Directly assigns value without retaining or copying, used for primitives and non-retaining relationships.</td>
</tr>
<tr>
<td><a href="dynamic.html"><code class="language-plaintext highlighter-rouge">dynamic</code></a></td>
<td>Indicates that accessor methods are provided at runtime. No instance variable is generated</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">getter=getterName</code></td>
<td>Custom getter method name.</td>
</tr>
<tr>
<td><a href="observable.html"><code class="language-plaintext highlighter-rouge">observable</code></a></td>
<td>Used to notice changes in property values.</td>
</tr>
<tr>
<td><a href="nonatomic.html"><code class="language-plaintext highlighter-rouge">nonatomic</code></a></td>
<td>Useless syntax fluff, as it’s the default and <code class="language-plaintext highlighter-rouge">atomic</code> is not supported</td>
</tr>
<tr>
<td><a href="serializable.html"><code class="language-plaintext highlighter-rouge">nonserializable</code></a></td>
<td>Marks the property as not serializable.</td>
</tr>
<tr>
<td><a href="readonly.html"><code class="language-plaintext highlighter-rouge">readonly</code></a></td>
<td>Read-only property, only a getter is generated.</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">readwrite</code></td>
<td>The opposite of readonly, useless syntax fluff</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">setter=setterName</code></td>
<td>Custom setter method name.</td>
</tr>
<tr>
<td><a href="serializable.html"><code class="language-plaintext highlighter-rouge">serializable</code></a></td>
<td>Marks the property as serializable for archiving and serialization purposes.</td>
</tr>
</tbody>
</table>
<p>You can only choose one of <code class="language-plaintext highlighter-rouge">readonly</code> or <code class="language-plaintext highlighter-rouge">readwrite</code> for a property.
You can not choose <code class="language-plaintext highlighter-rouge">setter</code> for a <code class="language-plaintext highlighter-rouge">readonly</code> property.</p>
<h2 id="object-attributes">Object attributes</h2>
<p>These attributes are only useful on object types:</p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="retain.html"><code class="language-plaintext highlighter-rouge">retain</code></a></td>
<td>Retains the value when set, used for mutable objects</td>
</tr>
<tr>
<td><a href="copy.html"><code class="language-plaintext highlighter-rouge">copy</code></a></td>
<td>Copies the value when set, used for value types like <code class="language-plaintext highlighter-rouge">NSString</code>.</td>
</tr>
<tr>
<td><a href="container.html"><code class="language-plaintext highlighter-rouge">container</code></a></td>
<td>Used for properties that are collections, enabling additional behaviors.</td>
</tr>
</tbody>
</table>
<p>Some attributes exclude the use of another attribute, this may or may not be flagged by the compiler:</p>
<p>You can only choose one of <code class="language-plaintext highlighter-rouge">copy</code>, <code class="language-plaintext highlighter-rouge">assign</code>, <code class="language-plaintext highlighter-rouge">retain</code> for a property.</p>
</div>
</article>
</div>
<p>
<div class="left-right" id="pn-container">
<div class="left-half">
<span class="link">
Back to <a rel="prev" class="internal-link" href="/de-re-property/declaration.html">@property declaration</a>
</span>
</div>
<div class="right-half">
<span class="link">
Next <a rel="next" class="internal-link" href="/de-re-property/definition.html">@property definition</a>
</span>
</div>
</div> <!-- left_right -->
</div> <!-- eight columns -->
</div> <!-- row -->
</div> <!-- container -->
<script>
document.querySelectorAll('pre').forEach((block) => {
const button = document.createElement('button');
button.className = 'copy-button';
button.innerHTML = `<svg aria-hidden="true" data-prefix="far" data-icon="copy" class="svg-inline--fa fa-copy fa-fw fa-1x" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 440 500"><path fill="currentColor" d="M384 336H192c-9 0-16-7-16-16V64c0-9 7-16 16-16h140l68 68v204c0 9-7 16-16 16zm-192 48h192c35 0 64-29 64-64V116c0-13-5-25-14-34l-68-68c-9-9-21-14-34-14H192c-35 0-64 29-64 64v256c0 35 29 64 64 64zM64 128c-35 0-64 29-64 64v256c0 35 29 64 64 64h192c35 0 64-29 64-64v-32h-48v32c0 9-7 16-16 16H64c-9 0-16-7-16-16V192c0-9 7-16 16-16h32v-48H64z"/></svg>`;
block.appendChild(button);
button.addEventListener('click', () => {
const code = block.querySelector('code');
navigator.clipboard.writeText(code.textContent).then(() => {
// Change icon to checkmark
const originalHTML = button.innerHTML;
button.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="16" height="16"><path fill-rule="evenodd" d="M20 5a1 1 0 0 1 0 1l-9 13a1 1 0 0 1-1 0l-7-6a1 1 0 0 1 1-1l5 6 10-13a1 1 0 0 1 1 0z" clip-rule="evenodd"/></svg>';
// Reset after delay
setTimeout(() => {
// Restore original icon
button.innerHTML = originalHTML;
// fidget this for reasons...
button.style.color = '#6a6a7c';
}, 500);
});
});
});
</script>
</body>
</html>