<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>宋明的博客</title><link>https://apolla.cc/</link><description>宋明的博客</description><generator>Hugo 0.170.0 &amp; FixIt v1.0.0-rc.5-mwimukpl</generator><language>zh-cn</language><lastBuildDate>Mon, 08 Apr 2024 15:42:24 +0800</lastBuildDate><atom:link href="https://apolla.cc/index.xml" rel="self" type="application/rss+xml"/><item><title>基础语法</title><link>https://apolla.cc/posts/%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/</link><pubDate>Mon, 08 Apr 2024 15:42:24 +0800</pubDate><guid>https://apolla.cc/posts/%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95/</guid><category domain="https://apolla.cc/categories/swift/">Swift</category><description>&lt;blockquote&gt;&#10;&lt;p&gt;用var定义变量，let定义常量，编译器能自动推断出变量\常量的类型&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h2 class="heading-element" id="常量"&gt;&lt;span&gt;常量&lt;/span&gt;&#10; &lt;a href="#%e5%b8%b8%e9%87%8f" 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;/h2&gt;&lt;ol&gt;&#10;&lt;li&gt;只能赋值1次&lt;/li&gt;&#10;&lt;li&gt;它的值不要求在编译时期确定，但使用之前必须赋值1次&#10;!&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 class="heading-element" id="常见数据类型"&gt;&lt;span&gt;常见数据类型&lt;/span&gt;&#10; &lt;a href="#%e5%b8%b8%e8%a7%81%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%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;/h2&gt;&lt;p&gt;!&lt;/p&gt;</description></item><item><title>1.5 SwiftUI 中的属性包装器</title><link>https://apolla.cc/posts/1.5-swiftui-%E4%B8%AD%E7%9A%84%E5%B1%9E%E6%80%A7%E5%8C%85%E8%A3%85%E5%99%A8/</link><pubDate>Wed, 11 Oct 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/1.5-swiftui-%E4%B8%AD%E7%9A%84%E5%B1%9E%E6%80%A7%E5%8C%85%E8%A3%85%E5%99%A8/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;以下内容适用于 iOS 16/macOS 13 以上的系统，iOS 17/macOS 14 新增的 &lt;a href="https://developer.apple.com/documentation/observation" target="_blank" rel="external nofollow noopener noreferrer"&gt;Observation&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; 框架简化了 SwiftUI 的状态管理，苹果的文档有非常详细的使用说明和迁移教程，笔者也写了一篇关于 Observation 的文章以供参考：&lt;a href="https://www.woter.xyz/blog/ios/swiftui/swiftui-observation-combine" target="_blank" rel="external nofollow noopener noreferrer"&gt;《有了 Observation，SwiftUI 还需要 Combine 吗》&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;/p&gt;&#10;&lt;/blockquote&gt;</description></item><item><title>1.3.3 模态（Modal）</title><link>https://apolla.cc/posts/1.3.3-%E6%A8%A1%E6%80%81modal/</link><pubDate>Tue, 10 Oct 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/1.3.3-%E6%A8%A1%E6%80%81modal/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;p&gt;模态是除导航之外的另一种重要的信息呈现方式，它通常以一种临时的界面和用户交互。如果把导航栈内的界面比作“主线”的话，模态就是分出来的“支线”。模态视图完成它的使命后，用户最终会回归至“主线”情景。&lt;/p&gt;&#10;&lt;p&gt;关于模态的更多设计语言以及使用场景，可以参考 &lt;a href="https://developer.apple.com/design/human-interface-guidelines/patterns/modality" target="_blank" rel="external nofollow noopener noreferrer"&gt;《人机界面指南》&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;/p&gt;</description></item><item><title>4.3 图表（Charts）</title><link>https://apolla.cc/posts/4.3-%E5%9B%BE%E8%A1%A8charts/</link><pubDate>Tue, 10 Oct 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/4.3-%E5%9B%BE%E8%A1%A8charts/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;h1 class="heading-element" id="基础"&gt;&lt;span&gt;基础&lt;/span&gt;&#10; &lt;a href="#%e5%9f%ba%e7%a1%80" 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/charts" target="_blank" rel="external nofollow noopener noreferrer"&gt;Charts&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; 是 iOS 16/macOS 13 的新特性，用于构建各种精美的图表，如柱状图、散点图、曲线图等。&lt;/p&gt;</description></item><item><title>1.4 SwiftUI 视图管理机制</title><link>https://apolla.cc/posts/1.4-swiftui-%E8%A7%86%E5%9B%BE%E7%AE%A1%E7%90%86%E6%9C%BA%E5%88%B6/</link><pubDate>Wed, 02 Aug 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/1.4-swiftui-%E8%A7%86%E5%9B%BE%E7%AE%A1%E7%90%86%E6%9C%BA%E5%88%B6/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;h1 class="heading-element" id="视图的身份标识identity"&gt;&lt;span&gt;视图的身份标识（Identity）&lt;/span&gt;&#10; &lt;a href="#%e8%a7%86%e5%9b%be%e7%9a%84%e8%ba%ab%e4%bb%bd%e6%a0%87%e8%af%86identity" 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;在 UIKit/AppKit 的世界，UIView/NSView 实例是引用类型（class），程序通过指针来引用和区分对象。要实现界面的更新，我们首先需要找到对应的视图，然后下达相应的指令，比如改变视图的位置或者颜色，然后界面才会随之更新，这是典型的命令式编程。&lt;/p&gt;</description></item><item><title>3.5 滑动视图（ScrollView）</title><link>https://apolla.cc/posts/3.5-%E6%BB%91%E5%8A%A8%E8%A7%86%E5%9B%BEscrollview/</link><pubDate>Tue, 25 Jul 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/3.5-%E6%BB%91%E5%8A%A8%E8%A7%86%E5%9B%BEscrollview/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;h1 class="heading-element" id="基础"&gt;&lt;span&gt;基础&lt;/span&gt;&#10; &lt;a href="#%e5%9f%ba%e7%a1%80" 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;ScrollView 初始化方法如下：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;init(&#10; _ axes: Axis.Set = .vertical,&#10; showsIndicators: Bool = true,&#10; content: () -&amp;gt; Content&#10;)&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;axes&lt;/code&gt; 用于指定滑动的方向，默认是垂直方向。&lt;/p&gt;</description></item><item><title>2.2 图片</title><link>https://apolla.cc/posts/2.2-%E5%9B%BE%E7%89%87/</link><pubDate>Mon, 24 Jul 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/2.2-%E5%9B%BE%E7%89%87/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;h1 class="heading-element" id="image"&gt;&lt;span&gt;Image&lt;/span&gt;&#10; &lt;a href="#image" 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/swiftui/image" target="_blank" rel="external nofollow noopener noreferrer"&gt;Image&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; 用于展示图片，它可以加载资源包（Bundle）中的图片和系统内置的图标。&lt;/p&gt;</description></item><item><title>4.4 基础动画</title><link>https://apolla.cc/posts/4.4-%E5%9F%BA%E7%A1%80%E5%8A%A8%E7%94%BB/</link><pubDate>Mon, 24 Jul 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/4.4-%E5%9F%BA%E7%A1%80%E5%8A%A8%E7%94%BB/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;p&gt;视图是数据状态的反映，状态的更新会驱动视图的更新。如果没有动画过渡，视图的变化会显得突兀。SwiftUI 提供了几种基于状态的动画，这些都是非常常用和基础的添加动画的方式。&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="animation-方法"&gt;&lt;span&gt;.animation 方法&lt;/span&gt;&#10; &lt;a href="#animation-%e6%96%b9%e6%b3%95" 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/swiftui/view/animation(_:value:)" target="_blank" rel="external nofollow noopener noreferrer"&gt;animation(_:value:)&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;/p&gt;</description></item><item><title>4.5 转场动画</title><link>https://apolla.cc/posts/4.5-%E8%BD%AC%E5%9C%BA%E5%8A%A8%E7%94%BB/</link><pubDate>Mon, 24 Jul 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/4.5-%E8%BD%AC%E5%9C%BA%E5%8A%A8%E7%94%BB/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;h1 class="heading-element" id="内置转场动画"&gt;&lt;span&gt;内置转场动画&lt;/span&gt;&#10; &lt;a href="#%e5%86%85%e7%bd%ae%e8%bd%ac%e5%9c%ba%e5%8a%a8%e7%94%bb" 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;/p&gt;</description></item><item><title>3.6 列表（List）</title><link>https://apolla.cc/posts/3.6-%E5%88%97%E8%A1%A8list/</link><pubDate>Mon, 05 Jun 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/3.6-%E5%88%97%E8%A1%A8list/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;h1 class="heading-element" id="list"&gt;&lt;span&gt;List&lt;/span&gt;&#10; &lt;a href="#list" 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;h2 class="heading-element" id="构建"&gt;&lt;span&gt;构建&lt;/span&gt;&#10; &lt;a href="#%e6%9e%84%e5%bb%ba" 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;/h2&gt;&lt;h3 class="heading-element" id="基础"&gt;&lt;span&gt;基础&lt;/span&gt;&#10; &lt;a href="#%e5%9f%ba%e7%a1%80" 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;/h3&gt;&lt;p&gt;&lt;a href="https://developer.apple.com/documentation/swiftui/list" target="_blank" rel="external nofollow noopener noreferrer"&gt;List&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;/p&gt;</description></item><item><title>2.3 视图样式与行为</title><link>https://apolla.cc/posts/2.3-%E8%A7%86%E5%9B%BE%E6%A0%B7%E5%BC%8F%E4%B8%8E%E8%A1%8C%E4%B8%BA/</link><pubDate>Sat, 06 May 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/2.3-%E8%A7%86%E5%9B%BE%E6%A0%B7%E5%BC%8F%E4%B8%8E%E8%A1%8C%E4%B8%BA/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;h1 class="heading-element" id="字体"&gt;&lt;span&gt;字体&lt;/span&gt;&#10; &lt;a href="#%e5%ad%97%e4%bd%93" 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;strong&gt;SwiftUI&lt;/strong&gt; 内置了许多不同大小的字体，它们具有动态缩放特性：&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;在不同设备上动态缩放。&lt;/li&gt;&#10;&lt;li&gt;在支持动态缩放的 App 中，根据手机设置的字体大小动态缩放。&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;span style="background: #007BFF; color: white; padding: 3px 10px; border-radius: 5px"&gt;&amp;gt; 查看示例&lt;/span&gt;&lt;/p&gt;</description></item><item><title>2.8 使用 UIKit、AppKit</title><link>https://apolla.cc/posts/2.8-%E4%BD%BF%E7%94%A8-uikitappkit/</link><pubDate>Thu, 23 Feb 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/2.8-%E4%BD%BF%E7%94%A8-uikitappkit/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;p&gt;SwiftUI 目前仍在发展中，相比古老而健壮的 UIKit/AppKit，它相对年轻，在生产实践中，有时我们需要借助 UIKit/AppKit 来实现 SwiftUI 难以实现的功能。&lt;/p&gt;&#10;&lt;p&gt;以下仅以 UIKit 为例进行说明，AppKit 与此类似。&lt;/p&gt;&#10;&lt;h1 class="heading-element" id="使用-uikit"&gt;&lt;span&gt;使用 UIKit&lt;/span&gt;&#10; &lt;a href="#%e4%bd%bf%e7%94%a8-uikit" 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;h2 class="heading-element" id="uiviewrepresentable"&gt;&lt;span&gt;&lt;a href="https://developer.apple.com/documentation/swiftui/uiviewrepresentable" target="_blank" rel="external nofollow noopener noreferrer"&gt;UIViewRepresentable&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;/span&gt;&#10; &lt;a href="#uiviewrepresentable" 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;/h2&gt;&lt;p&gt;SwiftUI 通过 UIViewRepresentable 协议可以调用 UIKit 中的视图，比如想使用 UISearchBar：&lt;/p&gt;</description></item><item><title>5.3 自定义手势</title><link>https://apolla.cc/posts/5.3-%E8%87%AA%E5%AE%9A%E4%B9%89%E6%89%8B%E5%8A%BF/</link><pubDate>Sun, 29 Jan 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/5.3-%E8%87%AA%E5%AE%9A%E4%B9%89%E6%89%8B%E5%8A%BF/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;p&gt;&lt;span style="background: #007BFF; color: white; padding: 3px 10px; border-radius: 5px"&gt;&amp;gt; 查看示例&lt;/span&gt;&lt;/p&gt;&#10;&lt;p&gt;SwiftUI 内置了一些常用手势，它们都实现了 &lt;a href="https://developer.apple.com/documentation/swiftui/gesture" target="_blank" rel="external nofollow noopener noreferrer"&gt;Gesture&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;/p&gt;&#10;&lt;p&gt;如果需要自定义手势，也需要实现该协议，其声明如下：&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;public protocol Gesture {&#10;&#10; /// The type representing the gesture&amp;#39;s value.&#10; associatedtype Value&#10;&#10; /// The type of gesture representing the body of `Self`.&#10; associatedtype Body : Gesture&#10;&#10; /// The content and behavior of the gesture.&#10; var body: Self.Body { get }&#10;}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;和 View 协议类似，body 属性是必须实现的，它的类型由关联类型 Body 定义。另一个关联类型 Value 用于保存手势的状态，在 &lt;code&gt;.onChange&lt;/code&gt; 、 &lt;code&gt;.udpating&lt;/code&gt; 等监听方法中返回该状态。&lt;/p&gt;</description></item><item><title>5.1 常见手势</title><link>https://apolla.cc/posts/5.1-%E5%B8%B8%E8%A7%81%E6%89%8B%E5%8A%BF/</link><pubDate>Sat, 28 Jan 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/5.1-%E5%B8%B8%E8%A7%81%E6%89%8B%E5%8A%BF/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;h2 class="heading-element" id="tapgesturespatialtapgesture"&gt;&lt;span&gt;&lt;a href="https://developer.apple.com/documentation/swiftui/tapgesture" target="_blank" rel="external nofollow noopener noreferrer"&gt;TapGesture&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/swiftui/spatialtapgesture" target="_blank" rel="external nofollow noopener noreferrer"&gt;SpatialTapGesture&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;/span&gt;&#10; &lt;a href="#tapgesturespatialtapgesture" 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;/h2&gt;&lt;p&gt;要为视图添加点击手势，可以使用 &lt;a href="https://developer.apple.com/documentation/swiftui/view/gesture(_:including:)" target="_blank" rel="external nofollow noopener noreferrer"&gt;gesture(_:including:)&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; 绑定一个 TapGesture 实例至视图，也可以直接在视图上使用 &lt;code&gt;.onTapGesture&lt;/code&gt; 方法。&lt;/p&gt;</description></item><item><title>5.2 手势的管理</title><link>https://apolla.cc/posts/5.2-%E6%89%8B%E5%8A%BF%E7%9A%84%E7%AE%A1%E7%90%86/</link><pubDate>Sat, 28 Jan 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/5.2-%E6%89%8B%E5%8A%BF%E7%9A%84%E7%AE%A1%E7%90%86/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;h1 class="heading-element" id="手势的状态监听"&gt;&lt;span&gt;手势的状态监听&lt;/span&gt;&#10; &lt;a href="#%e6%89%8b%e5%8a%bf%e7%9a%84%e7%8a%b6%e6%80%81%e7%9b%91%e5%90%ac" 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;code&gt;.onChanged&lt;/code&gt; 和 &lt;code&gt;.onEnded&lt;/code&gt; 分别监听手势的变化和结束。&lt;/p&gt;</description></item><item><title>4.7 动画的进阶使用</title><link>https://apolla.cc/posts/4.7-%E5%8A%A8%E7%94%BB%E7%9A%84%E8%BF%9B%E9%98%B6%E4%BD%BF%E7%94%A8/</link><pubDate>Tue, 17 Jan 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/4.7-%E5%8A%A8%E7%94%BB%E7%9A%84%E8%BF%9B%E9%98%B6%E4%BD%BF%E7%94%A8/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;h1 class="heading-element" id="transaction"&gt;&lt;span&gt;&lt;a href="https://developer.apple.com/documentation/swiftui/transaction" target="_blank" rel="external nofollow noopener noreferrer"&gt;Transaction&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;/span&gt;&#10; &lt;a href="#transaction" 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;事务（Transaction）是当前状态更新的上下文，包含状态变化过程中的动画。&lt;/p&gt;</description></item><item><title>4.6 动画原理</title><link>https://apolla.cc/posts/4.6-%E5%8A%A8%E7%94%BB%E5%8E%9F%E7%90%86/</link><pubDate>Fri, 13 Jan 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/4.6-%E5%8A%A8%E7%94%BB%E5%8E%9F%E7%90%86/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;h1 class="heading-element" id="animatable-协议"&gt;&lt;span&gt;Animatable 协议&lt;/span&gt;&#10; &lt;a href="#animatable-%e5%8d%8f%e8%ae%ae" 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;我们之所以能看见动画的效果，是因为 SwiftUI 在视图变化的首尾状态之间不断地重绘视图，一系列静态视图因“视觉暂留”作用而造成一种连续的视觉印象，让我们感觉视图动起来了，这其实也是电影的原理。比如一个视图需要从透明度 0 变成 1，SwiftUI 会在 0 和 1 之间不断地作插值运算，不断重绘不同透明度的视图（0，0.1，0.2，0.3 &amp;hellip; 1.0），直到视图不再变化。如果使用 &lt;code&gt;.linear&lt;/code&gt; 指定动画效果，那么视图的重绘过程是匀速的，如果使用 &lt;code&gt;.easeOut&lt;/code&gt;，那么重绘的过程是先快后慢，以此类推。&lt;/p&gt;</description></item><item><title>4.2 图形的绘制</title><link>https://apolla.cc/posts/4.2-%E5%9B%BE%E5%BD%A2%E7%9A%84%E7%BB%98%E5%88%B6/</link><pubDate>Mon, 09 Jan 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/4.2-%E5%9B%BE%E5%BD%A2%E7%9A%84%E7%BB%98%E5%88%B6/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;h1 class="heading-element" id="canvas-的使用"&gt;&lt;span&gt;Canvas 的使用&lt;/span&gt;&#10; &lt;a href="#canvas-%e7%9a%84%e4%bd%bf%e7%94%a8" 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;Canvas 字面意思就是“画布”，在这个画布上可以绘制各种图形。与 Shape 不同的是，Canvas 支持即时绘制，比如用户可以使用手指在屏幕上涂鸦。&lt;/p&gt;</description></item><item><title>3.9 自定义布局（Layout）</title><link>https://apolla.cc/posts/3.9-%E8%87%AA%E5%AE%9A%E4%B9%89%E5%B8%83%E5%B1%80layout/</link><pubDate>Sat, 07 Jan 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/3.9-%E8%87%AA%E5%AE%9A%E4%B9%89%E5%B8%83%E5%B1%80layout/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;br&gt;&#10;&lt;p&gt;SwiftUI 内置了丰富的布局容器，也支持简单的布局调整，它们能够解决大多数常用的布局需求。但仍然有所限制，比如 HStack 或者 VStack，它们只能在单一线性轴上进行布局，Grid 虽然可以兼顾横向和纵向，但子视图的位置不能随意调整。&lt;/p&gt;&#10;&lt;p&gt;而 Layout 协议支持自定义布局，我们可以使用它随心所欲地实现各种纷繁的布局效果。&lt;/p&gt;</description></item><item><title>4.1 形状（Shapes）的使用</title><link>https://apolla.cc/posts/4.1-%E5%BD%A2%E7%8A%B6shapes%E7%9A%84%E4%BD%BF%E7%94%A8/</link><pubDate>Sat, 07 Jan 2023 08:00:00 +0800</pubDate><guid>https://apolla.cc/posts/4.1-%E5%BD%A2%E7%8A%B6shapes%E7%9A%84%E4%BD%BF%E7%94%A8/</guid><category domain="https://apolla.cc/categories/swiftui/">SwiftUI</category><description>&lt;br&gt;&#10;&lt;h1 class="heading-element" id="常用的内置形状及样式"&gt;&lt;span&gt;常用的内置形状及样式&lt;/span&gt;&#10; &lt;a href="#%e5%b8%b8%e7%94%a8%e7%9a%84%e5%86%85%e7%bd%ae%e5%bd%a2%e7%8a%b6%e5%8f%8a%e6%a0%b7%e5%bc%8f" 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;h2 class="heading-element" id="内置形状"&gt;&lt;span&gt;内置形状&lt;/span&gt;&#10; &lt;a href="#%e5%86%85%e7%bd%ae%e5%bd%a2%e7%8a%b6" 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;/h2&gt;&lt;p&gt;SwiftUI 内置了一些常用的形状，比如矩形、椭圆、正圆等。&lt;/p&gt;</description></item></channel></rss>