Skip to content

Commit 825c50d

Browse files
doc: update example/appendix-a/demo8/README.md (#52) 3a3c037
1 parent 2b612a5 commit 825c50d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

appendix-a/demo8/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ <h1 id="什么是-environment-属性包装器"><a aria-hidden="true" tabindex="-
336336
<pre class="language-swift"><code class="language-swift code-highlight"><span class="code-line line-number" line="1"><span class="token attribute atrule">@EnvironmentObject</span> <span class="token keyword">var</span> order<span class="token punctuation">:</span> <span class="token class-name">Order</span>
337337
</span></code><input type="hidden" value="@EnvironmentObject var order: Order
338338
"><div onclick="copied(this)" class="copied"><svg class="octicon-copy" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"></path><path fill-rule="evenodd" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"></path></svg><svg class="octicon-check" aria-hidden="true" viewBox="0 0 16 16" fill="currentColor" height="12" width="12"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg></div></pre>
339-
<p>这种差异听起来很小,但由于实现 <code>@EnvironmentObject</code> 的方式而非常重要。 当我们说订单是 <code>Order</code>类型时,<code>SwiftUI</code> 将在其环境中查找该类型的对象并将其附加到<code>order</code> 属性。 但是,使用 <code>@Environment</code> 时,无法实现相同的行为,因为许多事物可能共享相同的数据类型。</p>
339+
<p>这种差异听起来很小,但由于实现 <code>@EnvironmentObject</code> 的方式而非常重要。 当我们说 <code>order</code> 的类型是 <code>Order</code> 时, <code>SwiftUI</code> 将在其环境中查找该类型的对象并将其附加到 <code>order</code> 属性。 但是,使用 <code>@Environment</code> 时,无法实现相同的行为,因为许多事物可能共享相同的数据类型。</p>
340340
<p>例如:</p>
341341
<pre class="language-swift"><code class="language-swift code-highlight"><span class="code-line line-number" line="1"><span class="token attribute atrule">@Environment</span><span class="token punctuation">(</span><span class="token punctuation">\</span><span class="token punctuation">.</span>accessibilityReduceMotion<span class="token punctuation">)</span> <span class="token keyword">var</span> reduceMotion
342342
</span><span class="code-line line-number" line="2"><span class="token attribute atrule">@Environment</span><span class="token punctuation">(</span><span class="token punctuation">\</span><span class="token punctuation">.</span>accessibilityReduceTransparency<span class="token punctuation">)</span> <span class="token keyword">var</span> reduceTransparency

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ <h2 id="license"><a aria-hidden="true" tabindex="-1" href="#license" class="anch
704704
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
705705
</svg>
706706
<span>Edit this page on GitHub</span>
707-
</a><span class="atime">2023/07/19</span></section>
707+
</a><span class="atime">2023/07/28</span></section>
708708
</markdown-style>
709709
</div>
710710
<script src="js/demo-preview.js?v=1.26.6"></script>

transforming-views/demo22/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ <h1 id="如何更改listtexteditor等的背景色"><a aria-hidden="true" tabinde
372372
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
373373
</svg>
374374
<span>Edit this page on GitHub</span>
375-
</a><span class="atime">2023/07/19</span></section>
375+
</a><span class="atime">2023/07/28</span></section>
376376
</markdown-style>
377377
</div>
378378
<script src="../../js/demo-preview.js?v=1.26.6"></script>

0 commit comments

Comments
 (0)