---
title: "X 归档 2023-07-21"
date: "2023-07-21"
tags:
  - x-archive
---

<div class="x-arch-meta">3 条动态 · 图 1 · 视频 2</div>
<div class="x-arch-day">
  <div class="x-arch-item">
    <input type="radio" name="xl-1682351857102929921" id="xl-1682351857102929921-zh" class="x-arch-lang-input x-arch-lang-input-zh" checked aria-label="显示译文" /><input type="radio" name="xl-1682351857102929921" id="xl-1682351857102929921-orig" class="x-arch-lang-input x-arch-lang-input-orig" aria-label="显示原文" /><div class="x-arch-head"><img class="x-arch-avatar" src="https://twimg.tweb.xin/twimg/profile_images/1587390960375316481/hFEl2TXy_bigger.jpg" alt="" loading="lazy" referrerpolicy="no-referrer" /><span class="x-arch-kind x-arch-kind-liked" aria-label="赞" title="赞"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z" /></svg></span><a class="x-arch-author" href="https://x.com/v_pradeilles" target="_blank" rel="nofollow noopener" data-name="Vincent Pradeilles" data-avatar="https://twimg.tweb.xin/twimg/profile_images/1587390960375316481/hFEl2TXy_bigger.jpg">@v_pradeilles</a><span class="x-arch-time">19:28</span><span class="x-arch-lang-switch" role="group" aria-label="切换原文/译文"><label for="xl-1682351857102929921-zh" class="x-arch-lang-opt x-arch-lang-zh">译</label><label for="xl-1682351857102929921-orig" class="x-arch-lang-opt x-arch-lang-orig">原</label></span><a class="x-arch-link" href="https://x.com/v_pradeilles/status/1682351857102929921" target="_blank" rel="noopener">原推文<svg class="x-arch-ext" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg></a></div>
    <div class="x-arch-text x-arch-orig"><pre class="x-arch-code" data-language="js"><code>if myString.count &gt; 0 {
  // `myString` isn't empty
}</code></pre>
<br /><br />This code seems pretty reasonable, doesn't it? 😌<br /><br />But it actually hides quite a serious issue!<br /><br />Can you guess what that issue is? 🤨</div>
    <div class="x-arch-text x-arch-trans"><pre class="x-arch-code" data-language="js"><code>if myString.count &gt; 0 {
  // `myString` 不为空
}</code></pre>
<br /><br />这段代码看起来相当合理，对吧？😌<br /><br />但它其实隐藏着一个相当严重的问题！<br /><br />你能猜到是什么问题吗？🤨</div>
    <video class="x-arch-video" preload="none" playsinline poster="/cdn-media/x/2023-07/1682351857102929921-poster.jpg" src="/cdn-media/x/2026-10/1682351857102929921-video.mp4" width="1280" height="720" data-duration="92" aria-label="@v_pradeilles 的视频"></video>
  </div>
  <div class="x-arch-item">
    <input type="radio" name="xl-1682384366494728192" id="xl-1682384366494728192-zh" class="x-arch-lang-input x-arch-lang-input-zh" checked aria-label="显示译文" /><input type="radio" name="xl-1682384366494728192" id="xl-1682384366494728192-orig" class="x-arch-lang-input x-arch-lang-input-orig" aria-label="显示原文" /><div class="x-arch-head"><img class="x-arch-avatar" src="https://twimg.tweb.xin/twimg/profile_images/1538290860713988101/eOcPF9Yf_bigger.jpg" alt="" loading="lazy" referrerpolicy="no-referrer" /><span class="x-arch-kind x-arch-kind-liked" aria-label="赞" title="赞"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z" /></svg></span><a class="x-arch-author" href="https://x.com/Andersonmancini" target="_blank" rel="nofollow noopener" data-name="Anderson Mancini" data-avatar="https://twimg.tweb.xin/twimg/profile_images/1538290860713988101/eOcPF9Yf_bigger.jpg">@Andersonmancini</a><span class="x-arch-time">21:37</span><span class="x-arch-lang-switch" role="group" aria-label="切换原文/译文"><label for="xl-1682384366494728192-zh" class="x-arch-lang-opt x-arch-lang-zh">译</label><label for="xl-1682384366494728192-orig" class="x-arch-lang-opt x-arch-lang-orig">原</label></span><a class="x-arch-link" href="https://x.com/Andersonmancini/status/1682384366494728192" target="_blank" rel="noopener">原推文<svg class="x-arch-ext" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg></a></div>
    <div class="x-arch-text x-arch-orig">Here I show you some of the magic behind this effect in vanilla #threejs. It looks like post-processing, but it's a simple plane with a custom shader, taking up 100% of the screen. I learned this in Bruno's course #threejsJourney and with @MaximeHeckel's blog.</div>
    <div class="x-arch-text x-arch-trans">这里我用原生 #threejs 展示这个效果背后的一些魔法。它看起来像后处理，其实只是一个铺满整个屏幕、带自定义 shader 的简单平面。这是我在 Bruno 的课程 #threejsJourney 和 @MaximeHeckel 的博客里学到的。</div>
    <video class="x-arch-video" preload="none" playsinline poster="/cdn-media/x/2023-07/1682384366494728192-poster.jpg" src="/cdn-media/x/2026-10/1682384366494728192-video.mp4" width="1146" height="720" data-duration="91" aria-label="@Andersonmancini 的视频"></video>
  </div>
  <div class="x-arch-item">
    <input type="radio" name="xl-1682419974953132034" id="xl-1682419974953132034-zh" class="x-arch-lang-input x-arch-lang-input-zh" checked aria-label="显示译文" /><input type="radio" name="xl-1682419974953132034" id="xl-1682419974953132034-orig" class="x-arch-lang-input x-arch-lang-input-orig" aria-label="显示原文" /><div class="x-arch-head"><img class="x-arch-avatar" src="https://twimg.tweb.xin/twimg/profile_images/1455156891190185985/chi6a2BU_bigger.jpg" alt="" loading="lazy" referrerpolicy="no-referrer" /><span class="x-arch-kind x-arch-kind-liked" aria-label="赞" title="赞"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z" /></svg></span><a class="x-arch-author" href="https://x.com/simonng" target="_blank" rel="nofollow noopener" data-name="Simon Ng" data-avatar="https://twimg.tweb.xin/twimg/profile_images/1455156891190185985/chi6a2BU_bigger.jpg">@simonng</a><span class="x-arch-time">23:59</span><span class="x-arch-lang-switch" role="group" aria-label="切换原文/译文"><label for="xl-1682419974953132034-zh" class="x-arch-lang-opt x-arch-lang-zh">译</label><label for="xl-1682419974953132034-orig" class="x-arch-lang-opt x-arch-lang-orig">原</label></span><a class="x-arch-link" href="https://x.com/simonng/status/1682419974953132034" target="_blank" rel="noopener">原推文<svg class="x-arch-ext" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 7h10v10" /><path d="M7 17 17 7" /></svg></a></div>
    <div class="x-arch-text x-arch-orig">It's not limited to SwiftUI. The new #Preview macro in Xcode 15 also lets you preview views developed in UIKit. <a href="https://www.appcoda.com/swiftui-preview-macro/" target="_blank" rel="noopener">https://www.appcoda.com/swiftui-preview-macro/</a></div>
    <div class="x-arch-text x-arch-trans">这并不局限于 SwiftUI。Xcode 15 的新 #Preview 宏也支持预览用 UIKit 开发的视图。</div>
    <div class="x-arch-media">
      <a href="/cdn-media/x/2026-10/1682419974953132034-1.png" target="_blank" rel="noopener"><img class="x-arch-img" src="/cdn-media/x/2026-10/1682419974953132034-1.png" alt="@simonng 的配图 1/1" loading="lazy" decoding="async" width="1594" height="798" /></a>
    </div>
  </div>
</div>
