<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>while - 标签 - 宋明的博客</title><link>https://apolla.cc/tags/while/</link><description>宋明的博客</description><generator>Hugo 0.170.0 &amp; FixIt v1.0.0-rc.5-mwimukpl</generator><language>zh-cn</language><lastBuildDate>Fri, 19 Apr 2024 15:20:05 +0800</lastBuildDate><atom:link href="https://apolla.cc/tags/while/index.xml" rel="self" type="application/rss+xml"/><item><title>3.1 异步序列</title><link>https://apolla.cc/posts/3.1-%E5%BC%82%E6%AD%A5%E5%BA%8F%E5%88%97/</link><pubDate>Fri, 19 Apr 2024 15:20:05 +0800</pubDate><guid>https://apolla.cc/posts/3.1-%E5%BC%82%E6%AD%A5%E5%BA%8F%E5%88%97/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;h1 class="heading-element" id="asyncsequence-简介"&gt;&lt;span&gt;AsyncSequence 简介&lt;/span&gt;&#10; &lt;a href="#asyncsequence-%e7%ae%80%e4%bb%8b" class="heading-mark"&gt;&lt;svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"&gt;&lt;path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;&#10;&lt;/h1&gt;&lt;p&gt;&lt;a href="https://developer.apple.com/documentation/swift/asyncsequence" target="_blank" rel="external nofollow noopener noreferrer"&gt;AsyncSequence&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt; 是一个支持异步迭代的协议，它和 &lt;a href="https://developer.apple.com/documentation/swift/sequence" target="_blank" rel="external nofollow noopener noreferrer"&gt;Sequence&lt;i class="fa-solid fa-external-link-alt fa-xs ms-1 text-secondary" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt; 非常类似，同样支持使用 &lt;code&gt;for&lt;/code&gt;、&lt;code&gt;while&lt;/code&gt;、&lt;code&gt;repeat&lt;/code&gt; 循环访问子元素，也支持使用 &lt;code&gt;map&lt;/code&gt;、&lt;code&gt;filter&lt;/code&gt;、&lt;code&gt;reduce&lt;/code&gt; 等高阶函数，只不过这些操作都是异步的。&lt;/p&gt;</description></item></channel></rss>