<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>iOS 16.3 - 标签 - 宋明的博客</title><link>https://apolla.cc/tags/ios-16.3/</link><description>宋明的博客</description><generator>Hugo 0.170.0 &amp; FixIt v1.0.0-rc.5-mwimukpl</generator><language>zh-cn</language><lastBuildDate>Thu, 23 Feb 2023 08:00:00 +0800</lastBuildDate><atom:link href="https://apolla.cc/tags/ios-16.3/index.xml" rel="self" type="application/rss+xml"/><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></channel></rss>