<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>Hong Cheung — 程式設計 (繁體中文)</title><description>Jotting down what I&apos;ve learnt.</description><link>https://hongcheung.com/</link><item><title>我為什麼不再使用 Hermes Agent</title><link>https://hongcheung.com/tw/post/why-I-dont-use-hermes-agent-anymore/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/why-I-dont-use-hermes-agent-anymore/</guid><description>我如何設定 Hermes Agent、用它來做什麼，以及為什麼我不再使用它。</description><pubDate>Fri, 03 Jul 2026 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/89bcdece-b930-40bc-96b0-ffcebfdf6f8e&quot; alt=&quot;我為什麼不再使用 Hermes Agent&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;我如何設定-hermes-agent&quot;&gt;我如何設定 Hermes Agent&lt;/h2&gt;
&lt;p&gt;我的做法是讓它運行在我透過 Hetzner&lt;sup&gt;&lt;a href=&quot;#user-content-fn-1&quot; id=&quot;user-content-fnref-1&quot; data-footnote-ref=&quot;&quot; aria-describedby=&quot;footnote-label&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; 自行架設的 VPS 伺服器上。並用 Telegram 作為閘道，讓我在手機上與我的 GPT 對話。我當時使用的是 OpenRouter Owl Alpha 模型，它當時免費，且有 1M token 的上限。這對任何用途來說都相當足夠。&lt;/p&gt;
&lt;h3 id=&quot;長期記憶與參考資料&quot;&gt;長期記憶與參考資料&lt;/h3&gt;
&lt;p&gt;我也設定了 &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://github.com/michael-denyer/memory-mcp/tree/main&quot;&gt;MCP-Memory&lt;/a&gt;，用來將記憶儲存在 VPS 本機上，這樣我每次開始新的工作階段時就不需要重複說明。另外還有 &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://github.com/shinpr/mcp-local-rag&quot;&gt;MCP-Local-Rag&lt;/a&gt;，用於我必須為問題提供參考的本地書籍收藏。它涵蓋商業、健康、科學等主題。&lt;/p&gt;
&lt;h2 id=&quot;hermes-agent-的最佳使用情境對我而言&quot;&gt;Hermes Agent 的最佳使用情境（對我而言）&lt;/h2&gt;
&lt;h3 id=&quot;學習語言&quot;&gt;學習語言&lt;/h3&gt;
&lt;p&gt;我發現對我來說最好的使用情境是用它來學習語言。運作方式是：我建立了一個名為 Fiona 的語言學習代理。每次工作階段，當我以「Hey Fiona」開頭時，它就會把所有語言學習技能與情境載入到該工作階段中，讓我們知道接下來要做什麼。&lt;/p&gt;
&lt;p&gt;至於語言的部分，我一直在學西班牙語和日語。這個工作流程中的語言學習，大多只是我用 GPT 設定好的單字與釋義配對測驗。&lt;/p&gt;
&lt;h4 id=&quot;為我的目標語言尋找單字&quot;&gt;為我的目標語言尋找單字&lt;/h4&gt;
&lt;p&gt;我請它到 github 尋找並下載這兩種語言的 csv/md 檔案，並將它們分類到本地資料夾 /vocabs/Spanish 等之中。我會依程度將這些檔案命名為 N1-N5 和 A1-C2。所以我會有 N1.csv、A1.md——是混合的檔案類型。&lt;/p&gt;
&lt;h4 id=&quot;測驗&quot;&gt;測驗&lt;/h4&gt;
&lt;p&gt;我為 Fiona 設定了一條規則：每次問我目標語言中 5 個單字的釋義，而每次答錯，它就會把這個單字我答錯了幾次寫進另一個 wrong-N1.csv 檔案中。至於答對的，我會修改原始檔案，在該列加 1 分。分數越高，出現在測驗中的機率就越低。所以，測驗的單字是隨機的，但又是為我最佳化的。&lt;/p&gt;
&lt;h4 id=&quot;單字複習挑戰&quot;&gt;單字複習挑戰&lt;/h4&gt;
&lt;p&gt;這是我覺得很有用的東西。我設定了一些 cronjob，讓它每天自動在一天中傳送測驗給我。通常我會在早上 8 點左右、工作休息時間收到兩份測驗。11 點、午餐休息前再收到兩份。睡前再收到兩份，理想上是晚上 8 點。&lt;/p&gt;
&lt;h3 id=&quot;用它來學習語言的整體體驗&quot;&gt;用它來學習語言的整體體驗&lt;/h3&gt;
&lt;p&gt;我會說是好壞參半。可能是我的設定不夠精確，或者是依賴 LLM 反覆自行處理事情本身就不夠穩定。除了有時它確實能帶來還算不錯的「照我說的做」體驗之外，它有時會出現幻覺，並偏離軌道去執行各種奇怪的 bash。這讓整體體驗不那麼愉快。&lt;/p&gt;
&lt;h3 id=&quot;其他使用情境&quot;&gt;其他使用情境&lt;/h3&gt;
&lt;p&gt;我試過單純用它來聊天。你知道的，就是擁有一個記得我一切、並為我量身打造答案的個人助理，把我所有的抱負、習慣和處境都考慮進去。但到頭來，它永遠無法取代真人來進行有價值的對話。&lt;em&gt;你不知道你不知道的事&lt;/em&gt;。我可以把它設定成&lt;em&gt;我想要的樣子&lt;/em&gt;，而我相信這就是它的缺點。&lt;/p&gt;
&lt;p&gt;這就像人們試圖把 GPT 當作 AI 伴侶，他們可以把它設定成自己想要的樣子。這太過理想化，而且缺少了核心的人性元素，例如情緒、他們自己的願景、他們對你的感受、人與人之間的連結等等。所以，像朋友一樣和 GPT 聊天，真的不會順利。我不需要一個回音室或永遠的安慰者。我想聽的是真實生活中的經驗。&lt;/p&gt;
&lt;p&gt;話雖如此，我發現 GPT 或 AI 唯一還算有用的方式，就是單純把它當作搜尋引擎。大概就是這樣。網頁上不再有廣告，也不用點來點去。而且我比較喜歡從文字開始。&lt;/p&gt;
&lt;h2 id=&quot;hermes-agent-的替代方案不是-openclaw&quot;&gt;Hermes Agent 的替代方案（不是 OpenClaw）&lt;/h2&gt;
&lt;p&gt;有趣的是，我發現使用 OpenCode，或任何程式設計 IDE——那些為 AI 程式設計而打造的工具——整體來說比 Hermes Agent 更有用。&lt;/p&gt;
&lt;p&gt;它們與 Hermes Agent 的主要差別在於，它們大多是以專案為範圍。意思是它們只能在你所宣告的每個專案的那個資料夾內運作。但另一方面，預設情況下，要充分發揮 Hermes Agent / OpenClaw 的威力，你通常會給它們完整權限，這意味著它們可以、也會搞亂你機器上的其他檔案和設定。&lt;/p&gt;
&lt;p&gt;程式設計 IDE，每個代理一個新資料夾，這就是我現在的工作方式。我現在讓語言學習代理只在該資料夾內運作，投資研究員與顧問則只在另一個資料夾內運作。它們各自有不同的一套規則與防護措施。我可以輕鬆在它們之間切換，處理不同主題，並直接調整檔案本身，而不是使用 Hermes Agent。&lt;/p&gt;
&lt;h2 id=&quot;結論&quot;&gt;結論&lt;/h2&gt;
&lt;p&gt;Hermes Agent 聽起來很有創新性，也許確實如此。但我總覺得它過度設計，只為了滿足一個並非真正必要的需求。因為當我某次用它來學習語言時，我心想，唉，到這個地步我乾脆自己打造一個單字卡應用程式，資源消耗會更少，而且最重要的是非常穩定。&lt;/p&gt;
&lt;p&gt;但誰知道呢，也許有一天 Hermes Agent 會運行在機器人裡，而 Hermes Agent 會成為機器人作業系統。考慮到 Nvidia 在推出內建 Hermes Agent 的新 AI 電腦時對它的大力推動。&lt;/p&gt;
&lt;p&gt;但就目前而言，我已經把它解除安裝，並繼續在日常使用 OpenCode 和 KiloCode，而這一直很好。&lt;/p&gt;
&lt;p&gt;喔，我也因為隱私考量開始使用付費模型了。&lt;/p&gt;
&lt;section data-footnotes=&quot;&quot; class=&quot;footnotes&quot;&gt;&lt;h2 class=&quot;sr-only&quot; id=&quot;footnote-label&quot;&gt;Footnotes&lt;/h2&gt;
&lt;ol&gt;
&lt;li id=&quot;user-content-fn-1&quot;&gt;
&lt;p&gt;Hetzner 是我最喜歡的 VPS 伺服器。價格實惠、位於歐洲且非常穩定。我已經使用它超過 2 年，有兩台 VPS 伺服器。你可以使用&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://hetzner.cloud/?ref=ybCDonttXx99&quot;&gt;這個連結&lt;/a&gt;註冊，以獲得 €20 的雲端額度。這幾乎可以涵蓋你前兩到三個月的伺服器費用。 &lt;a href=&quot;#user-content-fnref-1&quot; data-footnote-backref=&quot;&quot; aria-label=&quot;Back to reference 1&quot; class=&quot;data-footnote-backref&quot;&gt;↩&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/89bcdece-b930-40bc-96b0-ffcebfdf6f8e"/><enclosure url="https://cms.hongct.com/assets/89bcdece-b930-40bc-96b0-ffcebfdf6f8e" length="14030" type="image/webp"/></item><item><title>如何解決 App Store 審查因 NSUserTrackingUsageDescription 而被拒絕的問題</title><link>https://hongcheung.com/tw/post/how-to-fix-nsusertrackingusagedescription-rejection-from-app-store-review/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/how-to-fix-nsusertrackingusagedescription-rejection-from-app-store-review/</guid><description>最近我決定把 App 裡所有的 Google Ads 都移除。不過，當我把移除追蹤器的新版本提交給 App Review 團隊時，卻被他們拒絕了。原因如下。</description><pubDate>Thu, 26 Jun 2025 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/10f1c00b-5027-4533-82e4-8de39487a05d&quot; alt=&quot;如何解決 App Store 審查因 NSUserTrackingUsageDescription 而被拒絕的問題&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;p&gt;最近我決定把 App 裡所有的 Google Ads 都移除。不過，當我把移除追蹤器的新版本提交給 App Review 團隊時，卻被他們拒絕了。原因如下：&lt;/p&gt;
&lt;h2 id=&quot;問題&quot;&gt;問題&lt;/h2&gt;
&lt;hr&gt;
&lt;blockquote&gt;
&lt;h3 id=&quot;準則-21---需要更多資訊&quot;&gt;準則 2.1 - 需要更多資訊&lt;/h3&gt;
&lt;p&gt;我們無法順利存取 App 的全部或部分內容。為了繼續審查，我們需要能夠驗證所有帳號類型下 App 的所有功能與特性。一般而言，做法是提供一個可存取 App 內所有功能與特性的示範帳號。&lt;/p&gt;
&lt;p&gt;具體來說，我們希望取得一個沒有啟用訂閱的示範帳號，以便審查所有訂閱選項。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;後續步驟&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;若要解決此問題，請在 App Store Connect 的「App 審查資訊」區段中提供使用者名稱與密碼。也可以加入展示模式，呈現 App 的完整功能與特性。請注意，僅提供展示 App 使用情況的示範影片，並不足以讓我們繼續審查。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;資源&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;若要進一步瞭解如何在 App Store Connect 中提供資訊，請參閱 &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://developer.apple.com/help/app-store-connect/reference/app-review-information/&quot;&gt;App Store Connect 說明&lt;/a&gt;。&lt;/p&gt;
&lt;h3 id=&quot;準則-21---需要更多資訊-1&quot;&gt;準則 2.1 - 需要更多資訊&lt;/h3&gt;
&lt;p&gt;此 App 使用了 AppTrackingTransparency 框架，但我們在 iPadOS 18.5 上審查時，找不到 App 追蹤透明度權限請求。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;後續步驟&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;請說明我們可以在 App 的哪個位置找到 App 追蹤透明度權限請求。此請求應在任何可能用於追蹤使用者的資料被收集之前顯示。&lt;/p&gt;
&lt;p&gt;若已實作 App 追蹤透明度，但權限請求未在執行最新作業系統的裝置上顯示，請參閱&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://developer.apple.com/documentation/apptrackingtransparency/attrackingmanager/3547037-requesttrackingauthorization&quot;&gt;可用文件&lt;/a&gt;，並確認 App 追蹤透明度已正確實作。&lt;/p&gt;
&lt;p&gt;若你的 App 不會追蹤使用者，請更新 &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://help.apple.com/app-store-connect/#/dev1b4647c5b&quot;&gt;App Store Connect 中的 App 隱私權資訊&lt;/a&gt;，不要宣告追蹤。你必須具備&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://developer.apple.com/support/roles/&quot;&gt;帳號持有人或管理員角色&lt;/a&gt;才能更新 App 隱私權資訊。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;資源&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;追蹤是指為了廣告目的，將從 App 收集的資料與第三方資料連結，或將收集到的資料分享給資料仲介商。進一步瞭解&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://developer.apple.com/app-store/app-privacy-details/#user-tracking&quot;&gt;追蹤&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;請參閱關於&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://developer.apple.com/app-store/user-privacy-and-data-use/#permission-to-track&quot;&gt;會追蹤使用者的 App 之要求&lt;/a&gt;的常見問題。&lt;/li&gt;
&lt;li&gt;請參閱 &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://developer.apple.com/documentation/apptrackingtransparency&quot;&gt;App 追蹤透明度&lt;/a&gt;的開發者文件。&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;支援&quot;&gt;支援&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;若你需要協助，請以你偏好的語言回覆此訊息。若需要更多支援，請使用&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://developer.apple.com/contact/topic/#!/topic/select&quot;&gt;聯絡我們模組&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;請在 &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://developer.apple.com/forums/&quot;&gt;Apple 開發者論壇&lt;/a&gt;上與其他開發者和 Apple 工程師交流。&lt;/li&gt;
&lt;li&gt;請&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://essentials.applesurveys.com/jfe/form/SV_esVePfih7uqt4NM?campaignid=0001&quot;&gt;填寫簡短問卷&lt;/a&gt;，提供對此訊息與審查體驗的意見回饋。&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;這個問題背後的真正原因&quot;&gt;這個問題背後的真正原因&lt;/h2&gt;
&lt;h3 id=&quot;他們是用舊版本自動檢查&quot;&gt;他們是用舊版本自動檢查&lt;/h3&gt;
&lt;p&gt;有人懷疑，這是因為 Apple 會自動拒絕所有曾經有資料收集聲明、但新版本在 App 內缺少追蹤通知的 App。他們是以目前商店上架的版本作為基準。&lt;/p&gt;
&lt;p&gt;因此，問題不在於你的新版 App 含有追蹤器，而是他們是根據你 App 的上一個版本來判斷。&lt;/p&gt;
&lt;h3 id=&quot;你的專案裡真的還有-nsusertrackingusagedescription-二進位檔&quot;&gt;你的專案裡真的還有 NSUserTrackingUsageDescription 二進位檔&lt;/h3&gt;
&lt;p&gt;我也遇過同樣的情況，你必須移除 SDK 以及 info.plist 中的相關設定。不過，我忽略了用來顯示追蹤警告本地化字串的 localizedStrings。我有一個名為 infoPlist.localizedstrings（大概是這個名字）的檔案，裡面包含 App 啟動時彈出「允許 Google 提供個人化廣告？」提示的多語言本地化內容。&lt;/p&gt;
&lt;p&gt;你只要查看左側，就能確認它是否還在。或者，前往你的專案 &gt; Build Phases &gt; 展開 Copy Bundle Resources，檢查 Infoplist.localsedString 是否在其中。&lt;/p&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/9135a8ec-d7f8-44e3-95ac-f4a17c091a52&quot; alt=&quot;&quot;&gt;
檢查之後，我發現「NSUserTrackingUsageDescription」就在這個檔案裡。而且，即使我在側邊欄用「NSUserTrackingUsageDescription」這個搜尋詞做全域搜尋，它也不會顯示出來。&lt;/p&gt;
&lt;p&gt;你只需要仔細檢查是否還有任何殘留。&lt;/p&gt;
&lt;h2 id=&quot;嘗試解決&quot;&gt;嘗試解決&lt;/h2&gt;
&lt;p&gt;我依照指示前往 App Store Connect 頁面上我 App 的 App 隱私權頁面，然後試著把資料收集聲明改成「否」。就在那時，我遇到了這個障礙：&lt;/p&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/40399f7c-222b-45be-9179-7f2ef393ee46&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;你的 App 含有 NSUserTrackingUsageDescription，表示你將請求取得追蹤使用者的權限。你必須指出哪些資料類型會追蹤使用者。若這不正確，請更新你的 App 二進位檔，並將新的組建版本上傳至 App Store Connect。&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;嗯，這很奇怪。&lt;/p&gt;
&lt;p&gt;我已經移除了所有 Google SDK，也確認移除了 info.plist 中所有 App 追蹤器。此外，我還清理了建置快取，以全新的狀態重新建置新版本。&lt;/p&gt;
&lt;p&gt;結果發現，很多開發者都遇到同樣的問題。（&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://developer.apple.com/forums/thread/679585&quot;&gt;Apple 開發者論壇連結&lt;/a&gt;）&lt;/p&gt;
&lt;p&gt;幸運的是，這不是我第一次收到這種拒絕。我之前在為現有 App 移除 Google AdMob SDK 後，也曾遇過另一個 App 出現相同情況。而我透過以下做法成功解決了。&lt;/p&gt;
&lt;h2 id=&quot;解決方案&quot;&gt;解決方案&lt;/h2&gt;
&lt;p&gt;這是我兩次通過審查的方法。&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;確認你確實移除了所有會追蹤使用者的內容。&lt;/li&gt;
&lt;li&gt;建置並上傳新版本。&lt;/li&gt;
&lt;li&gt;如果你開啟了自動發布，請將設定改為開發者發布。&lt;/li&gt;
&lt;li&gt;提交新版本。&lt;/li&gt;
&lt;li&gt;當他們拒絕你時，直接回覆訊息說明：
&lt;ul&gt;
&lt;li&gt;你已經移除了所有追蹤器。&lt;/li&gt;
&lt;li&gt;附上 Apple 開發者論壇中其他人也遇到相同問題的討論連結。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;耐心等待一兩天。&lt;/li&gt;
&lt;li&gt;一旦通過 App 審查，你就可以把資料收集聲明改成「否」。&lt;/li&gt;
&lt;li&gt;按下「發布」！&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;如你所見，有趣的是，你可以在審查通過後變更資料收集設定，但在審查通過前卻不行。&lt;/p&gt;
&lt;h2 id=&quot;下次的最佳解決方案&quot;&gt;&lt;strong&gt;下次的最佳解決方案&lt;/strong&gt;？&lt;/h2&gt;
&lt;p&gt;一開始就不要追蹤你的使用者。&lt;/p&gt;
&lt;p&gt;記取教訓。&lt;/p&gt;
&lt;p&gt;祝你好運！&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;參考資料&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://developer.apple.com/forums/thread/679585&quot;&gt;https://developer.apple.com/forums/thread/679585&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://developer.apple.com/forums/thread/679585&quot;&gt;https://developer.apple.com/forums/thread/679585&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://community.thunkable.com/t/solved-can-not-publish-to-ios-problem-with-nsusertrackingusagedescription-which-is-not-used/1553223?page=4&quot;&gt;https://community.thunkable.com/t/solved-can-not-publish-to-ios-problem-with-nsusertrackingusagedescription-which-is-not-used/1553223?page=4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Reddit&lt;/li&gt;
&lt;/ol&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/10f1c00b-5027-4533-82e4-8de39487a05d"/><enclosure url="https://cms.hongct.com/assets/10f1c00b-5027-4533-82e4-8de39487a05d" length="82548" type="image/webp"/></item><item><title>如何修復瀏覽器中回傳的亂碼 JSON</title><link>https://hongcheung.com/tw/post/how-to-fix-gibberish-json-return-in-the-browser/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/how-to-fix-gibberish-json-return-in-the-browser/</guid><description>修復無意義 JSON 回傳的方法。</description><pubDate>Mon, 26 May 2025 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/b9c41563-4083-4d57-9841-dbfdfaeab1e8&quot; alt=&quot;如何修復瀏覽器中回傳的亂碼 JSON&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;p&gt;我花了一整天想弄清楚我的 Flask API 伺服器在瀏覽器中回傳亂碼的原因。有趣的是，我其他的端點都運作正常，唯獨我剛新增的這條路由有問題。以下是我從中學到、用來修復這個問題的方法。&lt;/p&gt;
&lt;h2 id=&quot;找出問題的原因&quot;&gt;&lt;strong&gt;找出問題的原因&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;我了解到造成這個問題主要有三個原因。&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Content-Type - charset 沒有設為 UTF-8，或者甚至沒有被辨識為 JSON&lt;/li&gt;
&lt;li&gt;Content-Encoding - 瀏覽器對 JSON 的預設自動壓縮與 API 的編碼方式發生衝突。&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;兩種檢查方式&quot;&gt;兩種檢查方式&lt;/h3&gt;
&lt;h4 id=&quot;curl&quot;&gt;cURL&lt;/h4&gt;
&lt;p&gt;開啟你的終端機並使用 cURL&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;style&gt;.expressive-code{font-family:var(--ec-uiFontFml);font-size:var(--ec-uiFontSize);font-weight:var(--ec-uiFontWg);line-height:var(--ec-uiLineHt);text-size-adjust:none;-webkit-text-size-adjust:none}.expressive-code *:not(:is(svg, svg *)){all:revert;box-sizing:border-box}.expressive-code pre{display:flex;margin:0;padding:0;border:var(--ec-brdWd) solid var(--ec-brdCol);border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));background:var(--ec-codeBg)}.expressive-code pre:focus-visible{outline:3px solid var(--ec-focusBrd);outline-offset:-3px}.expressive-code pre &gt; code{all:unset;display:block;flex:1 0 100%;padding:var(--ec-codePadBlk) 0;color:var(--ec-codeFg);font-family:var(--ec-codeFontFml);font-size:var(--ec-codeFontSize);font-weight:var(--ec-codeFontWg);line-height:var(--ec-codeLineHt)}.expressive-code pre{overflow-x:auto}.expressive-code pre.wrap .ec-line .code{white-space:pre-wrap;overflow-wrap:break-word;min-width:min(20ch, var(--ecMaxLine, 20ch))}.expressive-code pre.wrap .ec-line .code span.indent{white-space:pre}.expressive-code pre::-webkit-scrollbar,.expressive-code pre::-webkit-scrollbar-track{background-color:inherit;border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));border-top-left-radius:0;border-top-right-radius:0}.expressive-code pre::-webkit-scrollbar-thumb{background-color:var(--ec-sbThumbCol);border:4px solid transparent;background-clip:content-box;border-radius:10px}.expressive-code pre::-webkit-scrollbar-thumb:hover{background-color:var(--ec-sbThumbHoverCol)}.expressive-code pre::-webkit-scrollbar-corner{background:transparent}.expressive-code .ec-line{direction:ltr;unicode-bidi:isolate;display:grid;grid-template-areas:&apos;gutter code&apos;;grid-template-columns:auto 1fr;position:relative}.expressive-code .ec-line .gutter{grid-area:gutter;color:var(--ec-gtrFg)}.expressive-code .ec-line .gutter &gt; *{pointer-events:none;user-select:none;-webkit-user-select:none}.expressive-code .ec-line .gutter ~ .code{--ecLineBrdCol:var(--ec-gtrBrdCol)}.expressive-code .ec-line.highlight .gutter{color:var(--ec-gtrHlFg)}.expressive-code .ec-line .code{grid-area:code;position:relative;box-sizing:content-box;padding-inline-start:calc(var(--ecIndent, 0ch) + var(--ec-codePadInl) - var(--ecGtrBrdWd));padding-inline-end:var(--ec-codePadInl);text-indent:calc(var(--ecIndent, 0ch) * -1)}.expressive-code .ec-line .code::before,.expressive-code .ec-line .code::after,.expressive-code .ec-line .code :where(*){text-indent:0}.expressive-code .ec-line .code{--ecGtrBrdWd:var(--ec-gtrBrdWd);border-inline-start:var(--ecGtrBrdWd) solid var(--ecLineBrdCol, transparent)}.expressive-code .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.expressive-code .ec-line.mark{--tmLineBgCol:var(--ec-tm-markBg)}.expressive-code .ec-line.mark .code{--ecLineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line.ins{--tmLineBgCol:var(--ec-tm-insBg);--tmLabel:var(--ec-tm-insDiffIndContent)}.expressive-code .ec-line.ins .code{--ecLineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line.ins .code::before{color:var(--ec-tm-insDiffIndCol)}.expressive-code .ec-line.del{--tmLineBgCol:var(--ec-tm-delBg);--tmLabel:var(--ec-tm-delDiffIndContent)}.expressive-code .ec-line.del .code{--ecLineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line.del .code::before{color:var(--ec-tm-delDiffIndCol)}.expressive-code .ec-line.mark,.expressive-code .ec-line.ins,.expressive-code .ec-line.del{background:var(--tmLineBgCol)}.expressive-code .ec-line.mark .code,.expressive-code .ec-line.ins .code,.expressive-code .ec-line.del .code{--ecGtrBrdWd:var(--ec-tm-lineMarkerAccentWd)}.expressive-code .ec-line.mark .code::before,.expressive-code .ec-line.ins .code::before,.expressive-code .ec-line.del .code::before{display:block;position:absolute;left:0;box-sizing:border-box;content:var(--tmLabel, &apos; &apos;);padding-inline-start:var(--ec-tm-lineDiffIndMargLeft);text-align:center;white-space:pre}.expressive-code .ec-line.mark.tm-label .code::before,.expressive-code .ec-line.ins.tm-label .code::before,.expressive-code .ec-line.del.tm-label .code::before{background:var(--ecLineBrdCol);padding:0 calc(var(--ec-tm-lineMarkerLabelPadInl) + var(--ec-tm-lineMarkerAccentWd)) 0 var(--ec-tm-lineMarkerLabelPadInl);color:var(--ec-tm-lineMarkerLabelCol)}.expressive-code .ec-line mark{--tmInlineBgCol:var(--ec-tm-markBg);--tmInlineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line ins{--tmInlineBgCol:var(--ec-tm-insBg);--tmInlineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line del{--tmInlineBgCol:var(--ec-tm-delBg);--tmInlineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line mark,.expressive-code .ec-line ins,.expressive-code .ec-line del{all:unset;display:inline-block;position:relative;--tmBrdL:var(--ec-tm-inlMarkerBrdWd);--tmBrdR:var(--ec-tm-inlMarkerBrdWd);--tmRadL:var(--ec-tm-inlMarkerBrdRad);--tmRadR:var(--ec-tm-inlMarkerBrdRad);margin-inline:0.025rem;padding-inline:var(--ec-tm-inlMarkerPad);border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);background:var(--tmInlineBgCol);background-clip:padding-box}.expressive-code .ec-line mark.open-start,.expressive-code .ec-line ins.open-start,.expressive-code .ec-line del.open-start{margin-inline-start:0;padding-inline-start:0;--tmBrdL:0px;--tmRadL:0}.expressive-code .ec-line mark.open-end,.expressive-code .ec-line ins.open-end,.expressive-code .ec-line del.open-end{margin-inline-end:0;padding-inline-end:0;--tmBrdR:0px;--tmRadR:0}.expressive-code .ec-line mark::before,.expressive-code .ec-line ins::before,.expressive-code .ec-line del::before{content:&apos;&apos;;position:absolute;pointer-events:none;display:inline-block;inset:0;border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);border:var(--ec-tm-inlMarkerBrdWd) solid var(--tmInlineBrdCol);border-inline-width:var(--tmBrdL) var(--tmBrdR)}.expressive-code .frame{all:unset;position:relative;display:block;--header-border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));--tab-border-radius:calc(var(--ec-frm-edTabBrdRad) + var(--ec-brdWd));--button-spacing:0.4rem;--code-background:var(--ec-frm-edBg);border-radius:var(--header-border-radius);box-shadow:var(--ec-frm-frameBoxShdCssVal)}.expressive-code .frame .header{display:none;z-index:1;position:relative;border-radius:var(--header-border-radius) var(--header-border-radius) 0 0}.expressive-code .frame.has-title pre,.expressive-code .frame.has-title code,.expressive-code .frame.is-terminal pre,.expressive-code .frame.is-terminal code{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.expressive-code .frame .title:empty:before{content:&apos;\a0&apos;}.expressive-code .frame.has-title:not(.is-terminal){--button-spacing:calc(1.9rem + 2 * (var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)))}.expressive-code .frame.has-title:not(.is-terminal) .title{position:relative;color:var(--ec-frm-edActTabFg);background:var(--ec-frm-edActTabBg);background-clip:padding-box;margin-block-start:var(--ec-frm-edTabsMargBlkStart);padding:calc(var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)) var(--ec-uiPadInl);border:var(--ec-brdWd) solid var(--ec-frm-edActTabBrdCol);border-radius:var(--tab-border-radius) var(--tab-border-radius) 0 0;border-bottom:none;overflow:hidden}.expressive-code .frame.has-title:not(.is-terminal) .title::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-top:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndTopCol);border-bottom:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndBtmCol)}.expressive-code .frame.has-title:not(.is-terminal) .header{display:flex;background:linear-gradient(to top, var(--ec-frm-edTabBarBrdBtmCol) var(--ec-brdWd), transparent var(--ec-brdWd)),linear-gradient(var(--ec-frm-edTabBarBg), var(--ec-frm-edTabBarBg));background-repeat:no-repeat;padding-inline-start:var(--ec-frm-edTabsMargInlStart)}.expressive-code .frame.has-title:not(.is-terminal) .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border:var(--ec-brdWd) solid var(--ec-frm-edTabBarBrdCol);border-radius:inherit;border-bottom:none}.expressive-code .frame.is-terminal{--button-spacing:calc(1.9rem + var(--ec-brdWd) + 2 * var(--ec-uiPadBlk));--code-background:var(--ec-frm-trmBg)}.expressive-code .frame.is-terminal .header{display:flex;align-items:center;justify-content:center;padding-block:var(--ec-uiPadBlk);padding-block-end:calc(var(--ec-uiPadBlk) + var(--ec-brdWd));position:relative;font-weight:500;letter-spacing:0.025ch;color:var(--ec-frm-trmTtbFg);background:var(--ec-frm-trmTtbBg);border:var(--ec-brdWd) solid var(--ec-brdCol);border-bottom:none}.expressive-code .frame.is-terminal .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;left:var(--ec-uiPadInl);width:2.1rem;height:0.56rem;line-height:0;background-color:var(--ec-frm-trmTtbDotsFg);opacity:var(--ec-frm-trmTtbDotsOpa);-webkit-mask-image:var(--ec-frm-trmIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-trmIcon);mask-repeat:no-repeat}.expressive-code .frame.is-terminal .header::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-bottom:var(--ec-brdWd) solid var(--ec-frm-trmTtbBrdBtmCol)}.expressive-code .frame pre{background:var(--code-background)}.expressive-code .copy{display:flex;gap:0.25rem;flex-direction:row;position:absolute;inset-block-start:calc(var(--ec-brdWd) + var(--button-spacing));inset-inline-end:calc(var(--ec-brdWd) + var(--ec-uiPadInl) / 2)}@media (scripting: none){.expressive-code .copy{display:none}}.expressive-code .copy{direction:ltr;unicode-bidi:isolate}.expressive-code .copy button{position:relative;align-self:flex-end;margin:0;padding:0;border:none;border-radius:0.2rem;z-index:1;cursor:pointer;transition-property:opacity, background, border-color;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.25, 0.46, 0.45, 0.94);width:2.5rem;height:2.5rem;background:var(--code-background);opacity:0.75}.expressive-code .copy button div{position:absolute;inset:0;border-radius:inherit;background:var(--ec-frm-inlBtnBg);opacity:var(--ec-frm-inlBtnBgIdleOpa);transition-property:inherit;transition-duration:inherit;transition-timing-function:inherit}.expressive-code .copy button::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-radius:inherit;border:var(--ec-brdWd) solid var(--ec-frm-inlBtnBrd);opacity:var(--ec-frm-inlBtnBrdOpa)}.expressive-code .copy button::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-frm-inlBtnFg);-webkit-mask-image:var(--ec-frm-copyIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-copyIcon);mask-repeat:no-repeat;margin:0.475rem;line-height:0}.expressive-code .copy button:hover,.expressive-code .copy button:focus:focus-visible{opacity:1}.expressive-code .copy button:hover div,.expressive-code .copy button:focus:focus-visible div{opacity:var(--ec-frm-inlBtnBgHoverOrFocusOpa)}.expressive-code .copy button:active{opacity:1}.expressive-code .copy button:active div{opacity:var(--ec-frm-inlBtnBgActOpa)}.expressive-code .copy .feedback{--tooltip-arrow-size:0.35rem;--tooltip-bg:var(--ec-frm-tooltipSuccessBg);color:var(--ec-frm-tooltipSuccessFg);pointer-events:none;user-select:none;-webkit-user-select:none;position:relative;align-self:center;background-color:var(--tooltip-bg);z-index:99;padding:0.125rem 0.75rem;border-radius:0.2rem;margin-inline-end:var(--tooltip-arrow-size);opacity:0;transition-property:opacity, transform;transition-duration:0.2s;transition-timing-function:ease-in-out;transform:translate3d(0, 0.25rem, 0)}.expressive-code .copy .feedback::after{content:&apos;&apos;;position:absolute;pointer-events:none;top:calc(50% - var(--tooltip-arrow-size));inset-inline-end:calc(-2 * (var(--tooltip-arrow-size) - 0.5px));border:var(--tooltip-arrow-size) solid transparent;border-inline-start-color:var(--tooltip-bg)}.expressive-code .copy .feedback.show{opacity:1;transform:translate3d(0, 0, 0)}@media (hover: hover){.expressive-code{}.expressive-code .copy button{opacity:0;width:2rem;height:2rem}.expressive-code .frame:hover .copy button:not(:hover),.expressive-code .frame:focus-within :focus-visible ~ .copy button:not(:hover),.expressive-code .frame .copy .feedback.show ~ button:not(:hover){opacity:0.75}}.expressive-code :nth-child(1 of .ec-line) .code{padding-inline-end:calc(2rem + var(--ec-codePadInl))}.expressive-code .gutter .ln{display:inline-flex;justify-content:flex-end;align-items:flex-start;box-sizing:content-box;min-width:var(--lnWidth, 2ch);padding-inline:2ch;color:var(--ec-lineNumbers-fg)}.highlight .expressive-code .gutter .ln{color:var(--ec-lineNumbers-hlFg)}.expressive-code .ec-section{position:relative}.expressive-code .ec-section summary{position:relative;font-family:var(--ec-cs-closedFontFml);font-size:var(--ec-cs-closedFontSize);line-height:var(--ec-cs-closedLineHt);user-select:none;-webkit-user-select:none;cursor:pointer;color:var(--ec-cs-closedTextCol);background-color:var(--ec-cs-closedBgCol);--border-color:var(--ec-cs-closedBrdCol);--border-width:var(--ec-cs-closedBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);margin:var(--ec-cs-closedMarg);padding:0}.expressive-code .ec-section summary::marker{display:inline-block;content:&quot;&quot;;width:16px;height:16px}.expressive-code .ec-section summary::-webkit-details-marker{display:none}.expressive-code .ec-section summary :is(.expand, .collapse){position:relative;display:inline-block;width:16px;height:16px;vertical-align:text-bottom;opacity:0.75}.expressive-code .ec-section summary :is(.expand, .collapse)::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-cs-closedTextCol);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;line-height:0}.expressive-code .ec-section summary .expand::after{-webkit-mask-image:var(--ec-cs-expandIcon);mask-image:var(--ec-cs-expandIcon);-webkit-print-color-adjust:exact;print-color-adjust:exact}.expressive-code .ec-section summary .collapse{display:none}.expressive-code .ec-section summary .collapse::after{-webkit-mask-image:var(--ec-cs-collapseIcon);mask-image:var(--ec-cs-collapseIcon)}.expressive-code .ec-section summary .text{margin-left:1em}.expressive-code .ec-section summary .ec-line .code{padding-block:var(--ec-cs-closedPadBlk);text-indent:0}.expressive-code .ec-section[open],.expressive-code .ec-section details[open] + .content-lines{--border-color:var(--ec-cs-openBrdCol);--border-width:var(--ec-cs-openBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);padding-inline:var(--ec-cs-openPad);margin-inline:var(--ec-cs-openMarg)}.expressive-code .ec-section.github[open] summary{display:none}.expressive-code .ec-section.github[open]{background-color:var(--ec-cs-openBgCol)}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end){display:flex;flex-direction:column}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) .content-lines{display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] .collapse{display:inline-block}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] :is(.expand, .text){display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] + .content-lines{display:block;background-color:var(--ec-cs-openBgColCollapsible)}@media print{.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open]{display:none}}.expressive-code .ec-section.collapsible-end{flex-direction:column-reverse}:root,:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;]{--ec-brdRad:0.3rem;--ec-brdWd:1.5px;--ec-brdCol:#1b1f23;--ec-codeFontFml:jetbrains-mono;--ec-codeFontSize:0.85rem;--ec-codeFontWg:400;--ec-codeLineHt:1.65;--ec-codePadBlk:1rem;--ec-codePadInl:1.35rem;--ec-codeBg:#24292e;--ec-codeFg:#e1e4e8;--ec-codeSelBg:#3392ff44;--ec-gtrFg:#727980;--ec-gtrBrdCol:#72798033;--ec-gtrBrdWd:1.5px;--ec-gtrHlFg:#e1e4e896;--ec-uiFontFml:jetbrains-mono;--ec-uiFontSize:0.9rem;--ec-uiFontWg:400;--ec-uiLineHt:1.65;--ec-uiPadBlk:0.25rem;--ec-uiPadInl:1rem;--ec-uiSelBg:#39414a;--ec-uiSelFg:#e1e4e8;--ec-focusBrd:#005cc5;--ec-sbThumbCol:#6a737d33;--ec-sbThumbHoverCol:#6a737dd1;--ec-tm-lineMarkerAccentMarg:0rem;--ec-tm-lineMarkerAccentWd:0.15rem;--ec-tm-lineMarkerLabelPadInl:0.2rem;--ec-tm-lineMarkerLabelCol:white;--ec-tm-lineDiffIndMargLeft:0.3rem;--ec-tm-inlMarkerBrdWd:1.5px;--ec-tm-inlMarkerBrdRad:0.2rem;--ec-tm-inlMarkerPad:0.15rem;--ec-tm-insDiffIndContent:&apos;+&apos;;--ec-tm-delDiffIndContent:&apos;-&apos;;--ec-tm-markBg:#264a8980;--ec-tm-markBrdCol:#5570b3d0;--ec-tm-insBg:#26561c80;--ec-tm-insBrdCol:#4e7e41d0;--ec-tm-insDiffIndCol:#7eb070d0;--ec-tm-delBg:#81322b80;--ec-tm-delBrdCol:#ae594fd0;--ec-tm-delDiffIndCol:#e68a7ed0;--ec-frm-shdCol:#0000005b;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #0000005b;--ec-frm-edActTabBg:#24292e;--ec-frm-edActTabFg:#e1e4e8;--ec-frm-edActTabBrdCol:transparent;--ec-frm-edActTabIndHt:1.5px;--ec-frm-edActTabIndTopCol:#f9826c;--ec-frm-edActTabIndBtmCol:#24292e;--ec-frm-edTabsMargInlStart:0;--ec-frm-edTabsMargBlkStart:0;--ec-frm-edTabBrdRad:0.3rem;--ec-frm-edTabBarBg:#1f2428;--ec-frm-edTabBarBrdCol:#1b1f23;--ec-frm-edTabBarBrdBtmCol:#1b1f23;--ec-frm-edBg:#24292e;--ec-frm-trmTtbFg:#e1e4e8;--ec-frm-trmTtbDotsFg:#e1e4e8;--ec-frm-trmTtbDotsOpa:0.15;--ec-frm-trmTtbBg:#24292e;--ec-frm-trmTtbBrdBtmCol:#1b1f23;--ec-frm-trmBg:#1f2428;--ec-frm-inlBtnFg:#e1e4e8;--ec-frm-inlBtnBg:#e1e4e8;--ec-frm-inlBtnBgIdleOpa:0;--ec-frm-inlBtnBgHoverOrFocusOpa:0.2;--ec-frm-inlBtnBgActOpa:0.3;--ec-frm-inlBtnBrd:#e1e4e8;--ec-frm-inlBtnBrdOpa:0.4;--ec-frm-tooltipSuccessBg:#228739;--ec-frm-tooltipSuccessFg:white;--ec-frm-copyIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2024%2024&apos;%20fill%3D&apos;none&apos;%20stroke%3D&apos;black&apos;%20stroke-width%3D&apos;1.75&apos;%3E%3Cpath%20d%3D&apos;M3%2019a2%202%200%200%201-1-2V2a2%202%200%200%201%201-1h13a2%202%200%200%201%202%201&apos;%2F%3E%3Crect%20x%3D&apos;6&apos;%20y%3D&apos;5&apos;%20width%3D&apos;16&apos;%20height%3D&apos;18&apos;%20rx%3D&apos;1.5&apos;%20ry%3D&apos;1.5&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-frm-trmIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2060%2016&apos;%20preserveAspectRatio%3D&apos;xMidYMid%20meet&apos;%3E%3Ccircle%20cx%3D&apos;8&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;30&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;52&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-lineNumbers-fg:inherit;--ec-lineNumbers-hlFg:inherit;--ec-cs-closedBrdWd:0px;--ec-cs-closedPadBlk:4px;--ec-cs-closedMarg:0;--ec-cs-closedFontFml:inherit;--ec-cs-closedFontSize:inherit;--ec-cs-closedLineHt:inherit;--ec-cs-closedTextCol:#e1e4e8;--ec-cs-closedBgCol:#58606933;--ec-cs-closedBrdCol:#58606980;--ec-cs-openBrdWd:1px;--ec-cs-openPad:0;--ec-cs-openMarg:0;--ec-cs-openBgCol:transparent;--ec-cs-openBgColCollapsible:#5860691a;--ec-cs-openBrdCol:transparent;--ec-cs-expandIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;m8.177.677%202.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25a.75.75%200%200%201-1.5%200V4H5.104a.25.25%200%200%201-.177-.427L7.823.677a.25.25%200%200%201%20.354%200ZM7.25%2010.75a.75.75%200%200%201%201.5%200V12h2.146a.25.25%200%200%201%20.177.427l-2.896%202.896a.25.25%200%200%201-.354%200l-2.896-2.896A.25.25%200%200%201%205.104%2012H7.25v-1.25Zm-5-2a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-cs-collapseIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;M10.896%202H8.75V.75a.75.75%200%200%200-1.5%200V2H5.104a.25.25%200%200%200-.177.427l2.896%202.896a.25.25%200%200%200%20.354%200l2.896-2.896A.25.25%200%200%200%2010.896%202ZM8.75%2015.25a.75.75%200%200%201-1.5%200V14H5.104a.25.25%200%200%201-.177-.427l2.896-2.896a.25.25%200%200%201%20.354%200l2.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25Zm-6.5-6.5a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;)}.expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])),:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--0, inherit);background-color:var(--0bg, transparent);font-style:var(--0fs, inherit);font-weight:var(--0fw, inherit);text-decoration:var(--0td, inherit)}@media (prefers-color-scheme: light){:root:not([data-theme=&quot;dark&quot;]){--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root:not([data-theme=&quot;dark&quot;]) .expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]),.expressive-code[data-theme=&quot;light&quot;]{--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]) .ec-line :where(span[style^=&apos;--&apos;]:not([class])),.expressive-code[data-theme=&quot;light&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}&lt;/style&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function a(e){if(!e)return;let t=e.getAttribute(&quot;tabindex&quot;)!==null,r=e.scrollWidth&gt;e.clientWidth;r&amp;&amp;!t?(e.setAttribute(&quot;tabindex&quot;,&quot;0&quot;),e.setAttribute(&quot;role&quot;,&quot;region&quot;)):!r&amp;&amp;t&amp;&amp;(e.removeAttribute(&quot;tabindex&quot;),e.removeAttribute(&quot;role&quot;))}var u=window.requestIdleCallback||(e=&gt;setTimeout(e,1)),s=window.cancelIdleCallback||clearTimeout;function l(e){let t=new Set,r,n;return new ResizeObserver(c=&gt;{c.forEach(o=&gt;t.add(o.target)),r&amp;&amp;clearTimeout(r),n&amp;&amp;s(n),r=setTimeout(()=&gt;{n&amp;&amp;s(n),n=u(()=&gt;{t.forEach(o=&gt;e(o)),t.clear()})},250)})}function i(e,t){e.querySelectorAll?.(&quot;.expressive-code pre &gt; code&quot;).forEach(r=&gt;{let n=r.parentElement;n&amp;&amp;t.observe(n)})}var d=l(a);i(document,d);var b=new MutationObserver(e=&gt;e.forEach(t=&gt;t.addedNodes.forEach(r=&gt;{i(r,d)})));b.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document,d)});})();}catch(e){console.error(&quot;[EC] tabindex-js-module failed:&quot;,e)}&lt;/script&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function l(o){let e=document.createElement(&quot;pre&quot;);Object.assign(e.style,{opacity:&quot;0&quot;,pointerEvents:&quot;none&quot;,position:&quot;absolute&quot;,overflow:&quot;hidden&quot;,left:&quot;0&quot;,top:&quot;0&quot;,width:&quot;20px&quot;,height:&quot;20px&quot;,webkitUserSelect:&quot;auto&quot;,userSelect:&quot;all&quot;}),e.ariaHidden=&quot;true&quot;,e.textContent=o,document.body.appendChild(e);let a=document.createRange();a.selectNode(e);let n=getSelection();if(!n)return!1;n.removeAllRanges(),n.addRange(a);let r=!1;try{r=document.execCommand(&quot;copy&quot;)}finally{n.removeAllRanges(),document.body.removeChild(e)}return r}async function u(o){let e=o.currentTarget,a=e.dataset,n=!1,r=a.code.replace(/\u007f/g,`
`);try{await navigator.clipboard.writeText(r),n=!0}catch{n=l(r)}if(!n||e.parentNode?.querySelector(&quot;.feedback&quot;))return;let c=e.parentNode?.querySelector(&quot;[aria-live]&quot;),t=document.createElement(&quot;div&quot;);t.classList.add(&quot;feedback&quot;),t.append(a.copied),c.append(t),t.offsetWidth,requestAnimationFrame(()=&gt;t?.classList.add(&quot;show&quot;));let s=()=&gt;!t||t.classList.remove(&quot;show&quot;),d=()=&gt;{!t||parseFloat(getComputedStyle(t).opacity)&gt;0||(t.remove(),t=void 0)};setTimeout(s,1500),setTimeout(d,2500),e.addEventListener(&quot;blur&quot;,s),t.addEventListener(&quot;transitioncancel&quot;,d),t.addEventListener(&quot;transitionend&quot;,d)}function i(o){o.querySelectorAll?.(&quot;.expressive-code .copy button&quot;).forEach(e=&gt;e.addEventListener(&quot;click&quot;,u))}i(document);var m=new MutationObserver(o=&gt;o.forEach(e=&gt;e.addedNodes.forEach(a=&gt;{i(a)})));m.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document)});})();}catch(e){console.error(&quot;[EC] copy-js-module failed:&quot;,e)}&lt;/script&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;curl -v &quot;https://yourdomain.com/endpoint?&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;curl -v &amp;#x22;https://yourdomain.com/endpoint?&amp;#x22;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;如果 JSON 能正確顯示，代表問題最可能出在瀏覽器。&lt;/p&gt;
&lt;p&gt;如果顯示的是亂碼，請確認你在 Flask 應用程式中有將 charset 設為 UTF-8。因為這代表問題不在於傳輸，而是根本沒有在 Flask 內正確處理，可能是物件型別或編碼的問題。&lt;/p&gt;
&lt;h4 id=&quot;瀏覽器中的開發者工具&quot;&gt;瀏覽器中的開發者工具&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;前往 Network 分頁並重新整理你的端點頁面&lt;/li&gt;
&lt;li&gt;檢查 Content-Type 是否為 ‘application/json; charset=UTF-8’&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;解決方案&quot;&gt;解決方案&lt;/h2&gt;
&lt;h3 id=&quot;content-type&quot;&gt;Content-Type&lt;/h3&gt;
&lt;p&gt;如果缺少 application/json 或 charset=UTF-8，請為你的端點在 Flask API 應用程式中加入以下 response.header：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;response.headers[&apos;Content-Type&apos;] = &apos;application/json; charset=UTF-8&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;response.headers[&amp;#x27;Content-Type&amp;#x27;] = &amp;#x27;application/json; charset=UTF-8&amp;#x27;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;現在，重新啟動應用程式並再試一次，看看是否有效。如果沒效，請繼續進行下一步。&lt;/p&gt;
&lt;h3 id=&quot;content-encoding&quot;&gt;Content-Encoding&lt;/h3&gt;
&lt;p&gt;現在，你已確認 Content-Type 不是問題所在，因為它正確顯示為 application/json; charset=UTF-8。讓我們繼續探討第二個原因——編碼錯誤。&lt;/p&gt;
&lt;p&gt;預設情況下，當 Flask API 將回應傳送給瀏覽器時，會自動壓縮內容。接著，瀏覽器會嘗試解碼。然而，基於某些原因，它無法正確解碼。&lt;/p&gt;
&lt;p&gt;最完美的例子就是 cURL -v 能取得正確的回應，但在瀏覽器中卻是亂碼。（這就是我的情況。）cURL 預設不會接收壓縮/編碼過的回應，這就是為什麼它在 cURL 中正常，但在瀏覽器中卻不行。&lt;/p&gt;
&lt;p&gt;要修復這個問題，你必須在 Flask API 應用程式的回應中加入以下內容：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;response.headers[&apos;Content-Encoding&apos;] = &apos;identity&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;response.headers[&amp;#x27;Content-Encoding&amp;#x27;] = &amp;#x27;identity&amp;#x27;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;這會預設停用壓縮，讓你的瀏覽器能取得與 cURL 相同的內容。&lt;/p&gt;
&lt;p&gt;這樣應該就能修復了。&lt;/p&gt;
&lt;p&gt;祝你好運。&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/b9c41563-4083-4d57-9841-dbfdfaeab1e8"/><enclosure url="https://cms.hongct.com/assets/b9c41563-4083-4d57-9841-dbfdfaeab1e8" length="75134" type="image/webp"/></item><item><title>如何在 GitHub 上架設網站？（新手指南）</title><link>https://hongcheung.com/tw/post/how-to-host-a-website-on-github-beginners-guide/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/how-to-host-a-website-on-github-beginners-guide/</guid><description>使用 GitHub Pages 免費架設網站的新手入門指南。</description><pubDate>Sat, 15 Mar 2025 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/0090d3fd-8466-49d4-89f2-47b351bb3531&quot; alt=&quot;如何在 GitHub 上架設網站？（新手指南）&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;為什麼你會想用-github-架設網站&quot;&gt;為什麼你會想用 GitHub 架設網站？&lt;/h2&gt;
&lt;p&gt;因為它既簡單又免費。在開始之前，讓我們先看看一些優缺點，並確認它是否符合你的需求。&lt;/p&gt;
&lt;h3 id=&quot;優點&quot;&gt;優點&lt;/h3&gt;
&lt;p&gt;它會&lt;strong&gt;幫你處理好網域名稱&lt;/strong&gt;，而且你&lt;strong&gt;不必擔心儲存空間被收費&lt;/strong&gt;或&lt;strong&gt;流量過高&lt;/strong&gt;。你只需要一個免費的 GitHub 帳號。&lt;/p&gt;
&lt;h3 id=&quot;缺點&quot;&gt;缺點&lt;/h3&gt;
&lt;p&gt;你無法在 GitHub Pages 上架設動態網站，只能架設&lt;strong&gt;靜態網站&lt;/strong&gt;。這表示&lt;strong&gt;你無法架設伺服器&lt;/strong&gt;來接收傳入的流量，例如使用 express.js 或 flask，你只能架設&lt;strong&gt;靜態&lt;/strong&gt;網站。不過，它可以是&lt;strong&gt;動態的靜態網站&lt;/strong&gt;——你仍然可以在上面執行腳本，只是這些腳本必須事先載入。&lt;/p&gt;
&lt;p&gt;另一個缺點是，如果你使用免費帳號執行 GitHub Page，&lt;strong&gt;你的 GitHub 儲存庫（也就是你的網站檔案與目錄）會是公開的&lt;/strong&gt;。這表示每個人都能看到並瀏覽你的檔案。所以你最好別在網站資料夾裡放入任何機密內容。&lt;/p&gt;
&lt;p&gt;話雖如此，它仍然很適合用來架設你不介意公開程式碼的簡單網站。例如你的個人履歷、簡單的公司網站，或簡單的部落格。或者你只是想測試自己的動態靜態網頁應用程式。&lt;/p&gt;
&lt;h2 id=&quot;先備條件&quot;&gt;先備條件&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;一台能上網的電腦。&lt;/li&gt;
&lt;li&gt;基本的電腦操作能力。&lt;/li&gt;
&lt;li&gt;一個免費的 GitHub 帳號。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;如何建立免費-github-page-的逐步指南&quot;&gt;如何建立免費 GitHub Page 的逐步指南&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;建立一個 &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://github.com/signup?source=login&quot;&gt;GitHub 帳號&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/777ac5fd-ae95-47fb-9ae1-55434745d338&quot; alt=&quot;建立新的 GitHub page&quot;&gt;
登入後，&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://github.com/new&quot;&gt;建立新的儲存庫&lt;/a&gt;。請務必選擇「Public」。&lt;/li&gt;
&lt;li&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/ac0489fe-2d99-4d66-85e4-47f8e47cd282&quot; alt=&quot;在 GitHub 上建立新檔案&quot;&gt;
建立好空的儲存庫後，點選「create new file」。&lt;/li&gt;
&lt;li&gt;複製並貼上下方的&lt;a href=&quot;#sample_code&quot;&gt;範例程式碼&lt;/a&gt;，並將檔案命名為 index.html 來建立這個檔案。&lt;/li&gt;
&lt;li&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/31f525f3-9927-4b42-8bb5-945e89c4555b&quot; alt=&quot;index.html 範例程式碼&quot;&gt;
畫面應該會像這樣。點選 commit changes。&lt;/li&gt;
&lt;li&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/2aafd9be-1a0d-4175-b4ad-53defdcf1465&quot; alt=&quot;為 GitHub page 選擇 main 分支&quot;&gt;
前往 Settings 分頁 &gt; 側邊欄的 Pages &gt; Branches - 選擇 main 並點選 save。&lt;/li&gt;
&lt;li&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/72fbb2af-cb7a-4b50-869b-fb8bc36173d2&quot; alt=&quot;&quot;&gt;
現在回到你的儲存庫，等待幾分鐘。&lt;/li&gt;
&lt;li&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/a7ff08d8-d455-4757-b6c5-15e22804cae4&quot; alt=&quot;GitHub page 已發布&quot;&gt;
重新整理頁面，你就會看到 GitHub page 已成功發布。&lt;/li&gt;
&lt;li&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/2ab504d0-7906-46cf-9c71-15e6b0b9978a&quot; alt=&quot;GitHub page 已上線&quot;&gt;
做得好！你的 GitHub Page 現在已經可以透過這個連結瀏覽了！&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;範例程式碼：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;style&gt;.expressive-code{font-family:var(--ec-uiFontFml);font-size:var(--ec-uiFontSize);font-weight:var(--ec-uiFontWg);line-height:var(--ec-uiLineHt);text-size-adjust:none;-webkit-text-size-adjust:none}.expressive-code *:not(:is(svg, svg *)){all:revert;box-sizing:border-box}.expressive-code pre{display:flex;margin:0;padding:0;border:var(--ec-brdWd) solid var(--ec-brdCol);border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));background:var(--ec-codeBg)}.expressive-code pre:focus-visible{outline:3px solid var(--ec-focusBrd);outline-offset:-3px}.expressive-code pre &gt; code{all:unset;display:block;flex:1 0 100%;padding:var(--ec-codePadBlk) 0;color:var(--ec-codeFg);font-family:var(--ec-codeFontFml);font-size:var(--ec-codeFontSize);font-weight:var(--ec-codeFontWg);line-height:var(--ec-codeLineHt)}.expressive-code pre{overflow-x:auto}.expressive-code pre.wrap .ec-line .code{white-space:pre-wrap;overflow-wrap:break-word;min-width:min(20ch, var(--ecMaxLine, 20ch))}.expressive-code pre.wrap .ec-line .code span.indent{white-space:pre}.expressive-code pre::-webkit-scrollbar,.expressive-code pre::-webkit-scrollbar-track{background-color:inherit;border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));border-top-left-radius:0;border-top-right-radius:0}.expressive-code pre::-webkit-scrollbar-thumb{background-color:var(--ec-sbThumbCol);border:4px solid transparent;background-clip:content-box;border-radius:10px}.expressive-code pre::-webkit-scrollbar-thumb:hover{background-color:var(--ec-sbThumbHoverCol)}.expressive-code pre::-webkit-scrollbar-corner{background:transparent}.expressive-code .ec-line{direction:ltr;unicode-bidi:isolate;display:grid;grid-template-areas:&apos;gutter code&apos;;grid-template-columns:auto 1fr;position:relative}.expressive-code .ec-line .gutter{grid-area:gutter;color:var(--ec-gtrFg)}.expressive-code .ec-line .gutter &gt; *{pointer-events:none;user-select:none;-webkit-user-select:none}.expressive-code .ec-line .gutter ~ .code{--ecLineBrdCol:var(--ec-gtrBrdCol)}.expressive-code .ec-line.highlight .gutter{color:var(--ec-gtrHlFg)}.expressive-code .ec-line .code{grid-area:code;position:relative;box-sizing:content-box;padding-inline-start:calc(var(--ecIndent, 0ch) + var(--ec-codePadInl) - var(--ecGtrBrdWd));padding-inline-end:var(--ec-codePadInl);text-indent:calc(var(--ecIndent, 0ch) * -1)}.expressive-code .ec-line .code::before,.expressive-code .ec-line .code::after,.expressive-code .ec-line .code :where(*){text-indent:0}.expressive-code .ec-line .code{--ecGtrBrdWd:var(--ec-gtrBrdWd);border-inline-start:var(--ecGtrBrdWd) solid var(--ecLineBrdCol, transparent)}.expressive-code .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.expressive-code .ec-line.mark{--tmLineBgCol:var(--ec-tm-markBg)}.expressive-code .ec-line.mark .code{--ecLineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line.ins{--tmLineBgCol:var(--ec-tm-insBg);--tmLabel:var(--ec-tm-insDiffIndContent)}.expressive-code .ec-line.ins .code{--ecLineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line.ins .code::before{color:var(--ec-tm-insDiffIndCol)}.expressive-code .ec-line.del{--tmLineBgCol:var(--ec-tm-delBg);--tmLabel:var(--ec-tm-delDiffIndContent)}.expressive-code .ec-line.del .code{--ecLineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line.del .code::before{color:var(--ec-tm-delDiffIndCol)}.expressive-code .ec-line.mark,.expressive-code .ec-line.ins,.expressive-code .ec-line.del{background:var(--tmLineBgCol)}.expressive-code .ec-line.mark .code,.expressive-code .ec-line.ins .code,.expressive-code .ec-line.del .code{--ecGtrBrdWd:var(--ec-tm-lineMarkerAccentWd)}.expressive-code .ec-line.mark .code::before,.expressive-code .ec-line.ins .code::before,.expressive-code .ec-line.del .code::before{display:block;position:absolute;left:0;box-sizing:border-box;content:var(--tmLabel, &apos; &apos;);padding-inline-start:var(--ec-tm-lineDiffIndMargLeft);text-align:center;white-space:pre}.expressive-code .ec-line.mark.tm-label .code::before,.expressive-code .ec-line.ins.tm-label .code::before,.expressive-code .ec-line.del.tm-label .code::before{background:var(--ecLineBrdCol);padding:0 calc(var(--ec-tm-lineMarkerLabelPadInl) + var(--ec-tm-lineMarkerAccentWd)) 0 var(--ec-tm-lineMarkerLabelPadInl);color:var(--ec-tm-lineMarkerLabelCol)}.expressive-code .ec-line mark{--tmInlineBgCol:var(--ec-tm-markBg);--tmInlineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line ins{--tmInlineBgCol:var(--ec-tm-insBg);--tmInlineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line del{--tmInlineBgCol:var(--ec-tm-delBg);--tmInlineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line mark,.expressive-code .ec-line ins,.expressive-code .ec-line del{all:unset;display:inline-block;position:relative;--tmBrdL:var(--ec-tm-inlMarkerBrdWd);--tmBrdR:var(--ec-tm-inlMarkerBrdWd);--tmRadL:var(--ec-tm-inlMarkerBrdRad);--tmRadR:var(--ec-tm-inlMarkerBrdRad);margin-inline:0.025rem;padding-inline:var(--ec-tm-inlMarkerPad);border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);background:var(--tmInlineBgCol);background-clip:padding-box}.expressive-code .ec-line mark.open-start,.expressive-code .ec-line ins.open-start,.expressive-code .ec-line del.open-start{margin-inline-start:0;padding-inline-start:0;--tmBrdL:0px;--tmRadL:0}.expressive-code .ec-line mark.open-end,.expressive-code .ec-line ins.open-end,.expressive-code .ec-line del.open-end{margin-inline-end:0;padding-inline-end:0;--tmBrdR:0px;--tmRadR:0}.expressive-code .ec-line mark::before,.expressive-code .ec-line ins::before,.expressive-code .ec-line del::before{content:&apos;&apos;;position:absolute;pointer-events:none;display:inline-block;inset:0;border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);border:var(--ec-tm-inlMarkerBrdWd) solid var(--tmInlineBrdCol);border-inline-width:var(--tmBrdL) var(--tmBrdR)}.expressive-code .frame{all:unset;position:relative;display:block;--header-border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));--tab-border-radius:calc(var(--ec-frm-edTabBrdRad) + var(--ec-brdWd));--button-spacing:0.4rem;--code-background:var(--ec-frm-edBg);border-radius:var(--header-border-radius);box-shadow:var(--ec-frm-frameBoxShdCssVal)}.expressive-code .frame .header{display:none;z-index:1;position:relative;border-radius:var(--header-border-radius) var(--header-border-radius) 0 0}.expressive-code .frame.has-title pre,.expressive-code .frame.has-title code,.expressive-code .frame.is-terminal pre,.expressive-code .frame.is-terminal code{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.expressive-code .frame .title:empty:before{content:&apos;\a0&apos;}.expressive-code .frame.has-title:not(.is-terminal){--button-spacing:calc(1.9rem + 2 * (var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)))}.expressive-code .frame.has-title:not(.is-terminal) .title{position:relative;color:var(--ec-frm-edActTabFg);background:var(--ec-frm-edActTabBg);background-clip:padding-box;margin-block-start:var(--ec-frm-edTabsMargBlkStart);padding:calc(var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)) var(--ec-uiPadInl);border:var(--ec-brdWd) solid var(--ec-frm-edActTabBrdCol);border-radius:var(--tab-border-radius) var(--tab-border-radius) 0 0;border-bottom:none;overflow:hidden}.expressive-code .frame.has-title:not(.is-terminal) .title::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-top:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndTopCol);border-bottom:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndBtmCol)}.expressive-code .frame.has-title:not(.is-terminal) .header{display:flex;background:linear-gradient(to top, var(--ec-frm-edTabBarBrdBtmCol) var(--ec-brdWd), transparent var(--ec-brdWd)),linear-gradient(var(--ec-frm-edTabBarBg), var(--ec-frm-edTabBarBg));background-repeat:no-repeat;padding-inline-start:var(--ec-frm-edTabsMargInlStart)}.expressive-code .frame.has-title:not(.is-terminal) .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border:var(--ec-brdWd) solid var(--ec-frm-edTabBarBrdCol);border-radius:inherit;border-bottom:none}.expressive-code .frame.is-terminal{--button-spacing:calc(1.9rem + var(--ec-brdWd) + 2 * var(--ec-uiPadBlk));--code-background:var(--ec-frm-trmBg)}.expressive-code .frame.is-terminal .header{display:flex;align-items:center;justify-content:center;padding-block:var(--ec-uiPadBlk);padding-block-end:calc(var(--ec-uiPadBlk) + var(--ec-brdWd));position:relative;font-weight:500;letter-spacing:0.025ch;color:var(--ec-frm-trmTtbFg);background:var(--ec-frm-trmTtbBg);border:var(--ec-brdWd) solid var(--ec-brdCol);border-bottom:none}.expressive-code .frame.is-terminal .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;left:var(--ec-uiPadInl);width:2.1rem;height:0.56rem;line-height:0;background-color:var(--ec-frm-trmTtbDotsFg);opacity:var(--ec-frm-trmTtbDotsOpa);-webkit-mask-image:var(--ec-frm-trmIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-trmIcon);mask-repeat:no-repeat}.expressive-code .frame.is-terminal .header::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-bottom:var(--ec-brdWd) solid var(--ec-frm-trmTtbBrdBtmCol)}.expressive-code .frame pre{background:var(--code-background)}.expressive-code .copy{display:flex;gap:0.25rem;flex-direction:row;position:absolute;inset-block-start:calc(var(--ec-brdWd) + var(--button-spacing));inset-inline-end:calc(var(--ec-brdWd) + var(--ec-uiPadInl) / 2)}@media (scripting: none){.expressive-code .copy{display:none}}.expressive-code .copy{direction:ltr;unicode-bidi:isolate}.expressive-code .copy button{position:relative;align-self:flex-end;margin:0;padding:0;border:none;border-radius:0.2rem;z-index:1;cursor:pointer;transition-property:opacity, background, border-color;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.25, 0.46, 0.45, 0.94);width:2.5rem;height:2.5rem;background:var(--code-background);opacity:0.75}.expressive-code .copy button div{position:absolute;inset:0;border-radius:inherit;background:var(--ec-frm-inlBtnBg);opacity:var(--ec-frm-inlBtnBgIdleOpa);transition-property:inherit;transition-duration:inherit;transition-timing-function:inherit}.expressive-code .copy button::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-radius:inherit;border:var(--ec-brdWd) solid var(--ec-frm-inlBtnBrd);opacity:var(--ec-frm-inlBtnBrdOpa)}.expressive-code .copy button::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-frm-inlBtnFg);-webkit-mask-image:var(--ec-frm-copyIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-copyIcon);mask-repeat:no-repeat;margin:0.475rem;line-height:0}.expressive-code .copy button:hover,.expressive-code .copy button:focus:focus-visible{opacity:1}.expressive-code .copy button:hover div,.expressive-code .copy button:focus:focus-visible div{opacity:var(--ec-frm-inlBtnBgHoverOrFocusOpa)}.expressive-code .copy button:active{opacity:1}.expressive-code .copy button:active div{opacity:var(--ec-frm-inlBtnBgActOpa)}.expressive-code .copy .feedback{--tooltip-arrow-size:0.35rem;--tooltip-bg:var(--ec-frm-tooltipSuccessBg);color:var(--ec-frm-tooltipSuccessFg);pointer-events:none;user-select:none;-webkit-user-select:none;position:relative;align-self:center;background-color:var(--tooltip-bg);z-index:99;padding:0.125rem 0.75rem;border-radius:0.2rem;margin-inline-end:var(--tooltip-arrow-size);opacity:0;transition-property:opacity, transform;transition-duration:0.2s;transition-timing-function:ease-in-out;transform:translate3d(0, 0.25rem, 0)}.expressive-code .copy .feedback::after{content:&apos;&apos;;position:absolute;pointer-events:none;top:calc(50% - var(--tooltip-arrow-size));inset-inline-end:calc(-2 * (var(--tooltip-arrow-size) - 0.5px));border:var(--tooltip-arrow-size) solid transparent;border-inline-start-color:var(--tooltip-bg)}.expressive-code .copy .feedback.show{opacity:1;transform:translate3d(0, 0, 0)}@media (hover: hover){.expressive-code{}.expressive-code .copy button{opacity:0;width:2rem;height:2rem}.expressive-code .frame:hover .copy button:not(:hover),.expressive-code .frame:focus-within :focus-visible ~ .copy button:not(:hover),.expressive-code .frame .copy .feedback.show ~ button:not(:hover){opacity:0.75}}.expressive-code :nth-child(1 of .ec-line) .code{padding-inline-end:calc(2rem + var(--ec-codePadInl))}.expressive-code .gutter .ln{display:inline-flex;justify-content:flex-end;align-items:flex-start;box-sizing:content-box;min-width:var(--lnWidth, 2ch);padding-inline:2ch;color:var(--ec-lineNumbers-fg)}.highlight .expressive-code .gutter .ln{color:var(--ec-lineNumbers-hlFg)}.expressive-code .ec-section{position:relative}.expressive-code .ec-section summary{position:relative;font-family:var(--ec-cs-closedFontFml);font-size:var(--ec-cs-closedFontSize);line-height:var(--ec-cs-closedLineHt);user-select:none;-webkit-user-select:none;cursor:pointer;color:var(--ec-cs-closedTextCol);background-color:var(--ec-cs-closedBgCol);--border-color:var(--ec-cs-closedBrdCol);--border-width:var(--ec-cs-closedBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);margin:var(--ec-cs-closedMarg);padding:0}.expressive-code .ec-section summary::marker{display:inline-block;content:&quot;&quot;;width:16px;height:16px}.expressive-code .ec-section summary::-webkit-details-marker{display:none}.expressive-code .ec-section summary :is(.expand, .collapse){position:relative;display:inline-block;width:16px;height:16px;vertical-align:text-bottom;opacity:0.75}.expressive-code .ec-section summary :is(.expand, .collapse)::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-cs-closedTextCol);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;line-height:0}.expressive-code .ec-section summary .expand::after{-webkit-mask-image:var(--ec-cs-expandIcon);mask-image:var(--ec-cs-expandIcon);-webkit-print-color-adjust:exact;print-color-adjust:exact}.expressive-code .ec-section summary .collapse{display:none}.expressive-code .ec-section summary .collapse::after{-webkit-mask-image:var(--ec-cs-collapseIcon);mask-image:var(--ec-cs-collapseIcon)}.expressive-code .ec-section summary .text{margin-left:1em}.expressive-code .ec-section summary .ec-line .code{padding-block:var(--ec-cs-closedPadBlk);text-indent:0}.expressive-code .ec-section[open],.expressive-code .ec-section details[open] + .content-lines{--border-color:var(--ec-cs-openBrdCol);--border-width:var(--ec-cs-openBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);padding-inline:var(--ec-cs-openPad);margin-inline:var(--ec-cs-openMarg)}.expressive-code .ec-section.github[open] summary{display:none}.expressive-code .ec-section.github[open]{background-color:var(--ec-cs-openBgCol)}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end){display:flex;flex-direction:column}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) .content-lines{display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] .collapse{display:inline-block}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] :is(.expand, .text){display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] + .content-lines{display:block;background-color:var(--ec-cs-openBgColCollapsible)}@media print{.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open]{display:none}}.expressive-code .ec-section.collapsible-end{flex-direction:column-reverse}:root,:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;]{--ec-brdRad:0.3rem;--ec-brdWd:1.5px;--ec-brdCol:#1b1f23;--ec-codeFontFml:jetbrains-mono;--ec-codeFontSize:0.85rem;--ec-codeFontWg:400;--ec-codeLineHt:1.65;--ec-codePadBlk:1rem;--ec-codePadInl:1.35rem;--ec-codeBg:#24292e;--ec-codeFg:#e1e4e8;--ec-codeSelBg:#3392ff44;--ec-gtrFg:#727980;--ec-gtrBrdCol:#72798033;--ec-gtrBrdWd:1.5px;--ec-gtrHlFg:#e1e4e896;--ec-uiFontFml:jetbrains-mono;--ec-uiFontSize:0.9rem;--ec-uiFontWg:400;--ec-uiLineHt:1.65;--ec-uiPadBlk:0.25rem;--ec-uiPadInl:1rem;--ec-uiSelBg:#39414a;--ec-uiSelFg:#e1e4e8;--ec-focusBrd:#005cc5;--ec-sbThumbCol:#6a737d33;--ec-sbThumbHoverCol:#6a737dd1;--ec-tm-lineMarkerAccentMarg:0rem;--ec-tm-lineMarkerAccentWd:0.15rem;--ec-tm-lineMarkerLabelPadInl:0.2rem;--ec-tm-lineMarkerLabelCol:white;--ec-tm-lineDiffIndMargLeft:0.3rem;--ec-tm-inlMarkerBrdWd:1.5px;--ec-tm-inlMarkerBrdRad:0.2rem;--ec-tm-inlMarkerPad:0.15rem;--ec-tm-insDiffIndContent:&apos;+&apos;;--ec-tm-delDiffIndContent:&apos;-&apos;;--ec-tm-markBg:#264a8980;--ec-tm-markBrdCol:#5570b3d0;--ec-tm-insBg:#26561c80;--ec-tm-insBrdCol:#4e7e41d0;--ec-tm-insDiffIndCol:#7eb070d0;--ec-tm-delBg:#81322b80;--ec-tm-delBrdCol:#ae594fd0;--ec-tm-delDiffIndCol:#e68a7ed0;--ec-frm-shdCol:#0000005b;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #0000005b;--ec-frm-edActTabBg:#24292e;--ec-frm-edActTabFg:#e1e4e8;--ec-frm-edActTabBrdCol:transparent;--ec-frm-edActTabIndHt:1.5px;--ec-frm-edActTabIndTopCol:#f9826c;--ec-frm-edActTabIndBtmCol:#24292e;--ec-frm-edTabsMargInlStart:0;--ec-frm-edTabsMargBlkStart:0;--ec-frm-edTabBrdRad:0.3rem;--ec-frm-edTabBarBg:#1f2428;--ec-frm-edTabBarBrdCol:#1b1f23;--ec-frm-edTabBarBrdBtmCol:#1b1f23;--ec-frm-edBg:#24292e;--ec-frm-trmTtbFg:#e1e4e8;--ec-frm-trmTtbDotsFg:#e1e4e8;--ec-frm-trmTtbDotsOpa:0.15;--ec-frm-trmTtbBg:#24292e;--ec-frm-trmTtbBrdBtmCol:#1b1f23;--ec-frm-trmBg:#1f2428;--ec-frm-inlBtnFg:#e1e4e8;--ec-frm-inlBtnBg:#e1e4e8;--ec-frm-inlBtnBgIdleOpa:0;--ec-frm-inlBtnBgHoverOrFocusOpa:0.2;--ec-frm-inlBtnBgActOpa:0.3;--ec-frm-inlBtnBrd:#e1e4e8;--ec-frm-inlBtnBrdOpa:0.4;--ec-frm-tooltipSuccessBg:#228739;--ec-frm-tooltipSuccessFg:white;--ec-frm-copyIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2024%2024&apos;%20fill%3D&apos;none&apos;%20stroke%3D&apos;black&apos;%20stroke-width%3D&apos;1.75&apos;%3E%3Cpath%20d%3D&apos;M3%2019a2%202%200%200%201-1-2V2a2%202%200%200%201%201-1h13a2%202%200%200%201%202%201&apos;%2F%3E%3Crect%20x%3D&apos;6&apos;%20y%3D&apos;5&apos;%20width%3D&apos;16&apos;%20height%3D&apos;18&apos;%20rx%3D&apos;1.5&apos;%20ry%3D&apos;1.5&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-frm-trmIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2060%2016&apos;%20preserveAspectRatio%3D&apos;xMidYMid%20meet&apos;%3E%3Ccircle%20cx%3D&apos;8&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;30&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;52&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-lineNumbers-fg:inherit;--ec-lineNumbers-hlFg:inherit;--ec-cs-closedBrdWd:0px;--ec-cs-closedPadBlk:4px;--ec-cs-closedMarg:0;--ec-cs-closedFontFml:inherit;--ec-cs-closedFontSize:inherit;--ec-cs-closedLineHt:inherit;--ec-cs-closedTextCol:#e1e4e8;--ec-cs-closedBgCol:#58606933;--ec-cs-closedBrdCol:#58606980;--ec-cs-openBrdWd:1px;--ec-cs-openPad:0;--ec-cs-openMarg:0;--ec-cs-openBgCol:transparent;--ec-cs-openBgColCollapsible:#5860691a;--ec-cs-openBrdCol:transparent;--ec-cs-expandIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;m8.177.677%202.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25a.75.75%200%200%201-1.5%200V4H5.104a.25.25%200%200%201-.177-.427L7.823.677a.25.25%200%200%201%20.354%200ZM7.25%2010.75a.75.75%200%200%201%201.5%200V12h2.146a.25.25%200%200%201%20.177.427l-2.896%202.896a.25.25%200%200%201-.354%200l-2.896-2.896A.25.25%200%200%201%205.104%2012H7.25v-1.25Zm-5-2a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-cs-collapseIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;M10.896%202H8.75V.75a.75.75%200%200%200-1.5%200V2H5.104a.25.25%200%200%200-.177.427l2.896%202.896a.25.25%200%200%200%20.354%200l2.896-2.896A.25.25%200%200%200%2010.896%202ZM8.75%2015.25a.75.75%200%200%201-1.5%200V14H5.104a.25.25%200%200%201-.177-.427l2.896-2.896a.25.25%200%200%201%20.354%200l2.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25Zm-6.5-6.5a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;)}.expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])),:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--0, inherit);background-color:var(--0bg, transparent);font-style:var(--0fs, inherit);font-weight:var(--0fw, inherit);text-decoration:var(--0td, inherit)}@media (prefers-color-scheme: light){:root:not([data-theme=&quot;dark&quot;]){--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root:not([data-theme=&quot;dark&quot;]) .expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]),.expressive-code[data-theme=&quot;light&quot;]{--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]) .ec-line :where(span[style^=&apos;--&apos;]:not([class])),.expressive-code[data-theme=&quot;light&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}&lt;/style&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function a(e){if(!e)return;let t=e.getAttribute(&quot;tabindex&quot;)!==null,r=e.scrollWidth&gt;e.clientWidth;r&amp;&amp;!t?(e.setAttribute(&quot;tabindex&quot;,&quot;0&quot;),e.setAttribute(&quot;role&quot;,&quot;region&quot;)):!r&amp;&amp;t&amp;&amp;(e.removeAttribute(&quot;tabindex&quot;),e.removeAttribute(&quot;role&quot;))}var u=window.requestIdleCallback||(e=&gt;setTimeout(e,1)),s=window.cancelIdleCallback||clearTimeout;function l(e){let t=new Set,r,n;return new ResizeObserver(c=&gt;{c.forEach(o=&gt;t.add(o.target)),r&amp;&amp;clearTimeout(r),n&amp;&amp;s(n),r=setTimeout(()=&gt;{n&amp;&amp;s(n),n=u(()=&gt;{t.forEach(o=&gt;e(o)),t.clear()})},250)})}function i(e,t){e.querySelectorAll?.(&quot;.expressive-code pre &gt; code&quot;).forEach(r=&gt;{let n=r.parentElement;n&amp;&amp;t.observe(n)})}var d=l(a);i(document,d);var b=new MutationObserver(e=&gt;e.forEach(t=&gt;t.addedNodes.forEach(r=&gt;{i(r,d)})));b.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document,d)});})();}catch(e){console.error(&quot;[EC] tabindex-js-module failed:&quot;,e)}&lt;/script&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function l(o){let e=document.createElement(&quot;pre&quot;);Object.assign(e.style,{opacity:&quot;0&quot;,pointerEvents:&quot;none&quot;,position:&quot;absolute&quot;,overflow:&quot;hidden&quot;,left:&quot;0&quot;,top:&quot;0&quot;,width:&quot;20px&quot;,height:&quot;20px&quot;,webkitUserSelect:&quot;auto&quot;,userSelect:&quot;all&quot;}),e.ariaHidden=&quot;true&quot;,e.textContent=o,document.body.appendChild(e);let a=document.createRange();a.selectNode(e);let n=getSelection();if(!n)return!1;n.removeAllRanges(),n.addRange(a);let r=!1;try{r=document.execCommand(&quot;copy&quot;)}finally{n.removeAllRanges(),document.body.removeChild(e)}return r}async function u(o){let e=o.currentTarget,a=e.dataset,n=!1,r=a.code.replace(/\u007f/g,`
`);try{await navigator.clipboard.writeText(r),n=!0}catch{n=l(r)}if(!n||e.parentNode?.querySelector(&quot;.feedback&quot;))return;let c=e.parentNode?.querySelector(&quot;[aria-live]&quot;),t=document.createElement(&quot;div&quot;);t.classList.add(&quot;feedback&quot;),t.append(a.copied),c.append(t),t.offsetWidth,requestAnimationFrame(()=&gt;t?.classList.add(&quot;show&quot;));let s=()=&gt;!t||t.classList.remove(&quot;show&quot;),d=()=&gt;{!t||parseFloat(getComputedStyle(t).opacity)&gt;0||(t.remove(),t=void 0)};setTimeout(s,1500),setTimeout(d,2500),e.addEventListener(&quot;blur&quot;,s),t.addEventListener(&quot;transitioncancel&quot;,d),t.addEventListener(&quot;transitionend&quot;,d)}function i(o){o.querySelectorAll?.(&quot;.expressive-code .copy button&quot;).forEach(e=&gt;e.addEventListener(&quot;click&quot;,u))}i(document);var m=new MutationObserver(o=&gt;o.forEach(e=&gt;e.addedNodes.forEach(a=&gt;{i(a)})));m.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document)});})();}catch(e){console.error(&quot;[EC] copy-js-module failed:&quot;,e)}&lt;/script&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;!DOCTYPE html&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;2&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;html lang=&quot;en&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;3&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;head&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;4&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;meta charset=&quot;UTF-8&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;5&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;6&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;ie=edge&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;7&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;title&gt;My Website&amp;#x3C;/title&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;8&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;link rel=&quot;stylesheet&quot; href=&quot;./style.css&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;9&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;link rel=&quot;icon&quot; href=&quot;./favicon.ico&quot; type=&quot;image/x-icon&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;10&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;/head&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;11&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;body&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;12&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;main&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;13&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;h1&gt;Welcome to My Website&amp;#x3C;/h1&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;14&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;/main&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;15&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;script src=&quot;index.js&quot;&gt;&amp;#x3C;/script&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;details class=&quot;ec-section github&quot;&gt;&lt;summary&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;expand&quot;&gt;&lt;/span&gt;&lt;span class=&quot;collapse&quot;&gt;&lt;/span&gt;&lt;span class=&quot;text&quot;&gt;2 collapsed lines&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/summary&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;16&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;/body&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;17&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;&amp;#x3C;/html&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/details&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;&lt;!DOCTYPE html&gt;&lt;html lang=&amp;#x22;en&amp;#x22;&gt;  &lt;head&gt;    &lt;meta charset=&amp;#x22;UTF-8&amp;#x22;&gt;    &lt;meta name=&amp;#x22;viewport&amp;#x22; content=&amp;#x22;width=device-width, initial-scale=1.0&amp;#x22;&gt;    &lt;meta http-equiv=&amp;#x22;X-UA-Compatible&amp;#x22; content=&amp;#x22;ie=edge&amp;#x22;&gt;    &lt;title&gt;My Website&lt;/title&gt;    &lt;link rel=&amp;#x22;stylesheet&amp;#x22; href=&amp;#x22;./style.css&amp;#x22;&gt;    &lt;link rel=&amp;#x22;icon&amp;#x22; href=&amp;#x22;./favicon.ico&amp;#x22; type=&amp;#x22;image/x-icon&amp;#x22;&gt;  &lt;/head&gt;  &lt;body&gt;    &lt;main&gt;        &lt;h1&gt;Welcome to My Website&lt;/h1&gt;    &lt;/main&gt;    &lt;script src=&amp;#x22;index.js&amp;#x22;&gt;&lt;/script&gt;  &lt;/body&gt;&lt;/html&gt;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;h2 id=&quot;接下來呢&quot;&gt;接下來呢？&lt;/h2&gt;
&lt;p&gt;如果你是個新手，我真的很建議你去上 &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;http://freeCodeCamp.org&quot;&gt;freeCodeCamp.org&lt;/a&gt; 上的免費課程，它幾乎涵蓋了你入門網頁開發所需知道的一切。&lt;/p&gt;
&lt;p&gt;雖然 GitHub page 很容易架設，但它也有一些限制，隨著你在網頁開發上持續進步，可能會限制你能做的事。如果你認真想投入這個領域，了解 React、Next、Flask、Express.js 等不同的開發技術至關重要。在這方面，GitHub Page 就是不夠用。你需要尋找其他方案，例如 Netlify、Digital Ocean，最終則是搭配 Docker 執行個體的自架 VPS，讓你自己架設網站的每一個部分。&lt;/p&gt;
&lt;h2 id=&quot;cloudflare-與-github-pages-的比較&quot;&gt;Cloudflare 與 GitHub Pages 的比較&lt;/h2&gt;
&lt;p&gt;雖然 GitHub page 容易架設且適合新手，但現在我傾向使用 &lt;strong&gt;Cloudflare pages&lt;/strong&gt;，它不僅免費且流量無上限，如果你透過 Cloudflare 購買網域，它還會幫你設定自訂網域。除此之外，你的儲存庫也可以設為私人。所以，它可說是 GitHub page 的進化版。你或許也可以去看看。&lt;/p&gt;
&lt;p&gt;&lt;em&gt;如果這份指南對你來說不夠清楚，你可以參考 GitHub 的官方指南&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://pages.github.com/&quot;&gt;這裡&lt;/a&gt;。&lt;/em&gt;&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/0090d3fd-8466-49d4-89f2-47b351bb3531"/><enclosure url="https://cms.hongct.com/assets/0090d3fd-8466-49d4-89f2-47b351bb3531" length="7570" type="image/webp"/></item><item><title>Appwrite 與 Supabase 的比較</title><link>https://hongcheung.com/tw/post/appwrite-vs-supabase/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/appwrite-vs-supabase/</guid><description>該選哪一個？這是我的看法。</description><pubDate>Thu, 06 Mar 2025 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/9d25914e-1f5f-4ccf-901a-998d0b454ed9&quot; alt=&quot;Appwrite 與 Supabase 的比較&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;前言&quot;&gt;前言&lt;/h2&gt;
&lt;p&gt;我主要是一位獨立 iOS 開發者，但一直有在考慮做一些跨平台 App。我試過 Firebase，但抱持懷疑態度，因為我讀過一則糟糕的案例，使用者用 Firebase 收到誇張的帳單。而且直到今天，Google 還是不讓你設定預算上限。所以，我開始尋找 Firebase 的替代方案，或者該說是一個簡單好用的跨平台資料庫服務？&lt;/p&gt;
&lt;p&gt;我最後選定了 Appwrite 和 Supabase。以我初學者等級的後端經驗試用過兩者之後，以下是我的觀點。&lt;/p&gt;
&lt;p&gt;TL;DR：&lt;br&gt;
如果你是自己架設（self-hosting），而且不需要儲存關聯式資料，就用 Appwrite。如果你不介意付費，想要省事、長期穩健的開發，並使用雲端版本的 Supabase。我會說明原因。&lt;/p&gt;
&lt;h2 id=&quot;supabase-與-appwrite-的主要差異&quot;&gt;Supabase 與 Appwrite 的主要差異&lt;/h2&gt;
&lt;h3 id=&quot;資料庫技術&quot;&gt;資料庫技術&lt;/h3&gt;
&lt;p&gt;Appwrite 使用 NoSQL，Supabase 使用 PostgresSQL。&lt;/p&gt;
&lt;p&gt;如果你熟悉 Firebase，用 Appwrite 會感到很親切。但如果你想要關聯式資料庫，就選 Supabase。&lt;/p&gt;
&lt;h3 id=&quot;雲端定價&quot;&gt;雲端定價&lt;/h3&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://supabase.com/pricing&quot;&gt;Supabase&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://appwrite.io/pricing&quot;&gt;Appwrite&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;截至 2025 年 3 月，兩項服務都提供有使用限制的免費方案。例如 1-2 個專案、有限的頻寬、並行使用者數量等。你可以從上面的連結查看最新定價。目前，超出免費方案後，Supabase 從每月 $25 起，Appwrite 從每月 $15 起。&lt;/p&gt;
&lt;h3 id=&quot;使用者介面&quot;&gt;使用者介面&lt;/h3&gt;
&lt;p&gt;Appwrite&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;面板項目較少，總覽更簡潔。
&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/2d67c07b-a435-4db6-88f4-b316e0f406b5&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Supabase&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;選項較多，但看起來有點複雜。
&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/90ba61ff-b320-4098-9807-51b5fabc847b&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;自行架設&quot;&gt;自行架設&lt;/h3&gt;
&lt;p&gt;兩者都很容易部署。不過，Supabase 的自行架設版本相當受限，是他們雲端版本的閹割版。不像 Appwrite，自行架設版本就能取得所有功能。以下是我在自行架設 Supabase 時遇到的一些問題：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Supabase 自行架設版本每個執行個體只允許一個專案；這與你透過他們平台使用的雲端版本不同，雲端版本可以建立許多專案。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;我試著尋找並修改驗證用的 URL 重新導向，但選單裡沒有像雲端版本那樣的按鈕。於是我前往雲端伺服器，進到該頁面，複製連結，並把它改成指向我的執行個體。然後我就能看到那些選項，但無法修改。我猜這是閹割版的限制之一。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;文件大多是針對雲端版本，無法順利套用到自行架設版本。這是因為某些設定和選項並不存在。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;另一方面，Appwrite 我很快就讓它跑起來了。而且我發現文件很容易照著做。&lt;/p&gt;
&lt;h3 id=&quot;離線同步&quot;&gt;離線同步&lt;/h3&gt;
&lt;p&gt;如果你的 App 不只限於網站，很可能在某個時候需要處理離線同步。在這方面，Supabase 比較容易處理，因為有函式庫和第三方服務可以搭配使用。Powersync 和 Brick 之類的選項很常見。至於 Appwrite，你得自己撰寫同步邏輯，因為我找不到任何易於使用的函式庫來處理離線同步。&lt;/p&gt;
&lt;h2 id=&quot;最後補充&quot;&gt;最後補充&lt;/h2&gt;
&lt;p&gt;我目前使用自行架設的 Appwrite，因為：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;一個執行個體，多個專案 - 我可以玩很多專案，不用擔心限制和帳單&lt;/li&gt;
&lt;li&gt;功能完整 - 與雲端版本沒有差別（我想是這樣？至少我還沒遇到我需要但卻沒有的功能）&lt;/li&gt;
&lt;li&gt;文件容易照著做&lt;/li&gt;
&lt;li&gt;Supabase 似乎透過閹割許多功能來逼你使用他們的雲端方案，我不喜歡這樣&lt;/li&gt;
&lt;li&gt;嘗試 NoSQL - 我有專案使用 Supabase 雲端版本，而且它很好。但最終我還是需要自行架設的替代方案，目前 Appwrite 似乎提供更好的選擇。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;如果你不介意付費，Supabase 很棒。如果你想親自動手，或更熟悉 NoSQL，自行架設 Appwrite 也夠有趣了。&lt;/p&gt;
&lt;p&gt;參考資料：&lt;/p&gt;
&lt;p&gt;我研究時看到的&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://www.reddit.com/r/appwrite/comments/1c6xjm5/appwrite_vs_supabase_vs_pocektbase/&quot;&gt;這篇 reddit 貼文&lt;/a&gt;。&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/9d25914e-1f5f-4ccf-901a-998d0b454ed9"/><enclosure url="https://cms.hongct.com/assets/9d25914e-1f5f-4ccf-901a-998d0b454ed9" length="7420" type="image/webp"/></item><item><title>如何修復 Google AdMob 的廣告放送受限問題</title><link>https://hongcheung.com/tw/post/how-to-fix-ad-serving-is-limited-on-google-admob/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/how-to-fix-ad-serving-is-limited-on-google-admob/</guid><description>以正確的方式解除 AdMob 廣告放送限制。</description><pubDate>Thu, 01 Feb 2024 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/500a3437-bb1a-4ec5-a415-7bcf137176f8&quot; alt=&quot;如何修復 Google AdMob 的廣告放送受限問題&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;前言&quot;&gt;前言&lt;/h2&gt;
&lt;p&gt;我的帳戶之前收過這個訊息，既令人沮喪又惱人。我花了好幾個月才擺脫它，以下是我做了什麼，以及我最終如何擺脫它。&lt;/p&gt;
&lt;h2 id=&quot;為什麼會發生&quot;&gt;為什麼會發生&lt;/h2&gt;
&lt;h3 id=&quot;新帳戶&quot;&gt;新帳戶&lt;/h3&gt;
&lt;p&gt;即使你沒做錯任何事，也仔細遵守了他們的廣告刊登政策，還是可能因為帳戶是新的而收到這個惱人的警告。&lt;/p&gt;
&lt;h3 id=&quot;流量暴增&quot;&gt;流量暴增&lt;/h3&gt;
&lt;p&gt;如果你的應用程式平常沒有這麼多流量，卻突然收到異常大量的曝光（例如從一天 10 次變成一個禮拜 1 萬次），他們不管怎樣都會直接套用這個廣告放送限制。&lt;/p&gt;
&lt;h3 id=&quot;刊登位置錯誤&quot;&gt;刊登位置錯誤&lt;/h3&gt;
&lt;p&gt;如果你把廣告放在非常靠近應用程式內按鈕的地方，或是有意用花招誘導使用者點擊廣告，他們也會注意到。&lt;/p&gt;
&lt;h3 id=&quot;點擊自己的廣告&quot;&gt;點擊自己的廣告&lt;/h3&gt;
&lt;p&gt;任何時候你都不應該點擊自己的廣告。&lt;/p&gt;
&lt;h3 id=&quot;開發期間沒有使用測試廣告&quot;&gt;開發期間沒有使用測試廣告&lt;/h3&gt;
&lt;p&gt;這是新手常犯的錯誤，它會在單一裝置上產生大量曝光，而 Google 不喜歡這樣。開發階段請務必使用測試廣告。&lt;/p&gt;
&lt;h2 id=&quot;如何修復&quot;&gt;如何修復&lt;/h2&gt;
&lt;h3 id=&quot;仔細閱讀他們的政策&quot;&gt;仔細閱讀他們的政策&lt;/h3&gt;
&lt;p&gt;遵循他們文件中的指引。&lt;/p&gt;
&lt;p&gt;舉例來說，刊登橫幅廣告的常見做法是只放在最底部或最頂部，不要試著放進內容裡，或用任何會讓使用者混淆的方式擺放。這樣就不會有誤觸，只有刻意點擊。&lt;/p&gt;
&lt;h3 id=&quot;設定曝光上限&quot;&gt;設定曝光上限&lt;/h3&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/29bde5a5-540a-41ed-88a6-c4e5802c9ac1&quot; alt=&quot;Google AdMob 頻率上限&quot;&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;前往你的 AdMob 帳戶頁面。&lt;/li&gt;
&lt;li&gt;選擇有廣告的應用程式。&lt;/li&gt;
&lt;li&gt;點擊側邊欄的應用程式設定。&lt;/li&gt;
&lt;li&gt;設定「頻率上限」。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;我的做法是設成 20 分鐘內 1 次曝光，之後廣告放送限制就解除了。&lt;/p&gt;
&lt;h3 id=&quot;等待&quot;&gt;等待&lt;/h3&gt;
&lt;p&gt;如果你已經仔細檢視了一切，並確認你的應用程式符合政策，那就只能等待。&lt;/p&gt;
&lt;p&gt;沒錯，這就是最終答案，也是我最後擺脫它的方法。他們只是需要一些時間來評估並驗證你的帳戶和流量。&lt;/p&gt;
&lt;p&gt;我確實用過一些花招，例如把我帳戶裡所有廣告都移除，等警告消失後再重新建立廣告並放進我的應用程式。這最多只會有效一天。一旦他們注意到你的帳戶有任何廣告活動，警告就會立刻回來。所以，別試著那麼做，那只會延長廣告限制。&lt;/p&gt;
&lt;p&gt;相反地，盡你所能閱讀並遵循他們文件中的每一項指示，讓廣告放送限制服完它的時間。我大約花了一個月才擺脫它。&lt;/p&gt;
&lt;p&gt;祝你好運。&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/500a3437-bb1a-4ec5-a415-7bcf137176f8"/><enclosure url="https://cms.hongct.com/assets/500a3437-bb1a-4ec5-a415-7bcf137176f8" length="116843" type="image/jpeg"/></item><item><title>如何使用 SwiftyJSON 解析 JSON</title><link>https://hongcheung.com/tw/post/how-to-parse-a-json-with-swiftyjson/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/how-to-parse-a-json-with-swiftyjson/</guid><description>在 Xcode 中解碼動態 JSON 時非常實用的函式庫。</description><pubDate>Sun, 28 Jan 2024 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/6642e0c4-c790-436c-ad0d-720c8ddfa54f&quot; alt=&quot;如何使用 SwiftyJSON 解析 JSON&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;什麼是-swiftyjson&quot;&gt;什麼是 SwiftyJSON？&lt;/h2&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://github.com/SwiftyJSON/SwiftyJSON&quot; title=&quot;SwiftyJSON&quot;&gt;SwiftyJSON&lt;/a&gt; 是一個第三方函式庫，能讓你在 Xcode 專案中更輕鬆地解碼 JSON 檔案。&lt;/p&gt;
&lt;h3 id=&quot;為什麼你需要它&quot;&gt;為什麼你需要它？&lt;/h3&gt;
&lt;p&gt;使用預先定義的型別來編碼與解碼 JSON 被視為最佳實務。然而，使用內建的 JSONDecoder 的缺點在於，處理動態 JSON 相當麻煩。即使你勉強完成了，仍然需要花費大量工夫才能做對，這並不理想。&lt;/p&gt;
&lt;h3 id=&quot;動態-json-範例&quot;&gt;動態 JSON 範例&lt;/h3&gt;
&lt;p&gt;想像你有一個長這樣的 JSON：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;style&gt;.expressive-code{font-family:var(--ec-uiFontFml);font-size:var(--ec-uiFontSize);font-weight:var(--ec-uiFontWg);line-height:var(--ec-uiLineHt);text-size-adjust:none;-webkit-text-size-adjust:none}.expressive-code *:not(:is(svg, svg *)){all:revert;box-sizing:border-box}.expressive-code pre{display:flex;margin:0;padding:0;border:var(--ec-brdWd) solid var(--ec-brdCol);border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));background:var(--ec-codeBg)}.expressive-code pre:focus-visible{outline:3px solid var(--ec-focusBrd);outline-offset:-3px}.expressive-code pre &gt; code{all:unset;display:block;flex:1 0 100%;padding:var(--ec-codePadBlk) 0;color:var(--ec-codeFg);font-family:var(--ec-codeFontFml);font-size:var(--ec-codeFontSize);font-weight:var(--ec-codeFontWg);line-height:var(--ec-codeLineHt)}.expressive-code pre{overflow-x:auto}.expressive-code pre.wrap .ec-line .code{white-space:pre-wrap;overflow-wrap:break-word;min-width:min(20ch, var(--ecMaxLine, 20ch))}.expressive-code pre.wrap .ec-line .code span.indent{white-space:pre}.expressive-code pre::-webkit-scrollbar,.expressive-code pre::-webkit-scrollbar-track{background-color:inherit;border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));border-top-left-radius:0;border-top-right-radius:0}.expressive-code pre::-webkit-scrollbar-thumb{background-color:var(--ec-sbThumbCol);border:4px solid transparent;background-clip:content-box;border-radius:10px}.expressive-code pre::-webkit-scrollbar-thumb:hover{background-color:var(--ec-sbThumbHoverCol)}.expressive-code pre::-webkit-scrollbar-corner{background:transparent}.expressive-code .ec-line{direction:ltr;unicode-bidi:isolate;display:grid;grid-template-areas:&apos;gutter code&apos;;grid-template-columns:auto 1fr;position:relative}.expressive-code .ec-line .gutter{grid-area:gutter;color:var(--ec-gtrFg)}.expressive-code .ec-line .gutter &gt; *{pointer-events:none;user-select:none;-webkit-user-select:none}.expressive-code .ec-line .gutter ~ .code{--ecLineBrdCol:var(--ec-gtrBrdCol)}.expressive-code .ec-line.highlight .gutter{color:var(--ec-gtrHlFg)}.expressive-code .ec-line .code{grid-area:code;position:relative;box-sizing:content-box;padding-inline-start:calc(var(--ecIndent, 0ch) + var(--ec-codePadInl) - var(--ecGtrBrdWd));padding-inline-end:var(--ec-codePadInl);text-indent:calc(var(--ecIndent, 0ch) * -1)}.expressive-code .ec-line .code::before,.expressive-code .ec-line .code::after,.expressive-code .ec-line .code :where(*){text-indent:0}.expressive-code .ec-line .code{--ecGtrBrdWd:var(--ec-gtrBrdWd);border-inline-start:var(--ecGtrBrdWd) solid var(--ecLineBrdCol, transparent)}.expressive-code .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.expressive-code .ec-line.mark{--tmLineBgCol:var(--ec-tm-markBg)}.expressive-code .ec-line.mark .code{--ecLineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line.ins{--tmLineBgCol:var(--ec-tm-insBg);--tmLabel:var(--ec-tm-insDiffIndContent)}.expressive-code .ec-line.ins .code{--ecLineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line.ins .code::before{color:var(--ec-tm-insDiffIndCol)}.expressive-code .ec-line.del{--tmLineBgCol:var(--ec-tm-delBg);--tmLabel:var(--ec-tm-delDiffIndContent)}.expressive-code .ec-line.del .code{--ecLineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line.del .code::before{color:var(--ec-tm-delDiffIndCol)}.expressive-code .ec-line.mark,.expressive-code .ec-line.ins,.expressive-code .ec-line.del{background:var(--tmLineBgCol)}.expressive-code .ec-line.mark .code,.expressive-code .ec-line.ins .code,.expressive-code .ec-line.del .code{--ecGtrBrdWd:var(--ec-tm-lineMarkerAccentWd)}.expressive-code .ec-line.mark .code::before,.expressive-code .ec-line.ins .code::before,.expressive-code .ec-line.del .code::before{display:block;position:absolute;left:0;box-sizing:border-box;content:var(--tmLabel, &apos; &apos;);padding-inline-start:var(--ec-tm-lineDiffIndMargLeft);text-align:center;white-space:pre}.expressive-code .ec-line.mark.tm-label .code::before,.expressive-code .ec-line.ins.tm-label .code::before,.expressive-code .ec-line.del.tm-label .code::before{background:var(--ecLineBrdCol);padding:0 calc(var(--ec-tm-lineMarkerLabelPadInl) + var(--ec-tm-lineMarkerAccentWd)) 0 var(--ec-tm-lineMarkerLabelPadInl);color:var(--ec-tm-lineMarkerLabelCol)}.expressive-code .ec-line mark{--tmInlineBgCol:var(--ec-tm-markBg);--tmInlineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line ins{--tmInlineBgCol:var(--ec-tm-insBg);--tmInlineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line del{--tmInlineBgCol:var(--ec-tm-delBg);--tmInlineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line mark,.expressive-code .ec-line ins,.expressive-code .ec-line del{all:unset;display:inline-block;position:relative;--tmBrdL:var(--ec-tm-inlMarkerBrdWd);--tmBrdR:var(--ec-tm-inlMarkerBrdWd);--tmRadL:var(--ec-tm-inlMarkerBrdRad);--tmRadR:var(--ec-tm-inlMarkerBrdRad);margin-inline:0.025rem;padding-inline:var(--ec-tm-inlMarkerPad);border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);background:var(--tmInlineBgCol);background-clip:padding-box}.expressive-code .ec-line mark.open-start,.expressive-code .ec-line ins.open-start,.expressive-code .ec-line del.open-start{margin-inline-start:0;padding-inline-start:0;--tmBrdL:0px;--tmRadL:0}.expressive-code .ec-line mark.open-end,.expressive-code .ec-line ins.open-end,.expressive-code .ec-line del.open-end{margin-inline-end:0;padding-inline-end:0;--tmBrdR:0px;--tmRadR:0}.expressive-code .ec-line mark::before,.expressive-code .ec-line ins::before,.expressive-code .ec-line del::before{content:&apos;&apos;;position:absolute;pointer-events:none;display:inline-block;inset:0;border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);border:var(--ec-tm-inlMarkerBrdWd) solid var(--tmInlineBrdCol);border-inline-width:var(--tmBrdL) var(--tmBrdR)}.expressive-code .frame{all:unset;position:relative;display:block;--header-border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));--tab-border-radius:calc(var(--ec-frm-edTabBrdRad) + var(--ec-brdWd));--button-spacing:0.4rem;--code-background:var(--ec-frm-edBg);border-radius:var(--header-border-radius);box-shadow:var(--ec-frm-frameBoxShdCssVal)}.expressive-code .frame .header{display:none;z-index:1;position:relative;border-radius:var(--header-border-radius) var(--header-border-radius) 0 0}.expressive-code .frame.has-title pre,.expressive-code .frame.has-title code,.expressive-code .frame.is-terminal pre,.expressive-code .frame.is-terminal code{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.expressive-code .frame .title:empty:before{content:&apos;\a0&apos;}.expressive-code .frame.has-title:not(.is-terminal){--button-spacing:calc(1.9rem + 2 * (var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)))}.expressive-code .frame.has-title:not(.is-terminal) .title{position:relative;color:var(--ec-frm-edActTabFg);background:var(--ec-frm-edActTabBg);background-clip:padding-box;margin-block-start:var(--ec-frm-edTabsMargBlkStart);padding:calc(var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)) var(--ec-uiPadInl);border:var(--ec-brdWd) solid var(--ec-frm-edActTabBrdCol);border-radius:var(--tab-border-radius) var(--tab-border-radius) 0 0;border-bottom:none;overflow:hidden}.expressive-code .frame.has-title:not(.is-terminal) .title::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-top:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndTopCol);border-bottom:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndBtmCol)}.expressive-code .frame.has-title:not(.is-terminal) .header{display:flex;background:linear-gradient(to top, var(--ec-frm-edTabBarBrdBtmCol) var(--ec-brdWd), transparent var(--ec-brdWd)),linear-gradient(var(--ec-frm-edTabBarBg), var(--ec-frm-edTabBarBg));background-repeat:no-repeat;padding-inline-start:var(--ec-frm-edTabsMargInlStart)}.expressive-code .frame.has-title:not(.is-terminal) .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border:var(--ec-brdWd) solid var(--ec-frm-edTabBarBrdCol);border-radius:inherit;border-bottom:none}.expressive-code .frame.is-terminal{--button-spacing:calc(1.9rem + var(--ec-brdWd) + 2 * var(--ec-uiPadBlk));--code-background:var(--ec-frm-trmBg)}.expressive-code .frame.is-terminal .header{display:flex;align-items:center;justify-content:center;padding-block:var(--ec-uiPadBlk);padding-block-end:calc(var(--ec-uiPadBlk) + var(--ec-brdWd));position:relative;font-weight:500;letter-spacing:0.025ch;color:var(--ec-frm-trmTtbFg);background:var(--ec-frm-trmTtbBg);border:var(--ec-brdWd) solid var(--ec-brdCol);border-bottom:none}.expressive-code .frame.is-terminal .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;left:var(--ec-uiPadInl);width:2.1rem;height:0.56rem;line-height:0;background-color:var(--ec-frm-trmTtbDotsFg);opacity:var(--ec-frm-trmTtbDotsOpa);-webkit-mask-image:var(--ec-frm-trmIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-trmIcon);mask-repeat:no-repeat}.expressive-code .frame.is-terminal .header::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-bottom:var(--ec-brdWd) solid var(--ec-frm-trmTtbBrdBtmCol)}.expressive-code .frame pre{background:var(--code-background)}.expressive-code .copy{display:flex;gap:0.25rem;flex-direction:row;position:absolute;inset-block-start:calc(var(--ec-brdWd) + var(--button-spacing));inset-inline-end:calc(var(--ec-brdWd) + var(--ec-uiPadInl) / 2)}@media (scripting: none){.expressive-code .copy{display:none}}.expressive-code .copy{direction:ltr;unicode-bidi:isolate}.expressive-code .copy button{position:relative;align-self:flex-end;margin:0;padding:0;border:none;border-radius:0.2rem;z-index:1;cursor:pointer;transition-property:opacity, background, border-color;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.25, 0.46, 0.45, 0.94);width:2.5rem;height:2.5rem;background:var(--code-background);opacity:0.75}.expressive-code .copy button div{position:absolute;inset:0;border-radius:inherit;background:var(--ec-frm-inlBtnBg);opacity:var(--ec-frm-inlBtnBgIdleOpa);transition-property:inherit;transition-duration:inherit;transition-timing-function:inherit}.expressive-code .copy button::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-radius:inherit;border:var(--ec-brdWd) solid var(--ec-frm-inlBtnBrd);opacity:var(--ec-frm-inlBtnBrdOpa)}.expressive-code .copy button::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-frm-inlBtnFg);-webkit-mask-image:var(--ec-frm-copyIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-copyIcon);mask-repeat:no-repeat;margin:0.475rem;line-height:0}.expressive-code .copy button:hover,.expressive-code .copy button:focus:focus-visible{opacity:1}.expressive-code .copy button:hover div,.expressive-code .copy button:focus:focus-visible div{opacity:var(--ec-frm-inlBtnBgHoverOrFocusOpa)}.expressive-code .copy button:active{opacity:1}.expressive-code .copy button:active div{opacity:var(--ec-frm-inlBtnBgActOpa)}.expressive-code .copy .feedback{--tooltip-arrow-size:0.35rem;--tooltip-bg:var(--ec-frm-tooltipSuccessBg);color:var(--ec-frm-tooltipSuccessFg);pointer-events:none;user-select:none;-webkit-user-select:none;position:relative;align-self:center;background-color:var(--tooltip-bg);z-index:99;padding:0.125rem 0.75rem;border-radius:0.2rem;margin-inline-end:var(--tooltip-arrow-size);opacity:0;transition-property:opacity, transform;transition-duration:0.2s;transition-timing-function:ease-in-out;transform:translate3d(0, 0.25rem, 0)}.expressive-code .copy .feedback::after{content:&apos;&apos;;position:absolute;pointer-events:none;top:calc(50% - var(--tooltip-arrow-size));inset-inline-end:calc(-2 * (var(--tooltip-arrow-size) - 0.5px));border:var(--tooltip-arrow-size) solid transparent;border-inline-start-color:var(--tooltip-bg)}.expressive-code .copy .feedback.show{opacity:1;transform:translate3d(0, 0, 0)}@media (hover: hover){.expressive-code{}.expressive-code .copy button{opacity:0;width:2rem;height:2rem}.expressive-code .frame:hover .copy button:not(:hover),.expressive-code .frame:focus-within :focus-visible ~ .copy button:not(:hover),.expressive-code .frame .copy .feedback.show ~ button:not(:hover){opacity:0.75}}.expressive-code :nth-child(1 of .ec-line) .code{padding-inline-end:calc(2rem + var(--ec-codePadInl))}.expressive-code .gutter .ln{display:inline-flex;justify-content:flex-end;align-items:flex-start;box-sizing:content-box;min-width:var(--lnWidth, 2ch);padding-inline:2ch;color:var(--ec-lineNumbers-fg)}.highlight .expressive-code .gutter .ln{color:var(--ec-lineNumbers-hlFg)}.expressive-code .ec-section{position:relative}.expressive-code .ec-section summary{position:relative;font-family:var(--ec-cs-closedFontFml);font-size:var(--ec-cs-closedFontSize);line-height:var(--ec-cs-closedLineHt);user-select:none;-webkit-user-select:none;cursor:pointer;color:var(--ec-cs-closedTextCol);background-color:var(--ec-cs-closedBgCol);--border-color:var(--ec-cs-closedBrdCol);--border-width:var(--ec-cs-closedBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);margin:var(--ec-cs-closedMarg);padding:0}.expressive-code .ec-section summary::marker{display:inline-block;content:&quot;&quot;;width:16px;height:16px}.expressive-code .ec-section summary::-webkit-details-marker{display:none}.expressive-code .ec-section summary :is(.expand, .collapse){position:relative;display:inline-block;width:16px;height:16px;vertical-align:text-bottom;opacity:0.75}.expressive-code .ec-section summary :is(.expand, .collapse)::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-cs-closedTextCol);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;line-height:0}.expressive-code .ec-section summary .expand::after{-webkit-mask-image:var(--ec-cs-expandIcon);mask-image:var(--ec-cs-expandIcon);-webkit-print-color-adjust:exact;print-color-adjust:exact}.expressive-code .ec-section summary .collapse{display:none}.expressive-code .ec-section summary .collapse::after{-webkit-mask-image:var(--ec-cs-collapseIcon);mask-image:var(--ec-cs-collapseIcon)}.expressive-code .ec-section summary .text{margin-left:1em}.expressive-code .ec-section summary .ec-line .code{padding-block:var(--ec-cs-closedPadBlk);text-indent:0}.expressive-code .ec-section[open],.expressive-code .ec-section details[open] + .content-lines{--border-color:var(--ec-cs-openBrdCol);--border-width:var(--ec-cs-openBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);padding-inline:var(--ec-cs-openPad);margin-inline:var(--ec-cs-openMarg)}.expressive-code .ec-section.github[open] summary{display:none}.expressive-code .ec-section.github[open]{background-color:var(--ec-cs-openBgCol)}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end){display:flex;flex-direction:column}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) .content-lines{display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] .collapse{display:inline-block}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] :is(.expand, .text){display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] + .content-lines{display:block;background-color:var(--ec-cs-openBgColCollapsible)}@media print{.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open]{display:none}}.expressive-code .ec-section.collapsible-end{flex-direction:column-reverse}:root,:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;]{--ec-brdRad:0.3rem;--ec-brdWd:1.5px;--ec-brdCol:#1b1f23;--ec-codeFontFml:jetbrains-mono;--ec-codeFontSize:0.85rem;--ec-codeFontWg:400;--ec-codeLineHt:1.65;--ec-codePadBlk:1rem;--ec-codePadInl:1.35rem;--ec-codeBg:#24292e;--ec-codeFg:#e1e4e8;--ec-codeSelBg:#3392ff44;--ec-gtrFg:#727980;--ec-gtrBrdCol:#72798033;--ec-gtrBrdWd:1.5px;--ec-gtrHlFg:#e1e4e896;--ec-uiFontFml:jetbrains-mono;--ec-uiFontSize:0.9rem;--ec-uiFontWg:400;--ec-uiLineHt:1.65;--ec-uiPadBlk:0.25rem;--ec-uiPadInl:1rem;--ec-uiSelBg:#39414a;--ec-uiSelFg:#e1e4e8;--ec-focusBrd:#005cc5;--ec-sbThumbCol:#6a737d33;--ec-sbThumbHoverCol:#6a737dd1;--ec-tm-lineMarkerAccentMarg:0rem;--ec-tm-lineMarkerAccentWd:0.15rem;--ec-tm-lineMarkerLabelPadInl:0.2rem;--ec-tm-lineMarkerLabelCol:white;--ec-tm-lineDiffIndMargLeft:0.3rem;--ec-tm-inlMarkerBrdWd:1.5px;--ec-tm-inlMarkerBrdRad:0.2rem;--ec-tm-inlMarkerPad:0.15rem;--ec-tm-insDiffIndContent:&apos;+&apos;;--ec-tm-delDiffIndContent:&apos;-&apos;;--ec-tm-markBg:#264a8980;--ec-tm-markBrdCol:#5570b3d0;--ec-tm-insBg:#26561c80;--ec-tm-insBrdCol:#4e7e41d0;--ec-tm-insDiffIndCol:#7eb070d0;--ec-tm-delBg:#81322b80;--ec-tm-delBrdCol:#ae594fd0;--ec-tm-delDiffIndCol:#e68a7ed0;--ec-frm-shdCol:#0000005b;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #0000005b;--ec-frm-edActTabBg:#24292e;--ec-frm-edActTabFg:#e1e4e8;--ec-frm-edActTabBrdCol:transparent;--ec-frm-edActTabIndHt:1.5px;--ec-frm-edActTabIndTopCol:#f9826c;--ec-frm-edActTabIndBtmCol:#24292e;--ec-frm-edTabsMargInlStart:0;--ec-frm-edTabsMargBlkStart:0;--ec-frm-edTabBrdRad:0.3rem;--ec-frm-edTabBarBg:#1f2428;--ec-frm-edTabBarBrdCol:#1b1f23;--ec-frm-edTabBarBrdBtmCol:#1b1f23;--ec-frm-edBg:#24292e;--ec-frm-trmTtbFg:#e1e4e8;--ec-frm-trmTtbDotsFg:#e1e4e8;--ec-frm-trmTtbDotsOpa:0.15;--ec-frm-trmTtbBg:#24292e;--ec-frm-trmTtbBrdBtmCol:#1b1f23;--ec-frm-trmBg:#1f2428;--ec-frm-inlBtnFg:#e1e4e8;--ec-frm-inlBtnBg:#e1e4e8;--ec-frm-inlBtnBgIdleOpa:0;--ec-frm-inlBtnBgHoverOrFocusOpa:0.2;--ec-frm-inlBtnBgActOpa:0.3;--ec-frm-inlBtnBrd:#e1e4e8;--ec-frm-inlBtnBrdOpa:0.4;--ec-frm-tooltipSuccessBg:#228739;--ec-frm-tooltipSuccessFg:white;--ec-frm-copyIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2024%2024&apos;%20fill%3D&apos;none&apos;%20stroke%3D&apos;black&apos;%20stroke-width%3D&apos;1.75&apos;%3E%3Cpath%20d%3D&apos;M3%2019a2%202%200%200%201-1-2V2a2%202%200%200%201%201-1h13a2%202%200%200%201%202%201&apos;%2F%3E%3Crect%20x%3D&apos;6&apos;%20y%3D&apos;5&apos;%20width%3D&apos;16&apos;%20height%3D&apos;18&apos;%20rx%3D&apos;1.5&apos;%20ry%3D&apos;1.5&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-frm-trmIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2060%2016&apos;%20preserveAspectRatio%3D&apos;xMidYMid%20meet&apos;%3E%3Ccircle%20cx%3D&apos;8&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;30&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;52&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-lineNumbers-fg:inherit;--ec-lineNumbers-hlFg:inherit;--ec-cs-closedBrdWd:0px;--ec-cs-closedPadBlk:4px;--ec-cs-closedMarg:0;--ec-cs-closedFontFml:inherit;--ec-cs-closedFontSize:inherit;--ec-cs-closedLineHt:inherit;--ec-cs-closedTextCol:#e1e4e8;--ec-cs-closedBgCol:#58606933;--ec-cs-closedBrdCol:#58606980;--ec-cs-openBrdWd:1px;--ec-cs-openPad:0;--ec-cs-openMarg:0;--ec-cs-openBgCol:transparent;--ec-cs-openBgColCollapsible:#5860691a;--ec-cs-openBrdCol:transparent;--ec-cs-expandIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;m8.177.677%202.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25a.75.75%200%200%201-1.5%200V4H5.104a.25.25%200%200%201-.177-.427L7.823.677a.25.25%200%200%201%20.354%200ZM7.25%2010.75a.75.75%200%200%201%201.5%200V12h2.146a.25.25%200%200%201%20.177.427l-2.896%202.896a.25.25%200%200%201-.354%200l-2.896-2.896A.25.25%200%200%201%205.104%2012H7.25v-1.25Zm-5-2a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-cs-collapseIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;M10.896%202H8.75V.75a.75.75%200%200%200-1.5%200V2H5.104a.25.25%200%200%200-.177.427l2.896%202.896a.25.25%200%200%200%20.354%200l2.896-2.896A.25.25%200%200%200%2010.896%202ZM8.75%2015.25a.75.75%200%200%201-1.5%200V14H5.104a.25.25%200%200%201-.177-.427l2.896-2.896a.25.25%200%200%201%20.354%200l2.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25Zm-6.5-6.5a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;)}.expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])),:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--0, inherit);background-color:var(--0bg, transparent);font-style:var(--0fs, inherit);font-weight:var(--0fw, inherit);text-decoration:var(--0td, inherit)}@media (prefers-color-scheme: light){:root:not([data-theme=&quot;dark&quot;]){--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root:not([data-theme=&quot;dark&quot;]) .expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]),.expressive-code[data-theme=&quot;light&quot;]{--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]) .ec-line :where(span[style^=&apos;--&apos;]:not([class])),.expressive-code[data-theme=&quot;light&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}&lt;/style&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function a(e){if(!e)return;let t=e.getAttribute(&quot;tabindex&quot;)!==null,r=e.scrollWidth&gt;e.clientWidth;r&amp;&amp;!t?(e.setAttribute(&quot;tabindex&quot;,&quot;0&quot;),e.setAttribute(&quot;role&quot;,&quot;region&quot;)):!r&amp;&amp;t&amp;&amp;(e.removeAttribute(&quot;tabindex&quot;),e.removeAttribute(&quot;role&quot;))}var u=window.requestIdleCallback||(e=&gt;setTimeout(e,1)),s=window.cancelIdleCallback||clearTimeout;function l(e){let t=new Set,r,n;return new ResizeObserver(c=&gt;{c.forEach(o=&gt;t.add(o.target)),r&amp;&amp;clearTimeout(r),n&amp;&amp;s(n),r=setTimeout(()=&gt;{n&amp;&amp;s(n),n=u(()=&gt;{t.forEach(o=&gt;e(o)),t.clear()})},250)})}function i(e,t){e.querySelectorAll?.(&quot;.expressive-code pre &gt; code&quot;).forEach(r=&gt;{let n=r.parentElement;n&amp;&amp;t.observe(n)})}var d=l(a);i(document,d);var b=new MutationObserver(e=&gt;e.forEach(t=&gt;t.addedNodes.forEach(r=&gt;{i(r,d)})));b.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document,d)});})();}catch(e){console.error(&quot;[EC] tabindex-js-module failed:&quot;,e)}&lt;/script&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function l(o){let e=document.createElement(&quot;pre&quot;);Object.assign(e.style,{opacity:&quot;0&quot;,pointerEvents:&quot;none&quot;,position:&quot;absolute&quot;,overflow:&quot;hidden&quot;,left:&quot;0&quot;,top:&quot;0&quot;,width:&quot;20px&quot;,height:&quot;20px&quot;,webkitUserSelect:&quot;auto&quot;,userSelect:&quot;all&quot;}),e.ariaHidden=&quot;true&quot;,e.textContent=o,document.body.appendChild(e);let a=document.createRange();a.selectNode(e);let n=getSelection();if(!n)return!1;n.removeAllRanges(),n.addRange(a);let r=!1;try{r=document.execCommand(&quot;copy&quot;)}finally{n.removeAllRanges(),document.body.removeChild(e)}return r}async function u(o){let e=o.currentTarget,a=e.dataset,n=!1,r=a.code.replace(/\u007f/g,`
`);try{await navigator.clipboard.writeText(r),n=!0}catch{n=l(r)}if(!n||e.parentNode?.querySelector(&quot;.feedback&quot;))return;let c=e.parentNode?.querySelector(&quot;[aria-live]&quot;),t=document.createElement(&quot;div&quot;);t.classList.add(&quot;feedback&quot;),t.append(a.copied),c.append(t),t.offsetWidth,requestAnimationFrame(()=&gt;t?.classList.add(&quot;show&quot;));let s=()=&gt;!t||t.classList.remove(&quot;show&quot;),d=()=&gt;{!t||parseFloat(getComputedStyle(t).opacity)&gt;0||(t.remove(),t=void 0)};setTimeout(s,1500),setTimeout(d,2500),e.addEventListener(&quot;blur&quot;,s),t.addEventListener(&quot;transitioncancel&quot;,d),t.addEventListener(&quot;transitionend&quot;,d)}function i(o){o.querySelectorAll?.(&quot;.expressive-code .copy button&quot;).forEach(e=&gt;e.addEventListener(&quot;click&quot;,u))}i(document);var m=new MutationObserver(o=&gt;o.forEach(e=&gt;e.addedNodes.forEach(a=&gt;{i(a)})));m.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document)});})();}catch(e){console.error(&quot;[EC] copy-js-module failed:&quot;,e)}&lt;/script&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;json&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;2&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;3&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;&quot;variable_1&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;some text&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;4&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;5&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;{  &amp;#x22;data&amp;#x22;: {    &amp;#x22;variable_1&amp;#x22;: &amp;#x22;some text&amp;#x22;  }}&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;其中 variable_1 這個鍵會動態改變，你無法只用 data.title 就單純解碼資料。如果下次變成 data.description 呢？&lt;/p&gt;
&lt;h4 id=&quot;在-javascript-中我們可以輕鬆做到這件事&quot;&gt;在 JavaScript 中，我們可以輕鬆做到這件事：&lt;/h4&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;javascript&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; dynamicKey &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&apos;variable&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;2&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;json&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;JSON&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#B392F0;--1:#6F42C1&quot;&gt;parse&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(JSONObejct)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;3&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;console.&lt;/span&gt;&lt;span style=&quot;--0:#B392F0;--1:#6F42C1&quot;&gt;log&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(json.data[&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;`${&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;dynamicKey&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;}_1`&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;])&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;let dynamicKey = &amp;#x27;variable&amp;#x27;const json = JSON.parse(JSONObejct)console.log(json.data[&amp;#x60;${dynamicKey}_1&amp;#x60;])&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;你只要把動態字串放進 data 後面的 [] 中，就能存取該值。然而，在 Swift 中你無法這麼做。&lt;/p&gt;
&lt;p&gt;這就是 SwiftyJSON 派上用場的原因。&lt;/p&gt;
&lt;h2 id=&quot;使用-swiftyjson-解析-json&quot;&gt;使用 SwiftyJSON 解析 JSON&lt;/h2&gt;
&lt;p&gt;有了 SwiftyJSON 的幫助，你可以這麼做：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;swift&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; json &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;JSON&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;data&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: JSONObejct)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;2&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; dynamicVar &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;variable_1&quot;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;3&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; extracted &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; json[&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;\(dynamicVar)&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;].string { &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// It&apos;s wrapped with Optional automatically&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;4&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;//Now you got your value inside data.variable_1, just change your variable value for dynamicVar as needed.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;5&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;print&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(extracted) &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// some text&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;6&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;let json = JSON(data: JSONObejct)let dynamicVar = &amp;#x22;variable_1&amp;#x22;if let extracted = json[0][&amp;#x22;data&amp;#x22;][&amp;#x22;\(dynamicVar)&amp;#x22;].string { // It&amp;#x27;s wrapped with Optional automatically  //Now you got your value inside data.variable_1, just change your variable value for dynamicVar as needed.  print(extracted) // some text}&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;這和你在 JavaScript 中的做法幾乎一模一樣。&lt;/p&gt;
&lt;p&gt;直接又簡單。&lt;/p&gt;
&lt;h2 id=&quot;結語&quot;&gt;結語&lt;/h2&gt;
&lt;p&gt;儘管這個函式庫仍然可用，但它已不再維護。最後一次提交是在兩年前。&lt;/p&gt;
&lt;p&gt;不過我還是會繼續在專案中使用它，因為它為我省下大量時間與麻煩。&lt;/p&gt;
&lt;p&gt;處理 JSON 時幾乎可說是必備的函式庫。&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/6642e0c4-c790-436c-ad0d-720c8ddfa54f"/><enclosure url="https://cms.hongct.com/assets/6642e0c4-c790-436c-ad0d-720c8ddfa54f" length="32728" type="image/png"/></item><item><title>使用 SwiftUI 為 iOS 新增 AdMob GDPR 同意訊息</title><link>https://hongcheung.com/tw/post/Adding-AdMob-GDPR-Consent-Message-for-iOS-Using-SwiftUI/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/Adding-AdMob-GDPR-Consent-Message-for-iOS-Using-SwiftUI/</guid><description>一份簡單的指南，說明如何使用 SwiftUI 為 EEA 使用者新增 GDPR 同意表單。</description><pubDate>Thu, 18 Jan 2024 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/755d740d-459a-4f2c-b911-8599ad293c8c&quot; alt=&quot;使用 SwiftUI 為 iOS 新增 AdMob GDPR 同意訊息&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;為什麼&quot;&gt;為什麼？&lt;/h2&gt;
&lt;p&gt;由於 EEA 規定必須向歐洲使用者顯示廣告，自 2024 年 1 月 16 日起，我們現在必須在 App 中加入 GDPR 同意訊息。&lt;/p&gt;
&lt;p&gt;如果我們不這麼做，廣告收益將會受到很大的影響。&lt;/p&gt;
&lt;h2 id=&quot;怎麼做&quot;&gt;怎麼做？&lt;/h2&gt;
&lt;p&gt;你可以觀看 Google AdMob 的這支官方影片，了解如何實作。&lt;/p&gt;
&lt;figure style=&quot;width: 600px; max-width: 100%; margin: auto; padding:3px; border-radius:0.5rem;&quot;&gt;
  &lt;lite-youtube style=&quot;border-radius: 1rem; &quot; videoid=&quot;EwcrESnAYEI&quot; params=&quot;start=0&quot;&gt;
  &lt;figcaption style=&quot;opacity: 0.6; padding: 5px;&quot;&gt; 示範如何使用 User Messaging Platform (UMP) SDK 收集使用者對 GDPR 的同意之官方影片 &lt;/figcaption&gt;
&lt;/lite-youtube&gt;&lt;/figure&gt;
&lt;p&gt;不過，一如往常，Google 的文件只示範了用 UIKit 加入的方式，而沒有 SwiftUI 的作法。&lt;/p&gt;
&lt;h2 id=&quot;swiftui-範例&quot;&gt;SwiftUI 範例&lt;/h2&gt;
&lt;p&gt;經過一天的摸索，我終於用純 SwiftUI 讓它成功運作。&lt;/p&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/98c5d852-034c-4bad-bb42-c487ab3ee976&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;其實相當簡單：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;style&gt;.expressive-code{font-family:var(--ec-uiFontFml);font-size:var(--ec-uiFontSize);font-weight:var(--ec-uiFontWg);line-height:var(--ec-uiLineHt);text-size-adjust:none;-webkit-text-size-adjust:none}.expressive-code *:not(:is(svg, svg *)){all:revert;box-sizing:border-box}.expressive-code pre{display:flex;margin:0;padding:0;border:var(--ec-brdWd) solid var(--ec-brdCol);border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));background:var(--ec-codeBg)}.expressive-code pre:focus-visible{outline:3px solid var(--ec-focusBrd);outline-offset:-3px}.expressive-code pre &gt; code{all:unset;display:block;flex:1 0 100%;padding:var(--ec-codePadBlk) 0;color:var(--ec-codeFg);font-family:var(--ec-codeFontFml);font-size:var(--ec-codeFontSize);font-weight:var(--ec-codeFontWg);line-height:var(--ec-codeLineHt)}.expressive-code pre{overflow-x:auto}.expressive-code pre.wrap .ec-line .code{white-space:pre-wrap;overflow-wrap:break-word;min-width:min(20ch, var(--ecMaxLine, 20ch))}.expressive-code pre.wrap .ec-line .code span.indent{white-space:pre}.expressive-code pre::-webkit-scrollbar,.expressive-code pre::-webkit-scrollbar-track{background-color:inherit;border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));border-top-left-radius:0;border-top-right-radius:0}.expressive-code pre::-webkit-scrollbar-thumb{background-color:var(--ec-sbThumbCol);border:4px solid transparent;background-clip:content-box;border-radius:10px}.expressive-code pre::-webkit-scrollbar-thumb:hover{background-color:var(--ec-sbThumbHoverCol)}.expressive-code pre::-webkit-scrollbar-corner{background:transparent}.expressive-code .ec-line{direction:ltr;unicode-bidi:isolate;display:grid;grid-template-areas:&apos;gutter code&apos;;grid-template-columns:auto 1fr;position:relative}.expressive-code .ec-line .gutter{grid-area:gutter;color:var(--ec-gtrFg)}.expressive-code .ec-line .gutter &gt; *{pointer-events:none;user-select:none;-webkit-user-select:none}.expressive-code .ec-line .gutter ~ .code{--ecLineBrdCol:var(--ec-gtrBrdCol)}.expressive-code .ec-line.highlight .gutter{color:var(--ec-gtrHlFg)}.expressive-code .ec-line .code{grid-area:code;position:relative;box-sizing:content-box;padding-inline-start:calc(var(--ecIndent, 0ch) + var(--ec-codePadInl) - var(--ecGtrBrdWd));padding-inline-end:var(--ec-codePadInl);text-indent:calc(var(--ecIndent, 0ch) * -1)}.expressive-code .ec-line .code::before,.expressive-code .ec-line .code::after,.expressive-code .ec-line .code :where(*){text-indent:0}.expressive-code .ec-line .code{--ecGtrBrdWd:var(--ec-gtrBrdWd);border-inline-start:var(--ecGtrBrdWd) solid var(--ecLineBrdCol, transparent)}.expressive-code .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.expressive-code .ec-line.mark{--tmLineBgCol:var(--ec-tm-markBg)}.expressive-code .ec-line.mark .code{--ecLineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line.ins{--tmLineBgCol:var(--ec-tm-insBg);--tmLabel:var(--ec-tm-insDiffIndContent)}.expressive-code .ec-line.ins .code{--ecLineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line.ins .code::before{color:var(--ec-tm-insDiffIndCol)}.expressive-code .ec-line.del{--tmLineBgCol:var(--ec-tm-delBg);--tmLabel:var(--ec-tm-delDiffIndContent)}.expressive-code .ec-line.del .code{--ecLineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line.del .code::before{color:var(--ec-tm-delDiffIndCol)}.expressive-code .ec-line.mark,.expressive-code .ec-line.ins,.expressive-code .ec-line.del{background:var(--tmLineBgCol)}.expressive-code .ec-line.mark .code,.expressive-code .ec-line.ins .code,.expressive-code .ec-line.del .code{--ecGtrBrdWd:var(--ec-tm-lineMarkerAccentWd)}.expressive-code .ec-line.mark .code::before,.expressive-code .ec-line.ins .code::before,.expressive-code .ec-line.del .code::before{display:block;position:absolute;left:0;box-sizing:border-box;content:var(--tmLabel, &apos; &apos;);padding-inline-start:var(--ec-tm-lineDiffIndMargLeft);text-align:center;white-space:pre}.expressive-code .ec-line.mark.tm-label .code::before,.expressive-code .ec-line.ins.tm-label .code::before,.expressive-code .ec-line.del.tm-label .code::before{background:var(--ecLineBrdCol);padding:0 calc(var(--ec-tm-lineMarkerLabelPadInl) + var(--ec-tm-lineMarkerAccentWd)) 0 var(--ec-tm-lineMarkerLabelPadInl);color:var(--ec-tm-lineMarkerLabelCol)}.expressive-code .ec-line mark{--tmInlineBgCol:var(--ec-tm-markBg);--tmInlineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line ins{--tmInlineBgCol:var(--ec-tm-insBg);--tmInlineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line del{--tmInlineBgCol:var(--ec-tm-delBg);--tmInlineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line mark,.expressive-code .ec-line ins,.expressive-code .ec-line del{all:unset;display:inline-block;position:relative;--tmBrdL:var(--ec-tm-inlMarkerBrdWd);--tmBrdR:var(--ec-tm-inlMarkerBrdWd);--tmRadL:var(--ec-tm-inlMarkerBrdRad);--tmRadR:var(--ec-tm-inlMarkerBrdRad);margin-inline:0.025rem;padding-inline:var(--ec-tm-inlMarkerPad);border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);background:var(--tmInlineBgCol);background-clip:padding-box}.expressive-code .ec-line mark.open-start,.expressive-code .ec-line ins.open-start,.expressive-code .ec-line del.open-start{margin-inline-start:0;padding-inline-start:0;--tmBrdL:0px;--tmRadL:0}.expressive-code .ec-line mark.open-end,.expressive-code .ec-line ins.open-end,.expressive-code .ec-line del.open-end{margin-inline-end:0;padding-inline-end:0;--tmBrdR:0px;--tmRadR:0}.expressive-code .ec-line mark::before,.expressive-code .ec-line ins::before,.expressive-code .ec-line del::before{content:&apos;&apos;;position:absolute;pointer-events:none;display:inline-block;inset:0;border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);border:var(--ec-tm-inlMarkerBrdWd) solid var(--tmInlineBrdCol);border-inline-width:var(--tmBrdL) var(--tmBrdR)}.expressive-code .frame{all:unset;position:relative;display:block;--header-border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));--tab-border-radius:calc(var(--ec-frm-edTabBrdRad) + var(--ec-brdWd));--button-spacing:0.4rem;--code-background:var(--ec-frm-edBg);border-radius:var(--header-border-radius);box-shadow:var(--ec-frm-frameBoxShdCssVal)}.expressive-code .frame .header{display:none;z-index:1;position:relative;border-radius:var(--header-border-radius) var(--header-border-radius) 0 0}.expressive-code .frame.has-title pre,.expressive-code .frame.has-title code,.expressive-code .frame.is-terminal pre,.expressive-code .frame.is-terminal code{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.expressive-code .frame .title:empty:before{content:&apos;\a0&apos;}.expressive-code .frame.has-title:not(.is-terminal){--button-spacing:calc(1.9rem + 2 * (var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)))}.expressive-code .frame.has-title:not(.is-terminal) .title{position:relative;color:var(--ec-frm-edActTabFg);background:var(--ec-frm-edActTabBg);background-clip:padding-box;margin-block-start:var(--ec-frm-edTabsMargBlkStart);padding:calc(var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)) var(--ec-uiPadInl);border:var(--ec-brdWd) solid var(--ec-frm-edActTabBrdCol);border-radius:var(--tab-border-radius) var(--tab-border-radius) 0 0;border-bottom:none;overflow:hidden}.expressive-code .frame.has-title:not(.is-terminal) .title::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-top:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndTopCol);border-bottom:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndBtmCol)}.expressive-code .frame.has-title:not(.is-terminal) .header{display:flex;background:linear-gradient(to top, var(--ec-frm-edTabBarBrdBtmCol) var(--ec-brdWd), transparent var(--ec-brdWd)),linear-gradient(var(--ec-frm-edTabBarBg), var(--ec-frm-edTabBarBg));background-repeat:no-repeat;padding-inline-start:var(--ec-frm-edTabsMargInlStart)}.expressive-code .frame.has-title:not(.is-terminal) .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border:var(--ec-brdWd) solid var(--ec-frm-edTabBarBrdCol);border-radius:inherit;border-bottom:none}.expressive-code .frame.is-terminal{--button-spacing:calc(1.9rem + var(--ec-brdWd) + 2 * var(--ec-uiPadBlk));--code-background:var(--ec-frm-trmBg)}.expressive-code .frame.is-terminal .header{display:flex;align-items:center;justify-content:center;padding-block:var(--ec-uiPadBlk);padding-block-end:calc(var(--ec-uiPadBlk) + var(--ec-brdWd));position:relative;font-weight:500;letter-spacing:0.025ch;color:var(--ec-frm-trmTtbFg);background:var(--ec-frm-trmTtbBg);border:var(--ec-brdWd) solid var(--ec-brdCol);border-bottom:none}.expressive-code .frame.is-terminal .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;left:var(--ec-uiPadInl);width:2.1rem;height:0.56rem;line-height:0;background-color:var(--ec-frm-trmTtbDotsFg);opacity:var(--ec-frm-trmTtbDotsOpa);-webkit-mask-image:var(--ec-frm-trmIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-trmIcon);mask-repeat:no-repeat}.expressive-code .frame.is-terminal .header::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-bottom:var(--ec-brdWd) solid var(--ec-frm-trmTtbBrdBtmCol)}.expressive-code .frame pre{background:var(--code-background)}.expressive-code .copy{display:flex;gap:0.25rem;flex-direction:row;position:absolute;inset-block-start:calc(var(--ec-brdWd) + var(--button-spacing));inset-inline-end:calc(var(--ec-brdWd) + var(--ec-uiPadInl) / 2)}@media (scripting: none){.expressive-code .copy{display:none}}.expressive-code .copy{direction:ltr;unicode-bidi:isolate}.expressive-code .copy button{position:relative;align-self:flex-end;margin:0;padding:0;border:none;border-radius:0.2rem;z-index:1;cursor:pointer;transition-property:opacity, background, border-color;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.25, 0.46, 0.45, 0.94);width:2.5rem;height:2.5rem;background:var(--code-background);opacity:0.75}.expressive-code .copy button div{position:absolute;inset:0;border-radius:inherit;background:var(--ec-frm-inlBtnBg);opacity:var(--ec-frm-inlBtnBgIdleOpa);transition-property:inherit;transition-duration:inherit;transition-timing-function:inherit}.expressive-code .copy button::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-radius:inherit;border:var(--ec-brdWd) solid var(--ec-frm-inlBtnBrd);opacity:var(--ec-frm-inlBtnBrdOpa)}.expressive-code .copy button::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-frm-inlBtnFg);-webkit-mask-image:var(--ec-frm-copyIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-copyIcon);mask-repeat:no-repeat;margin:0.475rem;line-height:0}.expressive-code .copy button:hover,.expressive-code .copy button:focus:focus-visible{opacity:1}.expressive-code .copy button:hover div,.expressive-code .copy button:focus:focus-visible div{opacity:var(--ec-frm-inlBtnBgHoverOrFocusOpa)}.expressive-code .copy button:active{opacity:1}.expressive-code .copy button:active div{opacity:var(--ec-frm-inlBtnBgActOpa)}.expressive-code .copy .feedback{--tooltip-arrow-size:0.35rem;--tooltip-bg:var(--ec-frm-tooltipSuccessBg);color:var(--ec-frm-tooltipSuccessFg);pointer-events:none;user-select:none;-webkit-user-select:none;position:relative;align-self:center;background-color:var(--tooltip-bg);z-index:99;padding:0.125rem 0.75rem;border-radius:0.2rem;margin-inline-end:var(--tooltip-arrow-size);opacity:0;transition-property:opacity, transform;transition-duration:0.2s;transition-timing-function:ease-in-out;transform:translate3d(0, 0.25rem, 0)}.expressive-code .copy .feedback::after{content:&apos;&apos;;position:absolute;pointer-events:none;top:calc(50% - var(--tooltip-arrow-size));inset-inline-end:calc(-2 * (var(--tooltip-arrow-size) - 0.5px));border:var(--tooltip-arrow-size) solid transparent;border-inline-start-color:var(--tooltip-bg)}.expressive-code .copy .feedback.show{opacity:1;transform:translate3d(0, 0, 0)}@media (hover: hover){.expressive-code{}.expressive-code .copy button{opacity:0;width:2rem;height:2rem}.expressive-code .frame:hover .copy button:not(:hover),.expressive-code .frame:focus-within :focus-visible ~ .copy button:not(:hover),.expressive-code .frame .copy .feedback.show ~ button:not(:hover){opacity:0.75}}.expressive-code :nth-child(1 of .ec-line) .code{padding-inline-end:calc(2rem + var(--ec-codePadInl))}.expressive-code .gutter .ln{display:inline-flex;justify-content:flex-end;align-items:flex-start;box-sizing:content-box;min-width:var(--lnWidth, 2ch);padding-inline:2ch;color:var(--ec-lineNumbers-fg)}.highlight .expressive-code .gutter .ln{color:var(--ec-lineNumbers-hlFg)}.expressive-code .ec-section{position:relative}.expressive-code .ec-section summary{position:relative;font-family:var(--ec-cs-closedFontFml);font-size:var(--ec-cs-closedFontSize);line-height:var(--ec-cs-closedLineHt);user-select:none;-webkit-user-select:none;cursor:pointer;color:var(--ec-cs-closedTextCol);background-color:var(--ec-cs-closedBgCol);--border-color:var(--ec-cs-closedBrdCol);--border-width:var(--ec-cs-closedBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);margin:var(--ec-cs-closedMarg);padding:0}.expressive-code .ec-section summary::marker{display:inline-block;content:&quot;&quot;;width:16px;height:16px}.expressive-code .ec-section summary::-webkit-details-marker{display:none}.expressive-code .ec-section summary :is(.expand, .collapse){position:relative;display:inline-block;width:16px;height:16px;vertical-align:text-bottom;opacity:0.75}.expressive-code .ec-section summary :is(.expand, .collapse)::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-cs-closedTextCol);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;line-height:0}.expressive-code .ec-section summary .expand::after{-webkit-mask-image:var(--ec-cs-expandIcon);mask-image:var(--ec-cs-expandIcon);-webkit-print-color-adjust:exact;print-color-adjust:exact}.expressive-code .ec-section summary .collapse{display:none}.expressive-code .ec-section summary .collapse::after{-webkit-mask-image:var(--ec-cs-collapseIcon);mask-image:var(--ec-cs-collapseIcon)}.expressive-code .ec-section summary .text{margin-left:1em}.expressive-code .ec-section summary .ec-line .code{padding-block:var(--ec-cs-closedPadBlk);text-indent:0}.expressive-code .ec-section[open],.expressive-code .ec-section details[open] + .content-lines{--border-color:var(--ec-cs-openBrdCol);--border-width:var(--ec-cs-openBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);padding-inline:var(--ec-cs-openPad);margin-inline:var(--ec-cs-openMarg)}.expressive-code .ec-section.github[open] summary{display:none}.expressive-code .ec-section.github[open]{background-color:var(--ec-cs-openBgCol)}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end){display:flex;flex-direction:column}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) .content-lines{display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] .collapse{display:inline-block}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] :is(.expand, .text){display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] + .content-lines{display:block;background-color:var(--ec-cs-openBgColCollapsible)}@media print{.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open]{display:none}}.expressive-code .ec-section.collapsible-end{flex-direction:column-reverse}:root,:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;]{--ec-brdRad:0.3rem;--ec-brdWd:1.5px;--ec-brdCol:#1b1f23;--ec-codeFontFml:jetbrains-mono;--ec-codeFontSize:0.85rem;--ec-codeFontWg:400;--ec-codeLineHt:1.65;--ec-codePadBlk:1rem;--ec-codePadInl:1.35rem;--ec-codeBg:#24292e;--ec-codeFg:#e1e4e8;--ec-codeSelBg:#3392ff44;--ec-gtrFg:#727980;--ec-gtrBrdCol:#72798033;--ec-gtrBrdWd:1.5px;--ec-gtrHlFg:#e1e4e896;--ec-uiFontFml:jetbrains-mono;--ec-uiFontSize:0.9rem;--ec-uiFontWg:400;--ec-uiLineHt:1.65;--ec-uiPadBlk:0.25rem;--ec-uiPadInl:1rem;--ec-uiSelBg:#39414a;--ec-uiSelFg:#e1e4e8;--ec-focusBrd:#005cc5;--ec-sbThumbCol:#6a737d33;--ec-sbThumbHoverCol:#6a737dd1;--ec-tm-lineMarkerAccentMarg:0rem;--ec-tm-lineMarkerAccentWd:0.15rem;--ec-tm-lineMarkerLabelPadInl:0.2rem;--ec-tm-lineMarkerLabelCol:white;--ec-tm-lineDiffIndMargLeft:0.3rem;--ec-tm-inlMarkerBrdWd:1.5px;--ec-tm-inlMarkerBrdRad:0.2rem;--ec-tm-inlMarkerPad:0.15rem;--ec-tm-insDiffIndContent:&apos;+&apos;;--ec-tm-delDiffIndContent:&apos;-&apos;;--ec-tm-markBg:#264a8980;--ec-tm-markBrdCol:#5570b3d0;--ec-tm-insBg:#26561c80;--ec-tm-insBrdCol:#4e7e41d0;--ec-tm-insDiffIndCol:#7eb070d0;--ec-tm-delBg:#81322b80;--ec-tm-delBrdCol:#ae594fd0;--ec-tm-delDiffIndCol:#e68a7ed0;--ec-frm-shdCol:#0000005b;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #0000005b;--ec-frm-edActTabBg:#24292e;--ec-frm-edActTabFg:#e1e4e8;--ec-frm-edActTabBrdCol:transparent;--ec-frm-edActTabIndHt:1.5px;--ec-frm-edActTabIndTopCol:#f9826c;--ec-frm-edActTabIndBtmCol:#24292e;--ec-frm-edTabsMargInlStart:0;--ec-frm-edTabsMargBlkStart:0;--ec-frm-edTabBrdRad:0.3rem;--ec-frm-edTabBarBg:#1f2428;--ec-frm-edTabBarBrdCol:#1b1f23;--ec-frm-edTabBarBrdBtmCol:#1b1f23;--ec-frm-edBg:#24292e;--ec-frm-trmTtbFg:#e1e4e8;--ec-frm-trmTtbDotsFg:#e1e4e8;--ec-frm-trmTtbDotsOpa:0.15;--ec-frm-trmTtbBg:#24292e;--ec-frm-trmTtbBrdBtmCol:#1b1f23;--ec-frm-trmBg:#1f2428;--ec-frm-inlBtnFg:#e1e4e8;--ec-frm-inlBtnBg:#e1e4e8;--ec-frm-inlBtnBgIdleOpa:0;--ec-frm-inlBtnBgHoverOrFocusOpa:0.2;--ec-frm-inlBtnBgActOpa:0.3;--ec-frm-inlBtnBrd:#e1e4e8;--ec-frm-inlBtnBrdOpa:0.4;--ec-frm-tooltipSuccessBg:#228739;--ec-frm-tooltipSuccessFg:white;--ec-frm-copyIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2024%2024&apos;%20fill%3D&apos;none&apos;%20stroke%3D&apos;black&apos;%20stroke-width%3D&apos;1.75&apos;%3E%3Cpath%20d%3D&apos;M3%2019a2%202%200%200%201-1-2V2a2%202%200%200%201%201-1h13a2%202%200%200%201%202%201&apos;%2F%3E%3Crect%20x%3D&apos;6&apos;%20y%3D&apos;5&apos;%20width%3D&apos;16&apos;%20height%3D&apos;18&apos;%20rx%3D&apos;1.5&apos;%20ry%3D&apos;1.5&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-frm-trmIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2060%2016&apos;%20preserveAspectRatio%3D&apos;xMidYMid%20meet&apos;%3E%3Ccircle%20cx%3D&apos;8&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;30&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;52&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-lineNumbers-fg:inherit;--ec-lineNumbers-hlFg:inherit;--ec-cs-closedBrdWd:0px;--ec-cs-closedPadBlk:4px;--ec-cs-closedMarg:0;--ec-cs-closedFontFml:inherit;--ec-cs-closedFontSize:inherit;--ec-cs-closedLineHt:inherit;--ec-cs-closedTextCol:#e1e4e8;--ec-cs-closedBgCol:#58606933;--ec-cs-closedBrdCol:#58606980;--ec-cs-openBrdWd:1px;--ec-cs-openPad:0;--ec-cs-openMarg:0;--ec-cs-openBgCol:transparent;--ec-cs-openBgColCollapsible:#5860691a;--ec-cs-openBrdCol:transparent;--ec-cs-expandIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;m8.177.677%202.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25a.75.75%200%200%201-1.5%200V4H5.104a.25.25%200%200%201-.177-.427L7.823.677a.25.25%200%200%201%20.354%200ZM7.25%2010.75a.75.75%200%200%201%201.5%200V12h2.146a.25.25%200%200%201%20.177.427l-2.896%202.896a.25.25%200%200%201-.354%200l-2.896-2.896A.25.25%200%200%201%205.104%2012H7.25v-1.25Zm-5-2a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-cs-collapseIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;M10.896%202H8.75V.75a.75.75%200%200%200-1.5%200V2H5.104a.25.25%200%200%200-.177.427l2.896%202.896a.25.25%200%200%200%20.354%200l2.896-2.896A.25.25%200%200%200%2010.896%202ZM8.75%2015.25a.75.75%200%200%201-1.5%200V14H5.104a.25.25%200%200%201-.177-.427l2.896-2.896a.25.25%200%200%201%20.354%200l2.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25Zm-6.5-6.5a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;)}.expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])),:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--0, inherit);background-color:var(--0bg, transparent);font-style:var(--0fs, inherit);font-weight:var(--0fw, inherit);text-decoration:var(--0td, inherit)}@media (prefers-color-scheme: light){:root:not([data-theme=&quot;dark&quot;]){--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root:not([data-theme=&quot;dark&quot;]) .expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]),.expressive-code[data-theme=&quot;light&quot;]{--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]) .ec-line :where(span[style^=&apos;--&apos;]:not([class])),.expressive-code[data-theme=&quot;light&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}&lt;/style&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function a(e){if(!e)return;let t=e.getAttribute(&quot;tabindex&quot;)!==null,r=e.scrollWidth&gt;e.clientWidth;r&amp;&amp;!t?(e.setAttribute(&quot;tabindex&quot;,&quot;0&quot;),e.setAttribute(&quot;role&quot;,&quot;region&quot;)):!r&amp;&amp;t&amp;&amp;(e.removeAttribute(&quot;tabindex&quot;),e.removeAttribute(&quot;role&quot;))}var u=window.requestIdleCallback||(e=&gt;setTimeout(e,1)),s=window.cancelIdleCallback||clearTimeout;function l(e){let t=new Set,r,n;return new ResizeObserver(c=&gt;{c.forEach(o=&gt;t.add(o.target)),r&amp;&amp;clearTimeout(r),n&amp;&amp;s(n),r=setTimeout(()=&gt;{n&amp;&amp;s(n),n=u(()=&gt;{t.forEach(o=&gt;e(o)),t.clear()})},250)})}function i(e,t){e.querySelectorAll?.(&quot;.expressive-code pre &gt; code&quot;).forEach(r=&gt;{let n=r.parentElement;n&amp;&amp;t.observe(n)})}var d=l(a);i(document,d);var b=new MutationObserver(e=&gt;e.forEach(t=&gt;t.addedNodes.forEach(r=&gt;{i(r,d)})));b.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document,d)});})();}catch(e){console.error(&quot;[EC] tabindex-js-module failed:&quot;,e)}&lt;/script&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function l(o){let e=document.createElement(&quot;pre&quot;);Object.assign(e.style,{opacity:&quot;0&quot;,pointerEvents:&quot;none&quot;,position:&quot;absolute&quot;,overflow:&quot;hidden&quot;,left:&quot;0&quot;,top:&quot;0&quot;,width:&quot;20px&quot;,height:&quot;20px&quot;,webkitUserSelect:&quot;auto&quot;,userSelect:&quot;all&quot;}),e.ariaHidden=&quot;true&quot;,e.textContent=o,document.body.appendChild(e);let a=document.createRange();a.selectNode(e);let n=getSelection();if(!n)return!1;n.removeAllRanges(),n.addRange(a);let r=!1;try{r=document.execCommand(&quot;copy&quot;)}finally{n.removeAllRanges(),document.body.removeChild(e)}return r}async function u(o){let e=o.currentTarget,a=e.dataset,n=!1,r=a.code.replace(/\u007f/g,`
`);try{await navigator.clipboard.writeText(r),n=!0}catch{n=l(r)}if(!n||e.parentNode?.querySelector(&quot;.feedback&quot;))return;let c=e.parentNode?.querySelector(&quot;[aria-live]&quot;),t=document.createElement(&quot;div&quot;);t.classList.add(&quot;feedback&quot;),t.append(a.copied),c.append(t),t.offsetWidth,requestAnimationFrame(()=&gt;t?.classList.add(&quot;show&quot;));let s=()=&gt;!t||t.classList.remove(&quot;show&quot;),d=()=&gt;{!t||parseFloat(getComputedStyle(t).opacity)&gt;0||(t.remove(),t=void 0)};setTimeout(s,1500),setTimeout(d,2500),e.addEventListener(&quot;blur&quot;,s),t.addEventListener(&quot;transitioncancel&quot;,d),t.addEventListener(&quot;transitionend&quot;,d)}function i(o){o.querySelectorAll?.(&quot;.expressive-code .copy button&quot;).forEach(e=&gt;e.addEventListener(&quot;click&quot;,u))}i(document);var m=new MutationObserver(o=&gt;o.forEach(e=&gt;e.addedNodes.forEach(a=&gt;{i(a)})));m.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document)});})();}catch(e){console.error(&quot;[EC] copy-js-module failed:&quot;,e)}&lt;/script&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;swift&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#B392F0;--1:#6F42C1&quot;&gt;SwiftUI&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;2&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#B392F0;--1:#6F42C1&quot;&gt;UserMessagingPlatform&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;3&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;4&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;struct&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#B392F0;--1:#6F42C1&quot;&gt;ContentView&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--0:#B392F0;--1:#6F42C1&quot;&gt;View &lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;5&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;@AppStorage&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;gdprConsentShown&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; gdprConsentShown &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;false&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;6&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;7&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; body: &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;some&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; View {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;8&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;VStack&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;9&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;10&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;onAppear&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;11&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;gdprConsentCheck&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;12&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;13&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;14&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;15&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;func&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#B392F0;--1:#6F42C1&quot;&gt;gdprConsentCheck&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;details class=&quot;ec-section github&quot;&gt;&lt;summary&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;expand&quot;&gt;&lt;/span&gt;&lt;span class=&quot;collapse&quot;&gt;&lt;/span&gt;&lt;span class=&quot;text&quot;&gt;55 collapsed lines&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/summary&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;16&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;guard&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;gdprConsentShown &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; }&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;17&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;18&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// Create a UMPRequestParameters object.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;19&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; parameters &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;UMPRequestParameters&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;20&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; debugSettings &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;UMPDebugSettings&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; ()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;21&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// - This is for mimicking EEA users when you&apos;re outside the EU.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;22&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// - Use a simulator so you can read the consent form.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;23&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;debugSettings.geography &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; .EEA&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;24&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;parameters.debugSettings &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; debugSettings&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;25&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;26&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// Set tag for under age of consent. false means users are not under the age of consent. If you turn this on, no consent form is presented.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;27&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;parameters.tagForUnderAgeOfConsent &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;false&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;28&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;29&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// Request an update for the consent information.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;30&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;UMPConsentInformation.sharedInstance.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;requestConsentInfoUpdate&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;with&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: parameters) { (requestConsentError) &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;in&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;31&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; consentError &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; requestConsentError {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;32&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// Consent gathering failed.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;33&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;print&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;Error: &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;\(consentError.&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;localizedDescription&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;34&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;35&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// Load and present the consent form.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;36&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;loadAndPresentConsentForm&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;37&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;38&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;39&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;40&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;func&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#B392F0;--1:#6F42C1&quot;&gt;loadAndPresentConsentForm&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;41&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;UMPConsentForm.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;load&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; { (form, loadError) &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;in&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;42&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; error &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; loadError {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;43&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// Consent form could not be loaded.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;44&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;print&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;Error: &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;\(error.&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;localizedDescription&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;45&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;46&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;47&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; form &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; form {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;48&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; windowScene &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; UIApplication.shared.connectedScenes.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;first&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;as?&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; UIWindowScene {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;49&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                    &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; window &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; windowScene.windows.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;first&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;50&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                        &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; rootViewController &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; window.rootViewController {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;51&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;                            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;form.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;present&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: rootViewController) { (dismissError) &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;in&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;52&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                                &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; error &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; dismissError {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;53&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                                    &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// Consent form could not be dismissed.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;54&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                                    &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;print&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;Error: &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;\(error.&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;localizedDescription&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;55&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;                                    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;gdprConsentShown &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;false&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;56&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;                                &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;} &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;57&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                                    &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// Consent form was dismissed.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;58&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                                    &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// Check the consent status.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;59&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                                    &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; status &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; UMPConsentInformation.sharedInstance.consentStatus&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;60&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                                    &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;print&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;Consent status: &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;\(status)&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;61&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;                                    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;gdprConsentShown &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;true&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;62&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;                                &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;63&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;                            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;64&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;                        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;65&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;66&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;67&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;68&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;69&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;70&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/details&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;import SwiftUIimport UserMessagingPlatformstruct ContentView: View {  @AppStorage(&amp;#x22;gdprConsentShown&amp;#x22;) var gdprConsentShown = false  var body: some View {      VStack {      }        .onAppear {          gdprConsentCheck()        }  }    func gdprConsentCheck() {        guard !gdprConsentShown else { return }        // Create a UMPRequestParameters object.        let parameters = UMPRequestParameters()        let debugSettings = UMPDebugSettings ()        // - This is for mimicking EEA users when you&amp;#x27;re outside the EU.        // - Use a simulator so you can read the consent form.        debugSettings.geography = .EEA        parameters.debugSettings = debugSettings        // Set tag for under age of consent. false means users are not under the age of consent. If you turn this on, no consent form is presented.        parameters.tagForUnderAgeOfConsent = false        // Request an update for the consent information.        UMPConsentInformation.sharedInstance.requestConsentInfoUpdate(with: parameters) { (requestConsentError) in            if let consentError = requestConsentError {                // Consent gathering failed.                return print(&amp;#x22;Error: \(consentError.localizedDescription)&amp;#x22;)            }            // Load and present the consent form.            loadAndPresentConsentForm()        }    }    func loadAndPresentConsentForm() {        UMPConsentForm.load { (form, loadError) in            if let error = loadError {                // Consent form could not be loaded.                return print(&amp;#x22;Error: \(error.localizedDescription)&amp;#x22;)            }            if let form = form {                if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {                    if let window = windowScene.windows.first {                        if let rootViewController = window.rootViewController {                            form.present(from: rootViewController) { (dismissError) in                                if let error = dismissError {                                    // Consent form could not be dismissed.                                    print(&amp;#x22;Error: \(error.localizedDescription)&amp;#x22;)                                    gdprConsentShown = false                                } else {                                    // Consent form was dismissed.                                    // Check the consent status.                                    let status = UMPConsentInformation.sharedInstance.consentStatus                                    print(&amp;#x22;Consent status: \(status)&amp;#x22;)                                    gdprConsentShown = true                                }                            }                        }                    }                }            }        }    }}&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;沒錯，那些 if let 看起來很醜，因為有一半是 ChatGPT 寫的，但你应该能理解概念。我修改過它，並把所有東西放進另一個 view。&lt;/p&gt;
&lt;p&gt;所以對我做的每個 App，我只要複製貼上那個 view 就好。以下是我會在主 view 中使用它的方式：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;swift&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;//for ads and consent form&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;2&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;@State&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; readyToShow &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;false&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;3&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;@State&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; bannerView: BannerView&lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;?&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;nil&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;4&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;/////&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;5&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;context&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;6&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;onAppear&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;7&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// create the banner onAppear, readyToShow is false by default&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;8&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;bannerView &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;BannerView&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;readyToShow&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: $readyToShow, &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;adUnitID&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;ca-app-pub-yourKeyHere&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;9&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// This performs the consent form logic inside the bannerView, if everything goes well, toggle readyToShow to true.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;10&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;bannerView&lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;?&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;gdprConsentCheck&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;11&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;12&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;toolbar&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;13&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;ToolbarItem&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;placement&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: .bottomBar) {&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;14&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// So only users who passed the consent form will see this banner ad.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;15&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;adRemoved &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;&amp;#x26;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; readyToShow{&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;details class=&quot;ec-section github&quot;&gt;&lt;summary&gt;&lt;div class=&quot;ec-line&quot; style=&quot;--ecIndent:8ch&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;expand&quot;&gt;&lt;/span&gt;&lt;span class=&quot;collapse&quot;&gt;&lt;/span&gt;&lt;span class=&quot;text&quot;&gt;6 collapsed lines&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/summary&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;16&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;bannerView&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;17&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;                        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;frame&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;width&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: GADAdSizeBanner.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;size&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;.width, &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;height&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: GADAdSizeBanner.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;size&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;.height)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;18&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;19&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;20&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;21&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/details&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;    //for ads and consent form    @State var readyToShow = false    @State private var bannerView: BannerView? = nil    /////    context        .onAppear() {            // create the banner onAppear, readyToShow is false by default            bannerView = BannerView(readyToShow: $readyToShow, adUnitID: &amp;#x22;ca-app-pub-yourKeyHere&amp;#x22;)            // This performs the consent form logic inside the bannerView, if everything goes well, toggle readyToShow to true.            bannerView?.gdprConsentCheck()        }        .toolbar {            ToolbarItem(placement: .bottomBar) {                // So only users who passed the consent form will see this banner ad.                if !adRemoved &amp;#x26;&amp;#x26; readyToShow{                    bannerView                        .frame(width: GADAdSizeBanner.size.width, height: GADAdSizeBanner.size.height)                }            }        }&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;h2 id=&quot;個人化廣告&quot;&gt;個人化廣告&lt;/h2&gt;
&lt;p&gt;為了控制是否顯示個人化廣告，我們以前會把廣告請求選項設定成類似這樣：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;swift&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#B392F0;--1:#6F42C1&quot;&gt;GoogleMobileAds&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;2&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;3&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; request &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;GADRequest&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;4&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;let&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; extras &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;GADExtras&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;()&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;5&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;extras.additionalParameters &lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;npa&quot;&lt;/span&gt;&lt;span style=&quot;--0:#F97583;--1:#BF3441&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;] &lt;/span&gt;&lt;span style=&quot;--0:#99A0A6;--1:#616972&quot;&gt;// This means no personalized ads are shown&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;6&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;request.&lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;register&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;(extras)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;import GoogleMobileAdslet request = GADRequest()let extras = GADExtras()extras.additionalParameters = [&amp;#x22;npa&amp;#x22;: &amp;#x22;1&amp;#x22;] // This means no personalized ads are shownrequest.register(extras)&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;請記住，為了符合 App Store 的規範，我們還是需要設定 ATT。&lt;/p&gt;
&lt;p&gt;不過，現在再與 Google AdMob 互動已經沒有意義了。這是因為當你使用 UserMessagingPlatform 時，Google 會在他們的平台上管理「個人化」。&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;「如果這對任何人還有幫助，在此確認使用 Android 的 UMP SDK 時，你不需要設定 npa=1。UMP SDK 會將 TCF 字串寫入 shared preferences（相關資訊請見 &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://support.google.com/admob/answer/9760862&quot;&gt;https://support.google.com/admob/answer/9760862&lt;/a&gt;），而 Google Mobile Ads SDK 會在廣告請求時讀取 TCF 字串。」—— Eric，Mobile Ads SDK 團隊 —— &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://groups.google.com/g/google-admob-ads-sdk/c/I6j0Pr-_ziY/m/Qf3pNezGBAAJ&quot; title=&quot;Google AdMob npa 1 usage&quot;&gt;閱讀更多&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;這是我在 Google AdMob 論壇上讀到的內容。&lt;/p&gt;
&lt;p&gt;雖然他們說這是針對 Android，但我假設在 iOS 上也是同樣的運作方式。&lt;/p&gt;
&lt;p&gt;不過，我們無論如何還是需要為 Apple 實作 ATT，所以我目前先保留它。&lt;/p&gt;
&lt;p&gt;希望這份指南能讓事情簡單一些，並對你有所幫助。&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/755d740d-459a-4f2c-b911-8599ad293c8c"/><enclosure url="https://cms.hongct.com/assets/755d740d-459a-4f2c-b911-8599ad293c8c" length="1134047" type="image/png"/></item><item><title>如何更新 Xcode - 3 種簡單方法</title><link>https://hongcheung.com/tw/post/how-to-update-xcode--3-easy-ways/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/how-to-update-xcode--3-easy-ways/</guid><description>三種簡單的 Xcode 更新方式。</description><pubDate>Thu, 11 Jan 2024 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/ea8cabf9-b8fd-4c6c-a18c-33d124d79b20&quot; alt=&quot;如何更新 Xcode - 3 種簡單方法&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;p&gt;我知道的有三種方法。&lt;/p&gt;
&lt;h2 id=&quot;1-app-store&quot;&gt;1. App Store&lt;/h2&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/5ab439c8-be22-42f5-99e9-5bfe3276f465&quot; alt=&quot;使用 App Store 更新 Xcode&quot; title=&quot;在 App Store 上尋找 Xcode&quot;&gt;&lt;/p&gt;
&lt;p&gt;前往你的應用程式資料夾，搜尋 Xcode 並按下更新。如果你只看到「open」這個字，代表你已經取得目前 macOS 版本可用的最新版 Xcode 了。&lt;/p&gt;
&lt;h2 id=&quot;2-apple-開發者網站&quot;&gt;2. Apple 開發者網站&lt;/h2&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/f0e898fe-5012-431d-8bf5-e5c46674c282&quot; alt=&quot;Apple 開發者下載頁面&quot;&gt;&lt;/p&gt;
&lt;p&gt;前往 &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://developer.apple.com/download/all/?q=xcode&quot; title=&quot;Apple 開發者下載頁面&quot;&gt;Apple 官方開發者網站&lt;/a&gt;，使用你的開發者帳號登入。接著搜尋 Xcode。你甚至可以下載較舊的版本。&lt;/p&gt;
&lt;h2 id=&quot;3-xcodes&quot;&gt;3. Xcodes&lt;/h2&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/7cd2b80f-de68-404c-855b-96a049fa95d0&quot; alt=&quot;Xcodes&quot;&gt;&lt;/p&gt;
&lt;p&gt;Xcodes 是一套開源軟體，讓你取得可下載的各種 Xcode 版本清單。你可以從&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://github.com/XcodesOrg/XcodesApp&quot; title=&quot;用來更新 Xcode 的 Xcodes GitHub repo&quot;&gt;這個 GitHub repo&lt;/a&gt; 下載對應的 app。你需要先前往設定，輸入你的開發者帳號登入，才能在清單中看到任何 Xcodes。&lt;/p&gt;
&lt;p&gt;這個程式特別之處在於，你可以安裝並執行多個版本的 Xcode。舉例來說，我現在手邊就有 14.2 和 15.1。它運作得非常順暢。我強烈推薦。&lt;/p&gt;
&lt;h3 id=&quot;注意&quot;&gt;注意&lt;/h3&gt;
&lt;p&gt;不建議透過 App Store 更新。如你所見，Xcode 只獲得 2 顆星的評價。這不是程式本身的問題，而是使用 App Store 下載與安裝的過程有 bug。&lt;/p&gt;
&lt;p&gt;就我個人而言，我試過用 App Store 更新 Xcode 兩次。第一次花了我好幾個小時才完成下載與安裝。第二次我按下「update」，下載並安裝完成。但它仍然顯示並以舊版本運作。所以我最後改用了 Xcodes。&lt;/p&gt;
&lt;p&gt;希望這有幫助。&lt;/p&gt;
&lt;p&gt;朋友，繼續寫程式吧。&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/ea8cabf9-b8fd-4c6c-a18c-33d124d79b20"/><enclosure url="https://cms.hongct.com/assets/ea8cabf9-b8fd-4c6c-a18c-33d124d79b20" length="91986" type="image/png"/></item><item><title>Linux 與 Mac 程式設計比較</title><link>https://hongcheung.com/tw/post/linux-vs-mac-for-programming/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/linux-vs-mac-for-programming/</guid><description>你該選哪一個？</description><pubDate>Thu, 04 Jan 2024 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/e28a3b16-2426-46b5-b1ac-ea3105443786&quot; alt=&quot;Linux 與 Mac 程式設計比較&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;前言&quot;&gt;前言&lt;/h2&gt;
&lt;p&gt;我最近試用了 Linux Mint 和 Ubuntu，幾年前我也試過一些 Linux 發行版。當時我還沒踏入程式設計，只是喜歡東摸西摸，身邊總是帶著一支 Puppy Linux USB 隨身碟。我真的很努力嘗試，即使現在我的程式設計能力更強了，又再給它一次機會——我發現自己最後總是回到 Mac 或 Windows。&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;2025 年 5 月 6 日更新：&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;第一部分是寫給程式設計初學者的。如果你已經熟悉程式設計，請跳到&lt;a href=&quot;#Advanced&quot;&gt;這個章節&lt;/a&gt;閱讀一位同行的程式設計師的意見。&lt;/strong&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h1 id=&quot;從零開始學習程式設計&quot;&gt;從零開始學習程式設計&lt;/h1&gt;
&lt;h2 id=&quot;結論&quot;&gt;結論&lt;/h2&gt;
&lt;p&gt;用 Mac——我會用我的經驗告訴你為什麼。&lt;/p&gt;
&lt;h2 id=&quot;為什麼不選-linux&quot;&gt;為什麼不選 Linux&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;難度&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Mac 是消費級作業系統，這代表它的許多功能和介面都非常使用者友善。大多數應用程式都有安裝檔讓你下載、點一下、安裝，然後就能用了。&lt;/p&gt;
&lt;p&gt;反觀 Linux，如果你想用電腦做任何事，基本上都得以文字為主。別相信那些說 Linux Mint 非常像 Windows 的人。某種程度上確實如此，但如果你想要安裝任何非內建、或軟體管理員裡沒有的東西（你一定會遇到），你就得自己搞清楚所有眉眉角角，搜尋並嘗試別人說對他們有效、但對你可能無效的指令——只為了安裝一個在 macOS 和 Windows 上點一下就能裝好的簡單程式。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;耗時&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;延續上一點，如果你試著安裝某個東西，你會花很多時間東摸西摸。尤其是要尋找你在 Windows 或 Mac 上熟悉、但 Linux 上沒有的替代方案。這聽起來很棒，畢竟你大部分時間都在用終端機寫程式，但問題是，你可以把那些時間拿去用程式碼打造東西，例如 JavaScript、React、SQL、Python 等等。那些你在工作上、或拿來架網站、做應用程式時會用到的程式碼。我不是說你不會用到 bash，只是它並非必要。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;作業系統的小毛病&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;如果你買的裝置出廠就搭載 Linux，那很棒。如果你是在原本跑 Windows 或 Mac 的裝置上安裝 Linux 發行版，你很可能會遇到一些作業系統運作上的小毛病。作業系統有可能運作得很順，但總會有一些這裡那裡需要修的東西。舉幾個例子——也許 Zoom 偶爾會卡住，也許筆電的鍵盤背光無法運作，Wi-Fi 變慢等等。因為 Linux 核心和驅動程式大多由社群貢獻，這很棒，但也代表他們對你的筆電不負任何責任，你得自己用程式碼搞清楚原因和解決方法。很多時候，這些問題是硬體與 Linux 發行版不相容造成的。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;社群&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ubuntu 和 Linux Mint 這類主流 Linux 發行版擁有最大的使用者群。如果你才剛開始用 Linux，強烈建議你從這兩者中挑一個，因為使用者越多，問題的解決方案就越多。不過，Mac 能獲得的支援遠多於 Linux。不論是在 Apple 官網上，或是針對你的 MacBook 機型，你都能更輕鬆地找到精確的解決方案。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;學習程式設計&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;許多程式設計教學都是為 Mac 和 Windows 設計的，即使我們大部分時間都在 VSCode 裡工作，你仍然需要和作業系統的終端機互動來做一些調整，而 Linux 的運作方式就是有點不一樣。你總能找到問題的解決方案和替代做法，但話說回來，如果你只是想當個前端開發者，這些東西並不是非懂不可。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;個人電腦&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;對我來說，Mac 是個人電腦，Linux 不是。Mac 的許多內建功能都非常易用且備受好評，尤其是如果你有 iPhone，你可以在 Apple 裝置之間複製貼上、AirDrop 等等。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;全方位&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;你在 Linux 上能做的事，在 Mac 上都能做，但反過來則不然。舉例來說，如果你想為 iOS 打造行動應用程式，有 Xcode 可以用。如果你想用 VSCode，當然兩者都支援。如果你偏好命令列，Mac 也有終端機。&lt;/p&gt;
&lt;h3 id=&quot;給初學者的總結&quot;&gt;給初學者的總結&lt;/h3&gt;
&lt;p&gt;Mac 可說是更穩健、更全方位、值得信賴且無需東摸西摸，無論是你的程式設計需求還是個人需求都能直接了當滿足。我只能建議你，如果你就是不喜歡 Apple 或覺得裝置太貴，才去用 Linux。但話說回來，你隨時可以買一台二手 MacBook。光是為了不用 Linux 而買一台 MacBook，就很值得了。哈哈，我知道我有偏見。&lt;/p&gt;
&lt;p&gt;儘管如此，祝你成功。&lt;/p&gt;
&lt;p&gt;繼續寫程式吧。&lt;/p&gt;
&lt;hr&gt;
&lt;h1 id=&quot;給老練程式設計師的補充段落&quot;&gt;給老練程式設計師的補充段落&lt;/h1&gt;
&lt;p&gt;我上面寫的內容是給那些沒有程式設計經驗、或經驗很少的人看的。我的重點是，macOS 能更直接了當地幫助任何正在學程式設計的人起步，同時 Mac 也能照顧你的個人需求。如果路上有太多障礙，可能會讓學習者感到挫折，進而放棄。&lt;/p&gt;
&lt;p&gt;不過，如果你已經對程式設計得心應手，情況可能就不一樣了。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;以下部分會更偏技術性……&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&quot;那麼你熟悉程式設計也習慣-linux到底該選哪一個&quot;&gt;那麼，你熟悉程式設計也習慣 Linux，到底該選哪一個？&lt;/h2&gt;
&lt;p&gt;就我個人而言，我仍然偏好 M 系列的 MacBook 勝過其他機器，過去幾年我在這台 M2 MacBook Air 上完成了非常多事。&lt;/p&gt;
&lt;p&gt;硬體方面，它是一台快速又穩定的裝置，電池續航力極佳、觸控板超棒、鍵盤安靜、螢幕不錯、運作安靜，還有內建喇叭。&lt;/p&gt;
&lt;p&gt;軟體方面，它一直都很省心、運作順暢，我可以在 Mac 上輕鬆取得任何軟體，不論是直接下載或用 brew 都行。&lt;/p&gt;
&lt;p&gt;我承認我一開始是用一台舊的 2015 年 MacBook Air 學程式設計，之後就一路沿用 MacBook。但這主要是為了開發 iOS 應用程式。如果你不想做原生 Apple 應用程式，你並不需要買 Mac。這就帶到接下來的第一點。&lt;/p&gt;
&lt;h2 id=&quot;你做的是哪種程式設計&quot;&gt;你做的是哪種程式設計？&lt;/h2&gt;
&lt;h3 id=&quot;行動應用程式apple-應用程式&quot;&gt;行動應用程式；Apple 應用程式&lt;/h3&gt;
&lt;p&gt;你想為 Apple 裝置打造原生應用程式嗎？如果想，就買一台 Mac。這裡「原生」這個詞很關鍵，因為技術上你可以用 React Native 搭配 Expo 為 Apple 裝置寫應用程式，他們有雲端編譯器幫你執行 Xcode 編譯。所以，你可以用 Linux 或 Windows 機器來寫程式，再提交到 Expo 雲端幫你編譯。不過實際上，直接買一台 Mac 總是更好，即使是舊的也一樣。在本機建置能讓你全程掌握程式碼，因此修改起來會輕鬆直接得多。&lt;/p&gt;
&lt;p&gt;如果你主要做網站或後端伺服器，你可以買任何想要的電腦，甚至 Windows 也行。這類程式設計工作沒有繪圖方面的需求，所以一台舊的 Lenovo ThinkPad 就能勝任。&lt;/p&gt;
&lt;p&gt;你不需要擔心 Android 應用程式。反正你在任何平台上都能開發。&lt;/p&gt;
&lt;h3 id=&quot;遊戲&quot;&gt;遊戲&lt;/h3&gt;
&lt;p&gt;不過，如果你做的是遊戲程式設計，或有執行、建置語言模型／機器學習模型的需求，建議你買一台效能強大的 Windows／Linux 電腦，而不是 Mac。這樣你的錢會花得更值得。更別提我上次確認時，Unreal Engine 5 的效能與 Windows 電腦相比並不理想，這是因為它還沒針對 Apple Silicon 最佳化。&lt;/p&gt;
&lt;p&gt;除非你用的是 Godot 或 Unity 寫程式。對這些輕量級遊戲引擎來說，一台 MacBook 也已經很夠用了。&lt;/p&gt;
&lt;h2 id=&quot;軟體&quot;&gt;軟體&lt;/h2&gt;
&lt;h3 id=&quot;docker&quot;&gt;Docker&lt;/h3&gt;
&lt;p&gt;使用 Docker 很簡單，macOS 有提供 .dmg 格式的 Docker Desktop。雙擊安裝就能用了。&lt;/p&gt;
&lt;h3 id=&quot;本機-postgres&quot;&gt;本機 Postgres&lt;/h3&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://postgresapp.com/&quot;&gt;Postgres.app&lt;/a&gt; 也一樣，輕鬆簡單。&lt;/p&gt;
&lt;h3 id=&quot;模擬器&quot;&gt;模擬器&lt;/h3&gt;
&lt;p&gt;不論你用哪種程式設計框架，都能在 MacBook 上取得 iPhone 或 iPad 模擬器。Flutter、React Native、SwiftUI 等等，你說得出來的都能在 MacBook 上運作。你也可以在 UTM 裡安裝 Linux，讓 Ubuntu 跑在你的 Mac 上，但反過來則不然。&lt;/p&gt;
&lt;h3 id=&quot;程式碼編輯器&quot;&gt;程式碼編輯器&lt;/h3&gt;
&lt;p&gt;嗯，現在每個 IDE 在每個平台上都有了。&lt;/p&gt;
&lt;h2 id=&quot;最終總結&quot;&gt;最終總結&lt;/h2&gt;
&lt;p&gt;所以，你該問自己的關鍵問題是：你想不想為 Apple 裝置開發行動應用程式？&lt;/p&gt;
&lt;p&gt;即使你用的是跨平台框架，你也得買一台 MacBook，才能獲得完整的 Apple 應用程式開發體驗。這會讓一切輕鬆得多。&lt;/p&gt;
&lt;p&gt;我不喜歡 Apple 封閉的花園生態，也不喜歡額外儲存空間的不必要加價，但他們確實做出了很棒的產品。&lt;/p&gt;
&lt;p&gt;我的建議是，如果你現在只有一台 Windows 電腦，就安裝 Ubuntu 甚至 Linux Mint 看看你喜不喜歡。如果喜歡，就繼續用，直到你真的需要 Mac 為止。&lt;/p&gt;
&lt;p&gt;我也主張買你真正想要的電腦。光是裝置本身用起來愉快，就能讓你想工作。&lt;/p&gt;
&lt;h4 id=&quot;附註&quot;&gt;附註&lt;/h4&gt;
&lt;h5 id=&quot;更多關於-apple-應用程式&quot;&gt;更多關於 Apple 應用程式&lt;/h5&gt;
&lt;p&gt;在你做決定之前，有幾件事要記住：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;只有執行最新作業系統的 MacBook 才能用最新的 Apple API 開發
&lt;ul&gt;
&lt;li&gt;例如 AI 之類的功能，只能在 Apple Silicon Mac 上開發。&lt;/li&gt;
&lt;li&gt;Vision OS 只能在 Apple Silicon Mac 上開發。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;機器學習只能在實體裝置上執行，不能在模擬器上執行。- 如果你實作了裝置端的機器學習模型，你需要一台 iPhone／iPad 來測試你的應用程式。如果你試著在 iPhone 模擬器上執行，它只會當掉。&lt;/li&gt;
&lt;/ul&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/e28a3b16-2426-46b5-b1ac-ea3105443786"/><enclosure url="https://cms.hongct.com/assets/e28a3b16-2426-46b5-b1ac-ea3105443786" length="165412" type="image/jpeg"/></item><item><title>如何修正 FullyQualifiedErrorId：UnauthorizedAccess - PowerShell 錯誤</title><link>https://hongcheung.com/tw/post/how-to-fix-fullyqualifiederrorid-unauthorizedaccess-a-powershell-error/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/how-to-fix-fullyqualifiederrorid-unauthorizedaccess-a-powershell-error/</guid><description>在 Windows PowerShell 上嘗試執行指令碼時，這個錯誤的修正方法。</description><pubDate>Wed, 03 Jan 2024 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/5a7f8c11-e4d3-42cf-a936-a2dc5c59c90c&quot; alt=&quot;如何修正 FullyQualifiedErrorId：UnauthorizedAccess - PowerShell 錯誤&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;問題&quot;&gt;問題&lt;/h2&gt;
&lt;p&gt;我在 Windows 11 上透過 VSCode 的終端機嘗試執行我的 express 指令碼，結果收到以下 PowerShell 錯誤：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;style&gt;.expressive-code{font-family:var(--ec-uiFontFml);font-size:var(--ec-uiFontSize);font-weight:var(--ec-uiFontWg);line-height:var(--ec-uiLineHt);text-size-adjust:none;-webkit-text-size-adjust:none}.expressive-code *:not(:is(svg, svg *)){all:revert;box-sizing:border-box}.expressive-code pre{display:flex;margin:0;padding:0;border:var(--ec-brdWd) solid var(--ec-brdCol);border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));background:var(--ec-codeBg)}.expressive-code pre:focus-visible{outline:3px solid var(--ec-focusBrd);outline-offset:-3px}.expressive-code pre &gt; code{all:unset;display:block;flex:1 0 100%;padding:var(--ec-codePadBlk) 0;color:var(--ec-codeFg);font-family:var(--ec-codeFontFml);font-size:var(--ec-codeFontSize);font-weight:var(--ec-codeFontWg);line-height:var(--ec-codeLineHt)}.expressive-code pre{overflow-x:auto}.expressive-code pre.wrap .ec-line .code{white-space:pre-wrap;overflow-wrap:break-word;min-width:min(20ch, var(--ecMaxLine, 20ch))}.expressive-code pre.wrap .ec-line .code span.indent{white-space:pre}.expressive-code pre::-webkit-scrollbar,.expressive-code pre::-webkit-scrollbar-track{background-color:inherit;border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));border-top-left-radius:0;border-top-right-radius:0}.expressive-code pre::-webkit-scrollbar-thumb{background-color:var(--ec-sbThumbCol);border:4px solid transparent;background-clip:content-box;border-radius:10px}.expressive-code pre::-webkit-scrollbar-thumb:hover{background-color:var(--ec-sbThumbHoverCol)}.expressive-code pre::-webkit-scrollbar-corner{background:transparent}.expressive-code .ec-line{direction:ltr;unicode-bidi:isolate;display:grid;grid-template-areas:&apos;gutter code&apos;;grid-template-columns:auto 1fr;position:relative}.expressive-code .ec-line .gutter{grid-area:gutter;color:var(--ec-gtrFg)}.expressive-code .ec-line .gutter &gt; *{pointer-events:none;user-select:none;-webkit-user-select:none}.expressive-code .ec-line .gutter ~ .code{--ecLineBrdCol:var(--ec-gtrBrdCol)}.expressive-code .ec-line.highlight .gutter{color:var(--ec-gtrHlFg)}.expressive-code .ec-line .code{grid-area:code;position:relative;box-sizing:content-box;padding-inline-start:calc(var(--ecIndent, 0ch) + var(--ec-codePadInl) - var(--ecGtrBrdWd));padding-inline-end:var(--ec-codePadInl);text-indent:calc(var(--ecIndent, 0ch) * -1)}.expressive-code .ec-line .code::before,.expressive-code .ec-line .code::after,.expressive-code .ec-line .code :where(*){text-indent:0}.expressive-code .ec-line .code{--ecGtrBrdWd:var(--ec-gtrBrdWd);border-inline-start:var(--ecGtrBrdWd) solid var(--ecLineBrdCol, transparent)}.expressive-code .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.expressive-code .ec-line.mark{--tmLineBgCol:var(--ec-tm-markBg)}.expressive-code .ec-line.mark .code{--ecLineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line.ins{--tmLineBgCol:var(--ec-tm-insBg);--tmLabel:var(--ec-tm-insDiffIndContent)}.expressive-code .ec-line.ins .code{--ecLineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line.ins .code::before{color:var(--ec-tm-insDiffIndCol)}.expressive-code .ec-line.del{--tmLineBgCol:var(--ec-tm-delBg);--tmLabel:var(--ec-tm-delDiffIndContent)}.expressive-code .ec-line.del .code{--ecLineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line.del .code::before{color:var(--ec-tm-delDiffIndCol)}.expressive-code .ec-line.mark,.expressive-code .ec-line.ins,.expressive-code .ec-line.del{background:var(--tmLineBgCol)}.expressive-code .ec-line.mark .code,.expressive-code .ec-line.ins .code,.expressive-code .ec-line.del .code{--ecGtrBrdWd:var(--ec-tm-lineMarkerAccentWd)}.expressive-code .ec-line.mark .code::before,.expressive-code .ec-line.ins .code::before,.expressive-code .ec-line.del .code::before{display:block;position:absolute;left:0;box-sizing:border-box;content:var(--tmLabel, &apos; &apos;);padding-inline-start:var(--ec-tm-lineDiffIndMargLeft);text-align:center;white-space:pre}.expressive-code .ec-line.mark.tm-label .code::before,.expressive-code .ec-line.ins.tm-label .code::before,.expressive-code .ec-line.del.tm-label .code::before{background:var(--ecLineBrdCol);padding:0 calc(var(--ec-tm-lineMarkerLabelPadInl) + var(--ec-tm-lineMarkerAccentWd)) 0 var(--ec-tm-lineMarkerLabelPadInl);color:var(--ec-tm-lineMarkerLabelCol)}.expressive-code .ec-line mark{--tmInlineBgCol:var(--ec-tm-markBg);--tmInlineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line ins{--tmInlineBgCol:var(--ec-tm-insBg);--tmInlineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line del{--tmInlineBgCol:var(--ec-tm-delBg);--tmInlineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line mark,.expressive-code .ec-line ins,.expressive-code .ec-line del{all:unset;display:inline-block;position:relative;--tmBrdL:var(--ec-tm-inlMarkerBrdWd);--tmBrdR:var(--ec-tm-inlMarkerBrdWd);--tmRadL:var(--ec-tm-inlMarkerBrdRad);--tmRadR:var(--ec-tm-inlMarkerBrdRad);margin-inline:0.025rem;padding-inline:var(--ec-tm-inlMarkerPad);border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);background:var(--tmInlineBgCol);background-clip:padding-box}.expressive-code .ec-line mark.open-start,.expressive-code .ec-line ins.open-start,.expressive-code .ec-line del.open-start{margin-inline-start:0;padding-inline-start:0;--tmBrdL:0px;--tmRadL:0}.expressive-code .ec-line mark.open-end,.expressive-code .ec-line ins.open-end,.expressive-code .ec-line del.open-end{margin-inline-end:0;padding-inline-end:0;--tmBrdR:0px;--tmRadR:0}.expressive-code .ec-line mark::before,.expressive-code .ec-line ins::before,.expressive-code .ec-line del::before{content:&apos;&apos;;position:absolute;pointer-events:none;display:inline-block;inset:0;border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);border:var(--ec-tm-inlMarkerBrdWd) solid var(--tmInlineBrdCol);border-inline-width:var(--tmBrdL) var(--tmBrdR)}.expressive-code .frame{all:unset;position:relative;display:block;--header-border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));--tab-border-radius:calc(var(--ec-frm-edTabBrdRad) + var(--ec-brdWd));--button-spacing:0.4rem;--code-background:var(--ec-frm-edBg);border-radius:var(--header-border-radius);box-shadow:var(--ec-frm-frameBoxShdCssVal)}.expressive-code .frame .header{display:none;z-index:1;position:relative;border-radius:var(--header-border-radius) var(--header-border-radius) 0 0}.expressive-code .frame.has-title pre,.expressive-code .frame.has-title code,.expressive-code .frame.is-terminal pre,.expressive-code .frame.is-terminal code{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.expressive-code .frame .title:empty:before{content:&apos;\a0&apos;}.expressive-code .frame.has-title:not(.is-terminal){--button-spacing:calc(1.9rem + 2 * (var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)))}.expressive-code .frame.has-title:not(.is-terminal) .title{position:relative;color:var(--ec-frm-edActTabFg);background:var(--ec-frm-edActTabBg);background-clip:padding-box;margin-block-start:var(--ec-frm-edTabsMargBlkStart);padding:calc(var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)) var(--ec-uiPadInl);border:var(--ec-brdWd) solid var(--ec-frm-edActTabBrdCol);border-radius:var(--tab-border-radius) var(--tab-border-radius) 0 0;border-bottom:none;overflow:hidden}.expressive-code .frame.has-title:not(.is-terminal) .title::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-top:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndTopCol);border-bottom:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndBtmCol)}.expressive-code .frame.has-title:not(.is-terminal) .header{display:flex;background:linear-gradient(to top, var(--ec-frm-edTabBarBrdBtmCol) var(--ec-brdWd), transparent var(--ec-brdWd)),linear-gradient(var(--ec-frm-edTabBarBg), var(--ec-frm-edTabBarBg));background-repeat:no-repeat;padding-inline-start:var(--ec-frm-edTabsMargInlStart)}.expressive-code .frame.has-title:not(.is-terminal) .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border:var(--ec-brdWd) solid var(--ec-frm-edTabBarBrdCol);border-radius:inherit;border-bottom:none}.expressive-code .frame.is-terminal{--button-spacing:calc(1.9rem + var(--ec-brdWd) + 2 * var(--ec-uiPadBlk));--code-background:var(--ec-frm-trmBg)}.expressive-code .frame.is-terminal .header{display:flex;align-items:center;justify-content:center;padding-block:var(--ec-uiPadBlk);padding-block-end:calc(var(--ec-uiPadBlk) + var(--ec-brdWd));position:relative;font-weight:500;letter-spacing:0.025ch;color:var(--ec-frm-trmTtbFg);background:var(--ec-frm-trmTtbBg);border:var(--ec-brdWd) solid var(--ec-brdCol);border-bottom:none}.expressive-code .frame.is-terminal .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;left:var(--ec-uiPadInl);width:2.1rem;height:0.56rem;line-height:0;background-color:var(--ec-frm-trmTtbDotsFg);opacity:var(--ec-frm-trmTtbDotsOpa);-webkit-mask-image:var(--ec-frm-trmIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-trmIcon);mask-repeat:no-repeat}.expressive-code .frame.is-terminal .header::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-bottom:var(--ec-brdWd) solid var(--ec-frm-trmTtbBrdBtmCol)}.expressive-code .frame pre{background:var(--code-background)}.expressive-code .copy{display:flex;gap:0.25rem;flex-direction:row;position:absolute;inset-block-start:calc(var(--ec-brdWd) + var(--button-spacing));inset-inline-end:calc(var(--ec-brdWd) + var(--ec-uiPadInl) / 2)}@media (scripting: none){.expressive-code .copy{display:none}}.expressive-code .copy{direction:ltr;unicode-bidi:isolate}.expressive-code .copy button{position:relative;align-self:flex-end;margin:0;padding:0;border:none;border-radius:0.2rem;z-index:1;cursor:pointer;transition-property:opacity, background, border-color;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.25, 0.46, 0.45, 0.94);width:2.5rem;height:2.5rem;background:var(--code-background);opacity:0.75}.expressive-code .copy button div{position:absolute;inset:0;border-radius:inherit;background:var(--ec-frm-inlBtnBg);opacity:var(--ec-frm-inlBtnBgIdleOpa);transition-property:inherit;transition-duration:inherit;transition-timing-function:inherit}.expressive-code .copy button::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-radius:inherit;border:var(--ec-brdWd) solid var(--ec-frm-inlBtnBrd);opacity:var(--ec-frm-inlBtnBrdOpa)}.expressive-code .copy button::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-frm-inlBtnFg);-webkit-mask-image:var(--ec-frm-copyIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-copyIcon);mask-repeat:no-repeat;margin:0.475rem;line-height:0}.expressive-code .copy button:hover,.expressive-code .copy button:focus:focus-visible{opacity:1}.expressive-code .copy button:hover div,.expressive-code .copy button:focus:focus-visible div{opacity:var(--ec-frm-inlBtnBgHoverOrFocusOpa)}.expressive-code .copy button:active{opacity:1}.expressive-code .copy button:active div{opacity:var(--ec-frm-inlBtnBgActOpa)}.expressive-code .copy .feedback{--tooltip-arrow-size:0.35rem;--tooltip-bg:var(--ec-frm-tooltipSuccessBg);color:var(--ec-frm-tooltipSuccessFg);pointer-events:none;user-select:none;-webkit-user-select:none;position:relative;align-self:center;background-color:var(--tooltip-bg);z-index:99;padding:0.125rem 0.75rem;border-radius:0.2rem;margin-inline-end:var(--tooltip-arrow-size);opacity:0;transition-property:opacity, transform;transition-duration:0.2s;transition-timing-function:ease-in-out;transform:translate3d(0, 0.25rem, 0)}.expressive-code .copy .feedback::after{content:&apos;&apos;;position:absolute;pointer-events:none;top:calc(50% - var(--tooltip-arrow-size));inset-inline-end:calc(-2 * (var(--tooltip-arrow-size) - 0.5px));border:var(--tooltip-arrow-size) solid transparent;border-inline-start-color:var(--tooltip-bg)}.expressive-code .copy .feedback.show{opacity:1;transform:translate3d(0, 0, 0)}@media (hover: hover){.expressive-code{}.expressive-code .copy button{opacity:0;width:2rem;height:2rem}.expressive-code .frame:hover .copy button:not(:hover),.expressive-code .frame:focus-within :focus-visible ~ .copy button:not(:hover),.expressive-code .frame .copy .feedback.show ~ button:not(:hover){opacity:0.75}}.expressive-code :nth-child(1 of .ec-line) .code{padding-inline-end:calc(2rem + var(--ec-codePadInl))}.expressive-code .gutter .ln{display:inline-flex;justify-content:flex-end;align-items:flex-start;box-sizing:content-box;min-width:var(--lnWidth, 2ch);padding-inline:2ch;color:var(--ec-lineNumbers-fg)}.highlight .expressive-code .gutter .ln{color:var(--ec-lineNumbers-hlFg)}.expressive-code .ec-section{position:relative}.expressive-code .ec-section summary{position:relative;font-family:var(--ec-cs-closedFontFml);font-size:var(--ec-cs-closedFontSize);line-height:var(--ec-cs-closedLineHt);user-select:none;-webkit-user-select:none;cursor:pointer;color:var(--ec-cs-closedTextCol);background-color:var(--ec-cs-closedBgCol);--border-color:var(--ec-cs-closedBrdCol);--border-width:var(--ec-cs-closedBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);margin:var(--ec-cs-closedMarg);padding:0}.expressive-code .ec-section summary::marker{display:inline-block;content:&quot;&quot;;width:16px;height:16px}.expressive-code .ec-section summary::-webkit-details-marker{display:none}.expressive-code .ec-section summary :is(.expand, .collapse){position:relative;display:inline-block;width:16px;height:16px;vertical-align:text-bottom;opacity:0.75}.expressive-code .ec-section summary :is(.expand, .collapse)::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-cs-closedTextCol);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;line-height:0}.expressive-code .ec-section summary .expand::after{-webkit-mask-image:var(--ec-cs-expandIcon);mask-image:var(--ec-cs-expandIcon);-webkit-print-color-adjust:exact;print-color-adjust:exact}.expressive-code .ec-section summary .collapse{display:none}.expressive-code .ec-section summary .collapse::after{-webkit-mask-image:var(--ec-cs-collapseIcon);mask-image:var(--ec-cs-collapseIcon)}.expressive-code .ec-section summary .text{margin-left:1em}.expressive-code .ec-section summary .ec-line .code{padding-block:var(--ec-cs-closedPadBlk);text-indent:0}.expressive-code .ec-section[open],.expressive-code .ec-section details[open] + .content-lines{--border-color:var(--ec-cs-openBrdCol);--border-width:var(--ec-cs-openBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);padding-inline:var(--ec-cs-openPad);margin-inline:var(--ec-cs-openMarg)}.expressive-code .ec-section.github[open] summary{display:none}.expressive-code .ec-section.github[open]{background-color:var(--ec-cs-openBgCol)}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end){display:flex;flex-direction:column}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) .content-lines{display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] .collapse{display:inline-block}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] :is(.expand, .text){display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] + .content-lines{display:block;background-color:var(--ec-cs-openBgColCollapsible)}@media print{.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open]{display:none}}.expressive-code .ec-section.collapsible-end{flex-direction:column-reverse}:root,:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;]{--ec-brdRad:0.3rem;--ec-brdWd:1.5px;--ec-brdCol:#1b1f23;--ec-codeFontFml:jetbrains-mono;--ec-codeFontSize:0.85rem;--ec-codeFontWg:400;--ec-codeLineHt:1.65;--ec-codePadBlk:1rem;--ec-codePadInl:1.35rem;--ec-codeBg:#24292e;--ec-codeFg:#e1e4e8;--ec-codeSelBg:#3392ff44;--ec-gtrFg:#727980;--ec-gtrBrdCol:#72798033;--ec-gtrBrdWd:1.5px;--ec-gtrHlFg:#e1e4e896;--ec-uiFontFml:jetbrains-mono;--ec-uiFontSize:0.9rem;--ec-uiFontWg:400;--ec-uiLineHt:1.65;--ec-uiPadBlk:0.25rem;--ec-uiPadInl:1rem;--ec-uiSelBg:#39414a;--ec-uiSelFg:#e1e4e8;--ec-focusBrd:#005cc5;--ec-sbThumbCol:#6a737d33;--ec-sbThumbHoverCol:#6a737dd1;--ec-tm-lineMarkerAccentMarg:0rem;--ec-tm-lineMarkerAccentWd:0.15rem;--ec-tm-lineMarkerLabelPadInl:0.2rem;--ec-tm-lineMarkerLabelCol:white;--ec-tm-lineDiffIndMargLeft:0.3rem;--ec-tm-inlMarkerBrdWd:1.5px;--ec-tm-inlMarkerBrdRad:0.2rem;--ec-tm-inlMarkerPad:0.15rem;--ec-tm-insDiffIndContent:&apos;+&apos;;--ec-tm-delDiffIndContent:&apos;-&apos;;--ec-tm-markBg:#264a8980;--ec-tm-markBrdCol:#5570b3d0;--ec-tm-insBg:#26561c80;--ec-tm-insBrdCol:#4e7e41d0;--ec-tm-insDiffIndCol:#7eb070d0;--ec-tm-delBg:#81322b80;--ec-tm-delBrdCol:#ae594fd0;--ec-tm-delDiffIndCol:#e68a7ed0;--ec-frm-shdCol:#0000005b;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #0000005b;--ec-frm-edActTabBg:#24292e;--ec-frm-edActTabFg:#e1e4e8;--ec-frm-edActTabBrdCol:transparent;--ec-frm-edActTabIndHt:1.5px;--ec-frm-edActTabIndTopCol:#f9826c;--ec-frm-edActTabIndBtmCol:#24292e;--ec-frm-edTabsMargInlStart:0;--ec-frm-edTabsMargBlkStart:0;--ec-frm-edTabBrdRad:0.3rem;--ec-frm-edTabBarBg:#1f2428;--ec-frm-edTabBarBrdCol:#1b1f23;--ec-frm-edTabBarBrdBtmCol:#1b1f23;--ec-frm-edBg:#24292e;--ec-frm-trmTtbFg:#e1e4e8;--ec-frm-trmTtbDotsFg:#e1e4e8;--ec-frm-trmTtbDotsOpa:0.15;--ec-frm-trmTtbBg:#24292e;--ec-frm-trmTtbBrdBtmCol:#1b1f23;--ec-frm-trmBg:#1f2428;--ec-frm-inlBtnFg:#e1e4e8;--ec-frm-inlBtnBg:#e1e4e8;--ec-frm-inlBtnBgIdleOpa:0;--ec-frm-inlBtnBgHoverOrFocusOpa:0.2;--ec-frm-inlBtnBgActOpa:0.3;--ec-frm-inlBtnBrd:#e1e4e8;--ec-frm-inlBtnBrdOpa:0.4;--ec-frm-tooltipSuccessBg:#228739;--ec-frm-tooltipSuccessFg:white;--ec-frm-copyIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2024%2024&apos;%20fill%3D&apos;none&apos;%20stroke%3D&apos;black&apos;%20stroke-width%3D&apos;1.75&apos;%3E%3Cpath%20d%3D&apos;M3%2019a2%202%200%200%201-1-2V2a2%202%200%200%201%201-1h13a2%202%200%200%201%202%201&apos;%2F%3E%3Crect%20x%3D&apos;6&apos;%20y%3D&apos;5&apos;%20width%3D&apos;16&apos;%20height%3D&apos;18&apos;%20rx%3D&apos;1.5&apos;%20ry%3D&apos;1.5&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-frm-trmIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2060%2016&apos;%20preserveAspectRatio%3D&apos;xMidYMid%20meet&apos;%3E%3Ccircle%20cx%3D&apos;8&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;30&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;52&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-lineNumbers-fg:inherit;--ec-lineNumbers-hlFg:inherit;--ec-cs-closedBrdWd:0px;--ec-cs-closedPadBlk:4px;--ec-cs-closedMarg:0;--ec-cs-closedFontFml:inherit;--ec-cs-closedFontSize:inherit;--ec-cs-closedLineHt:inherit;--ec-cs-closedTextCol:#e1e4e8;--ec-cs-closedBgCol:#58606933;--ec-cs-closedBrdCol:#58606980;--ec-cs-openBrdWd:1px;--ec-cs-openPad:0;--ec-cs-openMarg:0;--ec-cs-openBgCol:transparent;--ec-cs-openBgColCollapsible:#5860691a;--ec-cs-openBrdCol:transparent;--ec-cs-expandIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;m8.177.677%202.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25a.75.75%200%200%201-1.5%200V4H5.104a.25.25%200%200%201-.177-.427L7.823.677a.25.25%200%200%201%20.354%200ZM7.25%2010.75a.75.75%200%200%201%201.5%200V12h2.146a.25.25%200%200%201%20.177.427l-2.896%202.896a.25.25%200%200%201-.354%200l-2.896-2.896A.25.25%200%200%201%205.104%2012H7.25v-1.25Zm-5-2a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-cs-collapseIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;M10.896%202H8.75V.75a.75.75%200%200%200-1.5%200V2H5.104a.25.25%200%200%200-.177.427l2.896%202.896a.25.25%200%200%200%20.354%200l2.896-2.896A.25.25%200%200%200%2010.896%202ZM8.75%2015.25a.75.75%200%200%201-1.5%200V14H5.104a.25.25%200%200%201-.177-.427l2.896-2.896a.25.25%200%200%201%20.354%200l2.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25Zm-6.5-6.5a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;)}.expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])),:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--0, inherit);background-color:var(--0bg, transparent);font-style:var(--0fs, inherit);font-weight:var(--0fw, inherit);text-decoration:var(--0td, inherit)}@media (prefers-color-scheme: light){:root:not([data-theme=&quot;dark&quot;]){--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root:not([data-theme=&quot;dark&quot;]) .expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]),.expressive-code[data-theme=&quot;light&quot;]{--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]) .ec-line :where(span[style^=&apos;--&apos;]:not([class])),.expressive-code[data-theme=&quot;light&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}&lt;/style&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function a(e){if(!e)return;let t=e.getAttribute(&quot;tabindex&quot;)!==null,r=e.scrollWidth&gt;e.clientWidth;r&amp;&amp;!t?(e.setAttribute(&quot;tabindex&quot;,&quot;0&quot;),e.setAttribute(&quot;role&quot;,&quot;region&quot;)):!r&amp;&amp;t&amp;&amp;(e.removeAttribute(&quot;tabindex&quot;),e.removeAttribute(&quot;role&quot;))}var u=window.requestIdleCallback||(e=&gt;setTimeout(e,1)),s=window.cancelIdleCallback||clearTimeout;function l(e){let t=new Set,r,n;return new ResizeObserver(c=&gt;{c.forEach(o=&gt;t.add(o.target)),r&amp;&amp;clearTimeout(r),n&amp;&amp;s(n),r=setTimeout(()=&gt;{n&amp;&amp;s(n),n=u(()=&gt;{t.forEach(o=&gt;e(o)),t.clear()})},250)})}function i(e,t){e.querySelectorAll?.(&quot;.expressive-code pre &gt; code&quot;).forEach(r=&gt;{let n=r.parentElement;n&amp;&amp;t.observe(n)})}var d=l(a);i(document,d);var b=new MutationObserver(e=&gt;e.forEach(t=&gt;t.addedNodes.forEach(r=&gt;{i(r,d)})));b.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document,d)});})();}catch(e){console.error(&quot;[EC] tabindex-js-module failed:&quot;,e)}&lt;/script&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function l(o){let e=document.createElement(&quot;pre&quot;);Object.assign(e.style,{opacity:&quot;0&quot;,pointerEvents:&quot;none&quot;,position:&quot;absolute&quot;,overflow:&quot;hidden&quot;,left:&quot;0&quot;,top:&quot;0&quot;,width:&quot;20px&quot;,height:&quot;20px&quot;,webkitUserSelect:&quot;auto&quot;,userSelect:&quot;all&quot;}),e.ariaHidden=&quot;true&quot;,e.textContent=o,document.body.appendChild(e);let a=document.createRange();a.selectNode(e);let n=getSelection();if(!n)return!1;n.removeAllRanges(),n.addRange(a);let r=!1;try{r=document.execCommand(&quot;copy&quot;)}finally{n.removeAllRanges(),document.body.removeChild(e)}return r}async function u(o){let e=o.currentTarget,a=e.dataset,n=!1,r=a.code.replace(/\u007f/g,`
`);try{await navigator.clipboard.writeText(r),n=!0}catch{n=l(r)}if(!n||e.parentNode?.querySelector(&quot;.feedback&quot;))return;let c=e.parentNode?.querySelector(&quot;[aria-live]&quot;),t=document.createElement(&quot;div&quot;);t.classList.add(&quot;feedback&quot;),t.append(a.copied),c.append(t),t.offsetWidth,requestAnimationFrame(()=&gt;t?.classList.add(&quot;show&quot;));let s=()=&gt;!t||t.classList.remove(&quot;show&quot;),d=()=&gt;{!t||parseFloat(getComputedStyle(t).opacity)&gt;0||(t.remove(),t=void 0)};setTimeout(s,1500),setTimeout(d,2500),e.addEventListener(&quot;blur&quot;,s),t.addEventListener(&quot;transitioncancel&quot;,d),t.addEventListener(&quot;transitionend&quot;,d)}function i(o){o.querySelectorAll?.(&quot;.expressive-code .copy button&quot;).forEach(e=&gt;e.addEventListener(&quot;click&quot;,u))}i(document);var m=new MutationObserver(o=&gt;o.forEach(e=&gt;e.addedNodes.forEach(a=&gt;{i(a)})));m.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document)});})();}catch(e){console.error(&quot;[EC] copy-js-module failed:&quot;,e)}&lt;/script&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;cannot be loaded because running scripts is disabled on this system.For more information, see&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;2&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;about_Execution_Policies at https: /go.microsoft.com/fwlink /? LinkID = 135170.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;3&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;At line: 1 char: 1&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;4&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;+ nodemon server&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;5&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;+ ~~~~~~~&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;6&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;+ CategoryInfo          : SecurityError: (:)[], PSSecurityException&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;7&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;+ FullyQualifiedErrorId : UnauthorizedAccess&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;cannot be loaded because running scripts is disabled on this system.For more information, seeabout_Execution_Policies at https: /go.microsoft.com/fwlink /? LinkID = 135170.At line: 1 char: 1  + nodemon server    + ~~~~~~~    + CategoryInfo          : SecurityError: (:)[], PSSecurityException      + FullyQualifiedErrorId : UnauthorizedAccess&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;那個連結對我來說沒有用。&lt;/p&gt;
&lt;p&gt;幸運的是，有一個簡單的修正方法。&lt;/p&gt;
&lt;h2 id=&quot;解決方案&quot;&gt;解決方案&lt;/h2&gt;
&lt;p&gt;前往「設定」&gt;「系統」&gt;「開發人員專用」。&lt;/p&gt;
&lt;p&gt;找到 PowerShell，然後開啟這個選項：&lt;/p&gt;
&lt;p&gt;變更執行原則。 -&gt; 開啟&lt;/p&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/dccfefa4-72b7-4ebf-9224-e1cf72e57705&quot; alt=&quot;powershell-changeExecutionPolicy&quot; title=&quot;Turn this option on&quot;&gt;&lt;/p&gt;
&lt;p&gt;現在再次執行你的指令碼，應該就能正常運作。第一次執行時，系統可能會詢問你是否允許執行。&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/5a7f8c11-e4d3-42cf-a936-a2dc5c59c90c"/><enclosure url="https://cms.hongct.com/assets/5a7f8c11-e4d3-42cf-a936-a2dc5c59c90c" length="8065" type="image/png"/></item><item><title>無頭 CMS 與傳統 CMS 的比較</title><link>https://hongcheung.com/tw/post/headless-cms-vs-traditional-cms/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/headless-cms-vs-traditional-cms/</guid><description>無頭 CMS 與傳統 CMS 的差異</description><pubDate>Mon, 01 Jan 2024 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/d3c89c82-a706-4916-91af-a64c931bf57d&quot; alt=&quot;無頭 CMS 與傳統 CMS 的比較&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;什麼是-cms&quot;&gt;什麼是 CMS？&lt;/h2&gt;
&lt;p&gt;如果你想用 WordPress、Medium、Blogspot、Ghost 等以外的東西，或是其他任何部落格平台，又或者你只是想多了解一點，你就會認識一個叫做 CMS——內容管理系統（Content Management System）——的名詞。&lt;/p&gt;
&lt;p&gt;CMS 做的事，就是提供一套有結構的方式來管理你的內容。想像你有成千上萬篇部落格文章，你要怎麼把它們儲存、管理得井然有序？這樣你才能有效率地編輯它們，並在未來某個時候重新翻閱。&lt;/p&gt;
&lt;p&gt;管理功能例如：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;作者——管理你有多少位作者、審閱他們的文章等。&lt;/li&gt;
&lt;li&gt;內容——把文章分類、加入標籤系統、能夠有系統地安排主題。&lt;/li&gt;
&lt;li&gt;外掛——WordPress 有大量外掛，從改善 SEO 到加入訂閱區塊等應有盡有。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;如果你想經營一個長久的部落格或網站，這些功能幾乎是必備的。但如果你只是做一個簡單的幾頁網站，其實並不需要。&lt;/p&gt;
&lt;h2 id=&quot;什麼是傳統-cms&quot;&gt;什麼是傳統 CMS？&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;你的文章以 Markdown 儲存&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;傳統 CMS 會把你每一篇部落格文章存成個別的檔案，副檔名通常是 .md 或 .mdx，這是 Markdown 檔案的簡寫。所以你可以這樣寫：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;style&gt;.expressive-code{font-family:var(--ec-uiFontFml);font-size:var(--ec-uiFontSize);font-weight:var(--ec-uiFontWg);line-height:var(--ec-uiLineHt);text-size-adjust:none;-webkit-text-size-adjust:none}.expressive-code *:not(:is(svg, svg *)){all:revert;box-sizing:border-box}.expressive-code pre{display:flex;margin:0;padding:0;border:var(--ec-brdWd) solid var(--ec-brdCol);border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));background:var(--ec-codeBg)}.expressive-code pre:focus-visible{outline:3px solid var(--ec-focusBrd);outline-offset:-3px}.expressive-code pre &gt; code{all:unset;display:block;flex:1 0 100%;padding:var(--ec-codePadBlk) 0;color:var(--ec-codeFg);font-family:var(--ec-codeFontFml);font-size:var(--ec-codeFontSize);font-weight:var(--ec-codeFontWg);line-height:var(--ec-codeLineHt)}.expressive-code pre{overflow-x:auto}.expressive-code pre.wrap .ec-line .code{white-space:pre-wrap;overflow-wrap:break-word;min-width:min(20ch, var(--ecMaxLine, 20ch))}.expressive-code pre.wrap .ec-line .code span.indent{white-space:pre}.expressive-code pre::-webkit-scrollbar,.expressive-code pre::-webkit-scrollbar-track{background-color:inherit;border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));border-top-left-radius:0;border-top-right-radius:0}.expressive-code pre::-webkit-scrollbar-thumb{background-color:var(--ec-sbThumbCol);border:4px solid transparent;background-clip:content-box;border-radius:10px}.expressive-code pre::-webkit-scrollbar-thumb:hover{background-color:var(--ec-sbThumbHoverCol)}.expressive-code pre::-webkit-scrollbar-corner{background:transparent}.expressive-code .ec-line{direction:ltr;unicode-bidi:isolate;display:grid;grid-template-areas:&apos;gutter code&apos;;grid-template-columns:auto 1fr;position:relative}.expressive-code .ec-line .gutter{grid-area:gutter;color:var(--ec-gtrFg)}.expressive-code .ec-line .gutter &gt; *{pointer-events:none;user-select:none;-webkit-user-select:none}.expressive-code .ec-line .gutter ~ .code{--ecLineBrdCol:var(--ec-gtrBrdCol)}.expressive-code .ec-line.highlight .gutter{color:var(--ec-gtrHlFg)}.expressive-code .ec-line .code{grid-area:code;position:relative;box-sizing:content-box;padding-inline-start:calc(var(--ecIndent, 0ch) + var(--ec-codePadInl) - var(--ecGtrBrdWd));padding-inline-end:var(--ec-codePadInl);text-indent:calc(var(--ecIndent, 0ch) * -1)}.expressive-code .ec-line .code::before,.expressive-code .ec-line .code::after,.expressive-code .ec-line .code :where(*){text-indent:0}.expressive-code .ec-line .code{--ecGtrBrdWd:var(--ec-gtrBrdWd);border-inline-start:var(--ecGtrBrdWd) solid var(--ecLineBrdCol, transparent)}.expressive-code .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.expressive-code .ec-line.mark{--tmLineBgCol:var(--ec-tm-markBg)}.expressive-code .ec-line.mark .code{--ecLineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line.ins{--tmLineBgCol:var(--ec-tm-insBg);--tmLabel:var(--ec-tm-insDiffIndContent)}.expressive-code .ec-line.ins .code{--ecLineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line.ins .code::before{color:var(--ec-tm-insDiffIndCol)}.expressive-code .ec-line.del{--tmLineBgCol:var(--ec-tm-delBg);--tmLabel:var(--ec-tm-delDiffIndContent)}.expressive-code .ec-line.del .code{--ecLineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line.del .code::before{color:var(--ec-tm-delDiffIndCol)}.expressive-code .ec-line.mark,.expressive-code .ec-line.ins,.expressive-code .ec-line.del{background:var(--tmLineBgCol)}.expressive-code .ec-line.mark .code,.expressive-code .ec-line.ins .code,.expressive-code .ec-line.del .code{--ecGtrBrdWd:var(--ec-tm-lineMarkerAccentWd)}.expressive-code .ec-line.mark .code::before,.expressive-code .ec-line.ins .code::before,.expressive-code .ec-line.del .code::before{display:block;position:absolute;left:0;box-sizing:border-box;content:var(--tmLabel, &apos; &apos;);padding-inline-start:var(--ec-tm-lineDiffIndMargLeft);text-align:center;white-space:pre}.expressive-code .ec-line.mark.tm-label .code::before,.expressive-code .ec-line.ins.tm-label .code::before,.expressive-code .ec-line.del.tm-label .code::before{background:var(--ecLineBrdCol);padding:0 calc(var(--ec-tm-lineMarkerLabelPadInl) + var(--ec-tm-lineMarkerAccentWd)) 0 var(--ec-tm-lineMarkerLabelPadInl);color:var(--ec-tm-lineMarkerLabelCol)}.expressive-code .ec-line mark{--tmInlineBgCol:var(--ec-tm-markBg);--tmInlineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line ins{--tmInlineBgCol:var(--ec-tm-insBg);--tmInlineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line del{--tmInlineBgCol:var(--ec-tm-delBg);--tmInlineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line mark,.expressive-code .ec-line ins,.expressive-code .ec-line del{all:unset;display:inline-block;position:relative;--tmBrdL:var(--ec-tm-inlMarkerBrdWd);--tmBrdR:var(--ec-tm-inlMarkerBrdWd);--tmRadL:var(--ec-tm-inlMarkerBrdRad);--tmRadR:var(--ec-tm-inlMarkerBrdRad);margin-inline:0.025rem;padding-inline:var(--ec-tm-inlMarkerPad);border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);background:var(--tmInlineBgCol);background-clip:padding-box}.expressive-code .ec-line mark.open-start,.expressive-code .ec-line ins.open-start,.expressive-code .ec-line del.open-start{margin-inline-start:0;padding-inline-start:0;--tmBrdL:0px;--tmRadL:0}.expressive-code .ec-line mark.open-end,.expressive-code .ec-line ins.open-end,.expressive-code .ec-line del.open-end{margin-inline-end:0;padding-inline-end:0;--tmBrdR:0px;--tmRadR:0}.expressive-code .ec-line mark::before,.expressive-code .ec-line ins::before,.expressive-code .ec-line del::before{content:&apos;&apos;;position:absolute;pointer-events:none;display:inline-block;inset:0;border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);border:var(--ec-tm-inlMarkerBrdWd) solid var(--tmInlineBrdCol);border-inline-width:var(--tmBrdL) var(--tmBrdR)}.expressive-code .frame{all:unset;position:relative;display:block;--header-border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));--tab-border-radius:calc(var(--ec-frm-edTabBrdRad) + var(--ec-brdWd));--button-spacing:0.4rem;--code-background:var(--ec-frm-edBg);border-radius:var(--header-border-radius);box-shadow:var(--ec-frm-frameBoxShdCssVal)}.expressive-code .frame .header{display:none;z-index:1;position:relative;border-radius:var(--header-border-radius) var(--header-border-radius) 0 0}.expressive-code .frame.has-title pre,.expressive-code .frame.has-title code,.expressive-code .frame.is-terminal pre,.expressive-code .frame.is-terminal code{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.expressive-code .frame .title:empty:before{content:&apos;\a0&apos;}.expressive-code .frame.has-title:not(.is-terminal){--button-spacing:calc(1.9rem + 2 * (var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)))}.expressive-code .frame.has-title:not(.is-terminal) .title{position:relative;color:var(--ec-frm-edActTabFg);background:var(--ec-frm-edActTabBg);background-clip:padding-box;margin-block-start:var(--ec-frm-edTabsMargBlkStart);padding:calc(var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)) var(--ec-uiPadInl);border:var(--ec-brdWd) solid var(--ec-frm-edActTabBrdCol);border-radius:var(--tab-border-radius) var(--tab-border-radius) 0 0;border-bottom:none;overflow:hidden}.expressive-code .frame.has-title:not(.is-terminal) .title::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-top:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndTopCol);border-bottom:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndBtmCol)}.expressive-code .frame.has-title:not(.is-terminal) .header{display:flex;background:linear-gradient(to top, var(--ec-frm-edTabBarBrdBtmCol) var(--ec-brdWd), transparent var(--ec-brdWd)),linear-gradient(var(--ec-frm-edTabBarBg), var(--ec-frm-edTabBarBg));background-repeat:no-repeat;padding-inline-start:var(--ec-frm-edTabsMargInlStart)}.expressive-code .frame.has-title:not(.is-terminal) .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border:var(--ec-brdWd) solid var(--ec-frm-edTabBarBrdCol);border-radius:inherit;border-bottom:none}.expressive-code .frame.is-terminal{--button-spacing:calc(1.9rem + var(--ec-brdWd) + 2 * var(--ec-uiPadBlk));--code-background:var(--ec-frm-trmBg)}.expressive-code .frame.is-terminal .header{display:flex;align-items:center;justify-content:center;padding-block:var(--ec-uiPadBlk);padding-block-end:calc(var(--ec-uiPadBlk) + var(--ec-brdWd));position:relative;font-weight:500;letter-spacing:0.025ch;color:var(--ec-frm-trmTtbFg);background:var(--ec-frm-trmTtbBg);border:var(--ec-brdWd) solid var(--ec-brdCol);border-bottom:none}.expressive-code .frame.is-terminal .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;left:var(--ec-uiPadInl);width:2.1rem;height:0.56rem;line-height:0;background-color:var(--ec-frm-trmTtbDotsFg);opacity:var(--ec-frm-trmTtbDotsOpa);-webkit-mask-image:var(--ec-frm-trmIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-trmIcon);mask-repeat:no-repeat}.expressive-code .frame.is-terminal .header::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-bottom:var(--ec-brdWd) solid var(--ec-frm-trmTtbBrdBtmCol)}.expressive-code .frame pre{background:var(--code-background)}.expressive-code .copy{display:flex;gap:0.25rem;flex-direction:row;position:absolute;inset-block-start:calc(var(--ec-brdWd) + var(--button-spacing));inset-inline-end:calc(var(--ec-brdWd) + var(--ec-uiPadInl) / 2)}@media (scripting: none){.expressive-code .copy{display:none}}.expressive-code .copy{direction:ltr;unicode-bidi:isolate}.expressive-code .copy button{position:relative;align-self:flex-end;margin:0;padding:0;border:none;border-radius:0.2rem;z-index:1;cursor:pointer;transition-property:opacity, background, border-color;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.25, 0.46, 0.45, 0.94);width:2.5rem;height:2.5rem;background:var(--code-background);opacity:0.75}.expressive-code .copy button div{position:absolute;inset:0;border-radius:inherit;background:var(--ec-frm-inlBtnBg);opacity:var(--ec-frm-inlBtnBgIdleOpa);transition-property:inherit;transition-duration:inherit;transition-timing-function:inherit}.expressive-code .copy button::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-radius:inherit;border:var(--ec-brdWd) solid var(--ec-frm-inlBtnBrd);opacity:var(--ec-frm-inlBtnBrdOpa)}.expressive-code .copy button::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-frm-inlBtnFg);-webkit-mask-image:var(--ec-frm-copyIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-copyIcon);mask-repeat:no-repeat;margin:0.475rem;line-height:0}.expressive-code .copy button:hover,.expressive-code .copy button:focus:focus-visible{opacity:1}.expressive-code .copy button:hover div,.expressive-code .copy button:focus:focus-visible div{opacity:var(--ec-frm-inlBtnBgHoverOrFocusOpa)}.expressive-code .copy button:active{opacity:1}.expressive-code .copy button:active div{opacity:var(--ec-frm-inlBtnBgActOpa)}.expressive-code .copy .feedback{--tooltip-arrow-size:0.35rem;--tooltip-bg:var(--ec-frm-tooltipSuccessBg);color:var(--ec-frm-tooltipSuccessFg);pointer-events:none;user-select:none;-webkit-user-select:none;position:relative;align-self:center;background-color:var(--tooltip-bg);z-index:99;padding:0.125rem 0.75rem;border-radius:0.2rem;margin-inline-end:var(--tooltip-arrow-size);opacity:0;transition-property:opacity, transform;transition-duration:0.2s;transition-timing-function:ease-in-out;transform:translate3d(0, 0.25rem, 0)}.expressive-code .copy .feedback::after{content:&apos;&apos;;position:absolute;pointer-events:none;top:calc(50% - var(--tooltip-arrow-size));inset-inline-end:calc(-2 * (var(--tooltip-arrow-size) - 0.5px));border:var(--tooltip-arrow-size) solid transparent;border-inline-start-color:var(--tooltip-bg)}.expressive-code .copy .feedback.show{opacity:1;transform:translate3d(0, 0, 0)}@media (hover: hover){.expressive-code{}.expressive-code .copy button{opacity:0;width:2rem;height:2rem}.expressive-code .frame:hover .copy button:not(:hover),.expressive-code .frame:focus-within :focus-visible ~ .copy button:not(:hover),.expressive-code .frame .copy .feedback.show ~ button:not(:hover){opacity:0.75}}.expressive-code :nth-child(1 of .ec-line) .code{padding-inline-end:calc(2rem + var(--ec-codePadInl))}.expressive-code .gutter .ln{display:inline-flex;justify-content:flex-end;align-items:flex-start;box-sizing:content-box;min-width:var(--lnWidth, 2ch);padding-inline:2ch;color:var(--ec-lineNumbers-fg)}.highlight .expressive-code .gutter .ln{color:var(--ec-lineNumbers-hlFg)}.expressive-code .ec-section{position:relative}.expressive-code .ec-section summary{position:relative;font-family:var(--ec-cs-closedFontFml);font-size:var(--ec-cs-closedFontSize);line-height:var(--ec-cs-closedLineHt);user-select:none;-webkit-user-select:none;cursor:pointer;color:var(--ec-cs-closedTextCol);background-color:var(--ec-cs-closedBgCol);--border-color:var(--ec-cs-closedBrdCol);--border-width:var(--ec-cs-closedBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);margin:var(--ec-cs-closedMarg);padding:0}.expressive-code .ec-section summary::marker{display:inline-block;content:&quot;&quot;;width:16px;height:16px}.expressive-code .ec-section summary::-webkit-details-marker{display:none}.expressive-code .ec-section summary :is(.expand, .collapse){position:relative;display:inline-block;width:16px;height:16px;vertical-align:text-bottom;opacity:0.75}.expressive-code .ec-section summary :is(.expand, .collapse)::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-cs-closedTextCol);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;line-height:0}.expressive-code .ec-section summary .expand::after{-webkit-mask-image:var(--ec-cs-expandIcon);mask-image:var(--ec-cs-expandIcon);-webkit-print-color-adjust:exact;print-color-adjust:exact}.expressive-code .ec-section summary .collapse{display:none}.expressive-code .ec-section summary .collapse::after{-webkit-mask-image:var(--ec-cs-collapseIcon);mask-image:var(--ec-cs-collapseIcon)}.expressive-code .ec-section summary .text{margin-left:1em}.expressive-code .ec-section summary .ec-line .code{padding-block:var(--ec-cs-closedPadBlk);text-indent:0}.expressive-code .ec-section[open],.expressive-code .ec-section details[open] + .content-lines{--border-color:var(--ec-cs-openBrdCol);--border-width:var(--ec-cs-openBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);padding-inline:var(--ec-cs-openPad);margin-inline:var(--ec-cs-openMarg)}.expressive-code .ec-section.github[open] summary{display:none}.expressive-code .ec-section.github[open]{background-color:var(--ec-cs-openBgCol)}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end){display:flex;flex-direction:column}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) .content-lines{display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] .collapse{display:inline-block}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] :is(.expand, .text){display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] + .content-lines{display:block;background-color:var(--ec-cs-openBgColCollapsible)}@media print{.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open]{display:none}}.expressive-code .ec-section.collapsible-end{flex-direction:column-reverse}:root,:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;]{--ec-brdRad:0.3rem;--ec-brdWd:1.5px;--ec-brdCol:#1b1f23;--ec-codeFontFml:jetbrains-mono;--ec-codeFontSize:0.85rem;--ec-codeFontWg:400;--ec-codeLineHt:1.65;--ec-codePadBlk:1rem;--ec-codePadInl:1.35rem;--ec-codeBg:#24292e;--ec-codeFg:#e1e4e8;--ec-codeSelBg:#3392ff44;--ec-gtrFg:#727980;--ec-gtrBrdCol:#72798033;--ec-gtrBrdWd:1.5px;--ec-gtrHlFg:#e1e4e896;--ec-uiFontFml:jetbrains-mono;--ec-uiFontSize:0.9rem;--ec-uiFontWg:400;--ec-uiLineHt:1.65;--ec-uiPadBlk:0.25rem;--ec-uiPadInl:1rem;--ec-uiSelBg:#39414a;--ec-uiSelFg:#e1e4e8;--ec-focusBrd:#005cc5;--ec-sbThumbCol:#6a737d33;--ec-sbThumbHoverCol:#6a737dd1;--ec-tm-lineMarkerAccentMarg:0rem;--ec-tm-lineMarkerAccentWd:0.15rem;--ec-tm-lineMarkerLabelPadInl:0.2rem;--ec-tm-lineMarkerLabelCol:white;--ec-tm-lineDiffIndMargLeft:0.3rem;--ec-tm-inlMarkerBrdWd:1.5px;--ec-tm-inlMarkerBrdRad:0.2rem;--ec-tm-inlMarkerPad:0.15rem;--ec-tm-insDiffIndContent:&apos;+&apos;;--ec-tm-delDiffIndContent:&apos;-&apos;;--ec-tm-markBg:#264a8980;--ec-tm-markBrdCol:#5570b3d0;--ec-tm-insBg:#26561c80;--ec-tm-insBrdCol:#4e7e41d0;--ec-tm-insDiffIndCol:#7eb070d0;--ec-tm-delBg:#81322b80;--ec-tm-delBrdCol:#ae594fd0;--ec-tm-delDiffIndCol:#e68a7ed0;--ec-frm-shdCol:#0000005b;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #0000005b;--ec-frm-edActTabBg:#24292e;--ec-frm-edActTabFg:#e1e4e8;--ec-frm-edActTabBrdCol:transparent;--ec-frm-edActTabIndHt:1.5px;--ec-frm-edActTabIndTopCol:#f9826c;--ec-frm-edActTabIndBtmCol:#24292e;--ec-frm-edTabsMargInlStart:0;--ec-frm-edTabsMargBlkStart:0;--ec-frm-edTabBrdRad:0.3rem;--ec-frm-edTabBarBg:#1f2428;--ec-frm-edTabBarBrdCol:#1b1f23;--ec-frm-edTabBarBrdBtmCol:#1b1f23;--ec-frm-edBg:#24292e;--ec-frm-trmTtbFg:#e1e4e8;--ec-frm-trmTtbDotsFg:#e1e4e8;--ec-frm-trmTtbDotsOpa:0.15;--ec-frm-trmTtbBg:#24292e;--ec-frm-trmTtbBrdBtmCol:#1b1f23;--ec-frm-trmBg:#1f2428;--ec-frm-inlBtnFg:#e1e4e8;--ec-frm-inlBtnBg:#e1e4e8;--ec-frm-inlBtnBgIdleOpa:0;--ec-frm-inlBtnBgHoverOrFocusOpa:0.2;--ec-frm-inlBtnBgActOpa:0.3;--ec-frm-inlBtnBrd:#e1e4e8;--ec-frm-inlBtnBrdOpa:0.4;--ec-frm-tooltipSuccessBg:#228739;--ec-frm-tooltipSuccessFg:white;--ec-frm-copyIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2024%2024&apos;%20fill%3D&apos;none&apos;%20stroke%3D&apos;black&apos;%20stroke-width%3D&apos;1.75&apos;%3E%3Cpath%20d%3D&apos;M3%2019a2%202%200%200%201-1-2V2a2%202%200%200%201%201-1h13a2%202%200%200%201%202%201&apos;%2F%3E%3Crect%20x%3D&apos;6&apos;%20y%3D&apos;5&apos;%20width%3D&apos;16&apos;%20height%3D&apos;18&apos;%20rx%3D&apos;1.5&apos;%20ry%3D&apos;1.5&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-frm-trmIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2060%2016&apos;%20preserveAspectRatio%3D&apos;xMidYMid%20meet&apos;%3E%3Ccircle%20cx%3D&apos;8&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;30&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;52&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-lineNumbers-fg:inherit;--ec-lineNumbers-hlFg:inherit;--ec-cs-closedBrdWd:0px;--ec-cs-closedPadBlk:4px;--ec-cs-closedMarg:0;--ec-cs-closedFontFml:inherit;--ec-cs-closedFontSize:inherit;--ec-cs-closedLineHt:inherit;--ec-cs-closedTextCol:#e1e4e8;--ec-cs-closedBgCol:#58606933;--ec-cs-closedBrdCol:#58606980;--ec-cs-openBrdWd:1px;--ec-cs-openPad:0;--ec-cs-openMarg:0;--ec-cs-openBgCol:transparent;--ec-cs-openBgColCollapsible:#5860691a;--ec-cs-openBrdCol:transparent;--ec-cs-expandIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;m8.177.677%202.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25a.75.75%200%200%201-1.5%200V4H5.104a.25.25%200%200%201-.177-.427L7.823.677a.25.25%200%200%201%20.354%200ZM7.25%2010.75a.75.75%200%200%201%201.5%200V12h2.146a.25.25%200%200%201%20.177.427l-2.896%202.896a.25.25%200%200%201-.354%200l-2.896-2.896A.25.25%200%200%201%205.104%2012H7.25v-1.25Zm-5-2a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-cs-collapseIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;M10.896%202H8.75V.75a.75.75%200%200%200-1.5%200V2H5.104a.25.25%200%200%200-.177.427l2.896%202.896a.25.25%200%200%200%20.354%200l2.896-2.896A.25.25%200%200%200%2010.896%202ZM8.75%2015.25a.75.75%200%200%201-1.5%200V14H5.104a.25.25%200%200%201-.177-.427l2.896-2.896a.25.25%200%200%201%20.354%200l2.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25Zm-6.5-6.5a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;)}.expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])),:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--0, inherit);background-color:var(--0bg, transparent);font-style:var(--0fs, inherit);font-weight:var(--0fw, inherit);text-decoration:var(--0td, inherit)}@media (prefers-color-scheme: light){:root:not([data-theme=&quot;dark&quot;]){--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root:not([data-theme=&quot;dark&quot;]) .expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]),.expressive-code[data-theme=&quot;light&quot;]{--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]) .ec-line :where(span[style^=&apos;--&apos;]:not([class])),.expressive-code[data-theme=&quot;light&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}&lt;/style&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function a(e){if(!e)return;let t=e.getAttribute(&quot;tabindex&quot;)!==null,r=e.scrollWidth&gt;e.clientWidth;r&amp;&amp;!t?(e.setAttribute(&quot;tabindex&quot;,&quot;0&quot;),e.setAttribute(&quot;role&quot;,&quot;region&quot;)):!r&amp;&amp;t&amp;&amp;(e.removeAttribute(&quot;tabindex&quot;),e.removeAttribute(&quot;role&quot;))}var u=window.requestIdleCallback||(e=&gt;setTimeout(e,1)),s=window.cancelIdleCallback||clearTimeout;function l(e){let t=new Set,r,n;return new ResizeObserver(c=&gt;{c.forEach(o=&gt;t.add(o.target)),r&amp;&amp;clearTimeout(r),n&amp;&amp;s(n),r=setTimeout(()=&gt;{n&amp;&amp;s(n),n=u(()=&gt;{t.forEach(o=&gt;e(o)),t.clear()})},250)})}function i(e,t){e.querySelectorAll?.(&quot;.expressive-code pre &gt; code&quot;).forEach(r=&gt;{let n=r.parentElement;n&amp;&amp;t.observe(n)})}var d=l(a);i(document,d);var b=new MutationObserver(e=&gt;e.forEach(t=&gt;t.addedNodes.forEach(r=&gt;{i(r,d)})));b.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document,d)});})();}catch(e){console.error(&quot;[EC] tabindex-js-module failed:&quot;,e)}&lt;/script&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function l(o){let e=document.createElement(&quot;pre&quot;);Object.assign(e.style,{opacity:&quot;0&quot;,pointerEvents:&quot;none&quot;,position:&quot;absolute&quot;,overflow:&quot;hidden&quot;,left:&quot;0&quot;,top:&quot;0&quot;,width:&quot;20px&quot;,height:&quot;20px&quot;,webkitUserSelect:&quot;auto&quot;,userSelect:&quot;all&quot;}),e.ariaHidden=&quot;true&quot;,e.textContent=o,document.body.appendChild(e);let a=document.createRange();a.selectNode(e);let n=getSelection();if(!n)return!1;n.removeAllRanges(),n.addRange(a);let r=!1;try{r=document.execCommand(&quot;copy&quot;)}finally{n.removeAllRanges(),document.body.removeChild(e)}return r}async function u(o){let e=o.currentTarget,a=e.dataset,n=!1,r=a.code.replace(/\u007f/g,`
`);try{await navigator.clipboard.writeText(r),n=!0}catch{n=l(r)}if(!n||e.parentNode?.querySelector(&quot;.feedback&quot;))return;let c=e.parentNode?.querySelector(&quot;[aria-live]&quot;),t=document.createElement(&quot;div&quot;);t.classList.add(&quot;feedback&quot;),t.append(a.copied),c.append(t),t.offsetWidth,requestAnimationFrame(()=&gt;t?.classList.add(&quot;show&quot;));let s=()=&gt;!t||t.classList.remove(&quot;show&quot;),d=()=&gt;{!t||parseFloat(getComputedStyle(t).opacity)&gt;0||(t.remove(),t=void 0)};setTimeout(s,1500),setTimeout(d,2500),e.addEventListener(&quot;blur&quot;,s),t.addEventListener(&quot;transitioncancel&quot;,d),t.addEventListener(&quot;transitionend&quot;,d)}function i(o){o.querySelectorAll?.(&quot;.expressive-code .copy button&quot;).forEach(e=&gt;e.addEventListener(&quot;click&quot;,u))}i(document);var m=new MutationObserver(o=&gt;o.forEach(e=&gt;e.addedNodes.forEach(a=&gt;{i(a)})));m.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document)});})();}catch(e){console.error(&quot;[EC] copy-js-module failed:&quot;,e)}&lt;/script&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;markdown&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#79B8FF;--0fw:bold;--1:#005CC5;--1fw:bold&quot;&gt;## Happy New Year&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;2&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;3&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--0fw:bold;--1:#24292E;--1fw:bold&quot;&gt;**Hello**&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; mum.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;## Happy New Year**Hello** mum.&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;上面這段輸入會被 CMS 轉譯：「用 ## 表示二級標題，用 ** 表示粗體」，然後輸出成 HTML 給你。所以你不需要寫像這樣的程式碼：「&amp;#x3C;h2&gt;Happy New Year&amp;#x3C;/h2&gt;&amp;#x3C;p&gt;&amp;#x3C;b&gt;Hello&amp;#x3C;/b&gt; mum&amp;#x3C;/p&gt;」，而能專注在撰寫內容上。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;從 Markdown 到發布的 URL&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;你的 Markdown 檔案通常放在名為 blog 或 posts 的資料夾裡，取決於你怎麼安排。你放置 Markdown 檔案的方式，通常也會反映在發布的 URL 上。如果你把檔案放在 root/posts/hello-mum.md，發布的 URL 就會長得像 example.com/posts/hello-mum。但這取決於你怎麼設定，或你用的是哪個 CMS。&lt;/p&gt;
&lt;p&gt;如果你想要一篇新文章，只要建立一個新的 .md 檔案。如果你把它命名為 peter-parker.md，URL 就會以 posts/peter-parker 結尾。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Markdown 的 Schema&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Schema 是你為 CMS 定義的一組變數集合，一個範例 Markdown 檔案看起來會像這樣：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;markdown&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;---&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;2&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#85E89D;--1:#1E7734&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&apos;Hello Mum&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;3&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#85E89D;--1:#1E7734&quot;&gt;date&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--0:#79B8FF;--1:#005CC5&quot;&gt;2023-11-10&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;4&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#85E89D;--1:#1E7734&quot;&gt;tags&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: [&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&apos;Parenting&apos;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&apos;Mum&apos;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&apos;Family&apos;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;5&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#85E89D;--1:#1E7734&quot;&gt;summary&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&apos;Say hi to your mum instead of hello world&apos;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;6&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#85E89D;--1:#1E7734&quot;&gt;image&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;:&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;7&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;--0:#85E89D;--1:#1E7734&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;/images/mumSmiling.jpg&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;8&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;indent&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;--0:#85E89D;--1:#1E7734&quot;&gt;alt&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;myMum&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;9&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#85E89D;--1:#1E7734&quot;&gt;authors&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;: [&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&apos;default&apos;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;]&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;10&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;---&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;11&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;12&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--0:#85E89D;--1:#1E7734&quot;&gt;img&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#B392F0;--1:#6F42C1&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;../../../public/images/omelet.jpg&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt; &lt;/span&gt;&lt;span style=&quot;--0:#B392F0;--1:#6F42C1&quot;&gt;alt&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--0:#9ECBFF;--1:#032F62&quot;&gt;&quot;omelet&quot;&lt;/span&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;/&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;13&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;or&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;14&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;![omelet](../../../public/images/omelet.jpg)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;15&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;details class=&quot;ec-section github&quot;&gt;&lt;summary&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span class=&quot;expand&quot;&gt;&lt;/span&gt;&lt;span class=&quot;collapse&quot;&gt;&lt;/span&gt;&lt;span class=&quot;text&quot;&gt;3 collapsed lines&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/summary&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;16&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;## Breakfast&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;17&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;18&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#E1E4E8;--1:#24292E&quot;&gt;I usually make omelet for her....... (continue on your article)&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/details&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;---title: &amp;#x27;Hello Mum&amp;#x27;date: 2023-11-10tags: [&amp;#x27;Parenting&amp;#x27;, &amp;#x27;Mum&amp;#x27;, &amp;#x27;Family&amp;#x27;]summary: &amp;#x27;Say hi to your mum instead of hello world&amp;#x27;image:  src: /images/mumSmiling.jpg  alt: myMumauthors: [&amp;#x27;default&amp;#x27;]---&lt;img src=&amp;#x22;../../../public/images/omelet.jpg&amp;#x22; alt=&amp;#x22;omelet&amp;#x22;/&gt;or![omelet](../../../public/images/omelet.jpg)## BreakfastI usually make omelet for her....... (continue on your article)&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;像 title、date、tags、summary、image 的 src 與 alt、authors 這些欄位都是預先定義好的。你只需要依序為每個欄位變更對應的值。不過，如果你是開發者，你可以隨心所欲地輕鬆編輯這些欄位。&lt;/p&gt;
&lt;p&gt;如你所見，你甚至可以在 Markdown 裡插入 HTML 程式碼，這有多方便啊？&lt;/p&gt;
&lt;h2 id=&quot;什麼是無頭-cms&quot;&gt;什麼是無頭 CMS？&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;它使用資料庫，把你的網頁和部落格文章分開。&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;無頭 CMS 的運作方式和傳統 CMS 類似，你也可以用 Markdown 撰寫。但它不會把你的部落格文章以 Markdown 的形式存在你的網站裡。相反地，它把你的內容和網站分開，讓我解釋一下。&lt;/p&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/eac40a1a-34cf-4ae8-87e1-45b0a0b7df6f&quot; alt=&quot;Headless-CMS-VS-Traditional-CMS&quot;&gt;&lt;/p&gt;
&lt;p&gt;無頭 CMS 的意思是內容與你的前端分離。你的部落格文章儲存在別處的後端伺服器上。&lt;/p&gt;
&lt;p&gt;當你用傳統 CMS 建立網站時，我們通常稱之為靜態網站生成。意思是，你把所有東西——包括你寫的文章、網站的設計以及 CMS 系統——都放在同一個資料夾裡。然後，你在準備好時生成它，它就會輸出一個包含所有東西的資料夾——那就是訪客看到的內容。&lt;/p&gt;
&lt;p&gt;但無頭 CMS 原本不會把部落格文章或作者資訊放在你的網站設計資料夾裡。&lt;/p&gt;
&lt;p&gt;相反地，內容儲存在雲端伺服器上的資料庫裡。當你建置網站時，你的網站有一套邏輯去查詢（與雲端上的資料庫溝通），以取回所有儲存在雲端伺服器上的文章。所以當你發布網站時，它會自動從雲端取得那些資料，整合成你網站的一部分，然後輸出一個包含你部落格文章的完整網站。&lt;/p&gt;
&lt;h2 id=&quot;無頭-cms-的缺點&quot;&gt;無頭 CMS 的缺點&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;成本&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;傳統 CMS 通常是免費的，你只需要支付網站代管的費用。如果你用的是 GitHub，基本上就是免費的。另一方面，無頭 CMS 通常會收取月費，外加每個席次（作者）的額外費用，也就是說你付的錢取決於你的團隊有多大。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;頻寬限制（成本）&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;如果你的網站有很多內容和素材（圖片），可能會用掉無頭 CMS 伺服器大量的頻寬。他們的服務也會依你選擇的方案而有頻寬限制。但用傳統 CMS，你只需要在意代管費用和網站頻寬。而且如果你用的是 Cloudflare Pages，它提供無限頻寬，還是免費的。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;建置需要更多心力&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;靜態網站生成器（傳統 CMS）比無頭 CMS 更容易實作。這是因為傳統 CMS 你只需要在意 schema 和撰寫 Markdown，而且這在許多傳統 CMS 上大概都能通用。但無頭 CMS 需要一點 API 抓取邏輯，還要為每個無頭 CMS 供應商學習特定的查詢方法。&lt;/p&gt;
&lt;h2 id=&quot;何時該用哪一種&quot;&gt;何時該用哪一種？&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;傳統 CMS&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;例如 Hugo、11ty、Jekyll、Gatsby 等。&lt;/p&gt;
&lt;p&gt;小型團隊或只有你自己。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;無頭 CMS&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;例如 Sanity、WordPress、Strapi、Drupal、Payload、Prismic 等。&lt;/p&gt;
&lt;p&gt;大型團隊，或為了未來的擴充性。&lt;/p&gt;
&lt;p&gt;這並不代表團隊小就不該用無頭 CMS，這只是一般性的指引。&lt;/p&gt;
&lt;p&gt;另外，如果你不想在本機管理和撰寫部落格文章，你也應該考慮使用無頭 CMS。&lt;/p&gt;
&lt;h2 id=&quot;如果你只在意寫作或者你不是開發者&quot;&gt;如果你只在意寫作，或者你不是開發者&lt;/h2&gt;
&lt;p&gt;那就用 WordPress 就好。其他 CMS 連碰都不用碰。&lt;/p&gt;
&lt;p&gt;它在你需要時提供擴充性，而且最重要的是，你不需要東摸西摸程式碼。&lt;/p&gt;
&lt;p&gt;這是我從研究和經驗中得出的結論。&lt;/p&gt;
&lt;p&gt;祝你好運。&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/d3c89c82-a706-4916-91af-a64c931bf57d"/><enclosure url="https://cms.hongct.com/assets/d3c89c82-a706-4916-91af-a64c931bf57d" length="181775" type="image/jpeg"/></item><item><title>如何解決「Copying shared cache symbols from iPhone」耗時過久的問題</title><link>https://hongcheung.com/tw/post/how-to-fix-copying-shared-cache-symbols-from-iphone-taking-too-long/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/how-to-fix-copying-shared-cache-symbols-from-iphone-taking-too-long/</guid><description>解決 iOS 裝置無法與 Xcode 連線問題的方法。</description><pubDate>Thu, 28 Dec 2023 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/1e7aff28-fa4f-4634-aa8d-1dcd4832b669&quot; alt=&quot;如何解決「Copying shared cache symbols from iPhone」耗時過久的問題&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;問題&quot;&gt;問題&lt;/h2&gt;
&lt;p&gt;我相信我們大多數 iOS 開發者都已經在使用 Xcode 15 了。&lt;/p&gt;
&lt;p&gt;他們最近更新的一項功能，就是預設會透過 Wi-Fi 連接你的 iOS 裝置。&lt;/p&gt;
&lt;p&gt;這聽起來不錯，但對我們許多人來說，卻造成了一些問題，例如與使用傳輸線相比，建置時間變得更慢。&lt;/p&gt;
&lt;p&gt;尤其對我而言，這個惱人的問題就是首次嘗試連接 iOS 裝置時會耗費極長的時間。（如你在截圖中所見，它卡在 45% 超過 15 分鐘）&lt;/p&gt;
&lt;h2 id=&quot;解決方法&quot;&gt;解決方法&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;關閉電腦上的 Wi-Fi。&lt;/li&gt;
&lt;li&gt;以傳統方式插入你的 iPhone——使用傳輸線。\&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/c27d0742-9cbc-4e96-8f86-27a4a79a51ce&quot; alt=&quot;xcode-problem&quot;&gt;&lt;/p&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;你可以點擊「Manage Run Destinations」來啟動連接。\&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img loading=&quot;lazy&quot; decoding=&quot;async&quot; referrerpolicy=&quot;no-referrer&quot; src=&quot;https://cms.hongct.com/assets/5141ff76-0850-41c4-944d-99ec722eec37&quot; alt=&quot;xcode-problem-2&quot;&gt;&lt;/p&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;點擊側邊的裝置，然後等待它開始執行工作。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;對我來說，這個方法從開始到完成整個複製過程，花不到幾分鐘。&lt;/p&gt;
&lt;p&gt;對比&lt;/p&gt;
&lt;p&gt;之前花了 15 分鐘卻只完成 27%，實在太誇張了。&lt;/p&gt;
&lt;p&gt;let happyCoding = true&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/1e7aff28-fa4f-4634-aa8d-1dcd4832b669"/><enclosure url="https://cms.hongct.com/assets/1e7aff28-fa4f-4634-aa8d-1dcd4832b669" length="151017" type="image/png"/></item><item><title>無頭 CMS 與非無頭 CMS 之間的兩難</title><link>https://hongcheung.com/tw/post/the-dilemma-between-headless-cms-and-non-headless-cms/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/the-dilemma-between-headless-cms-and-non-headless-cms/</guid><description>簡略探討 CMS 之間的差異</description><pubDate>Sun, 24 Dec 2023 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/6438f070-fd31-48fb-a545-77e0164a108e&quot; alt=&quot;無頭 CMS 與非無頭 CMS 之間的兩難&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;什麼是-cms&quot;&gt;什麼是 CMS&lt;/h2&gt;
&lt;p&gt;CMS——內容管理系統，基本上就是一套用來管理網站的系統，其中最廣為人知的就是 WordPress。&lt;/p&gt;
&lt;h3 id=&quot;為什麼不用-wordpress&quot;&gt;為什麼不用 WordPress&lt;/h3&gt;
&lt;p&gt;我不想用 WordPress，因為我不喜歡它的 UI 開發體驗。我比較偏好用寫程式的方式來做。不過，我喜歡用它寫部落格文章的簡單程度，也喜歡它搭配各種外掛後能有多強大。但如果你不需要那麼多東西，一個簡單的免費靜態網站就夠了，一年 $9 美元，而且不需要伺服器。&lt;/p&gt;
&lt;p&gt;現在再加上一套開源 CMS，你就可以開始了。&lt;/p&gt;
&lt;h3 id=&quot;尋找-cms&quot;&gt;尋找 CMS&lt;/h3&gt;
&lt;p&gt;過去幾個月，我陸續試過幾套不同的 CMS，像是 Tina、Netlify、Sanity。&lt;/p&gt;
&lt;p&gt;我現在用的 CMS 是 Tina，我覺得還行。但我搭配 Astro 使用的範本有些大大小小的問題。算不上順利，但至少能用。&lt;/p&gt;
&lt;p&gt;基本上，我只想要一個簡單的靜態網站部落格。我原本在 11ty 網站上用 Netlify（Decap），但想試點新東西，所以現在改用 Astro 搭配 Tina 來體驗看看。&lt;/p&gt;
&lt;h3 id=&quot;我希望我早點知道的事&quot;&gt;我希望我早點知道的事&lt;/h3&gt;
&lt;p&gt;當我研究 Reddit 上大家推薦的每一套 CMS 時，我看到了 Sanity 和 Payload。&lt;/p&gt;
&lt;p&gt;我希望我早點知道無頭 CMS 和非無頭 CMS 之間的差異。&lt;/p&gt;
&lt;h2 id=&quot;無頭-cms-與非無頭-cms&quot;&gt;無頭 CMS 與非無頭 CMS&lt;/h2&gt;
&lt;p&gt;Sanity 和 Payload 的不同之處在於它們是無頭的。&lt;/p&gt;
&lt;p&gt;無頭 CMS 的意思是內容（例如部落格文章、頁面）與你的前端分離。資料儲存在伺服器上，可以是自架或託管在他們的雲端。而你的前端只要呼叫 API，就能以 JSON 格式取得這些資料。&lt;/p&gt;
&lt;p&gt;至於我用過的無頭 CMS，像是 Netlify 或 Tina CMS，則不需要伺服器就能運作。「管理」系統只是顯示你網站的資料並直接修改它們，然後為正式環境重新建置整個專案。此外，部落格文章是以 markdown 撰寫的，所以每當你寫了一篇新文章，你的原始碼資料夾裡就會多出一個新的 .md 檔案。&lt;/p&gt;
&lt;p&gt;所以，一個有伺服器，一個沒有。一個可以說是用 JSON，另一個則是用 Markdown。&lt;/p&gt;
&lt;p&gt;當然，沒有伺服器的那個比較容易設定，而且在大多數情況下營運成本也比較低。&lt;/p&gt;
&lt;h3 id=&quot;我不理解的地方&quot;&gt;我不理解的地方&lt;/h3&gt;
&lt;p&gt;市面上的 CMS 實在太多了，我已經省略了一大堆。每一套的運作方式都略有不同，但大部分都一樣。&lt;/p&gt;
&lt;p&gt;我能理解為什麼大家直接就用 WordPress。它歷史悠久，每個人都知道怎麼用，而且不管你喜不喜歡，它既強大又能擴充。&lt;/p&gt;
&lt;p&gt;至於替代方案，Sanity 不錯，因為它有相當慷慨的免費方案，而且不需要自己架設後端。若講求易用性，或許 Netlify 和 Tina 就夠了。但當你想要擴充時，Sanity 似乎是更好的選擇。或者你也可以繞回 WordPress。&lt;/p&gt;
&lt;p&gt;不過，我不理解的是，它是不是無頭、是不是用 markdown，長遠來看到底有什麼關係？&lt;/p&gt;
&lt;p&gt;想來，自架的無頭 CMS 後端可以運作很久，沒有廠商鎖定的問題。但你仍然得讓自己遷就於使用某一家的無頭 CMS 系統來儲存和取得資料。&lt;/p&gt;
&lt;p&gt;另一方面，Markdown 基本上在每一套非無頭 CMS 都能用。只是你可能得在網站上儲存成千上萬個 markdown 檔案，甚至更多，這似乎不是長遠之計。&lt;/p&gt;
&lt;h2 id=&quot;結論&quot;&gt;結論&lt;/h2&gt;
&lt;p&gt;所以，我現在不在乎了。&lt;/p&gt;
&lt;p&gt;就用你喜歡的吧，等到部落格文章累積到好幾萬篇再說。到那時候，我應該已經賺了一些錢，可以請個開發者把網站遷移到當時很酷的新 CMS。實在不怎麼想為這件事煩惱。&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/6438f070-fd31-48fb-a545-77e0164a108e"/><enclosure url="https://cms.hongct.com/assets/6438f070-fd31-48fb-a545-77e0164a108e" length="195473" type="image/jpeg"/></item><item><title>我作為初學者在過去 6 個月如何免費學習程式設計</title><link>https://hongcheung.com/tw/post/how-i-learn-programming-for-free-in-the-past-6-months-as-a-beginner/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/how-i-learn-programming-for-free-in-the-past-6-months-as-a-beginner/</guid><description>給正在學習如何寫程式的初學者一篇值得一讀的文章。</description><pubDate>Wed, 13 Dec 2023 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/75e9b75e-26c5-4bd2-9584-6a3974f879c9&quot; alt=&quot;我作為初學者在過去 6 個月如何免費學習程式設計&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;h2 id=&quot;背景&quot;&gt;背景&lt;/h2&gt;
&lt;p&gt;我一直對創造事物很感興趣。寫程式正好能滿足這一點。&lt;/p&gt;
&lt;p&gt;我從今年四月開始用 &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://www.hackingwithswift.com/100/swiftui&quot; title=&quot;100 Days Of SwiftUI&quot;&gt;100 Days Of SwiftUI&lt;/a&gt; 學習 Swift（iOS），一路跟到第 7x 天，做了幾個 app，也上架到 App Store。Swift 很棒，因為它用同一種語言同時處理 UI 和邏輯。&lt;/p&gt;
&lt;p&gt;但後來我意識到，網頁的潛力可能更大，因為網頁更自由。你的 app 不需要經過審核，不需要付費購買開發者帳號，還能自由選擇自己的技術堆疊等等。尤其當你希望應用程式能跨平台時更是如此。&lt;/p&gt;
&lt;h2 id=&quot;網頁開發學習&quot;&gt;網頁開發學習&lt;/h2&gt;
&lt;p&gt;在為 iPhone 做了幾個小 app 之後，過去 3–4 個月我開始用 freeCodeCamp 學習網頁開發，也稍微碰了一點 Odin project。&lt;/p&gt;
&lt;p&gt;我需要網頁開發，是因為我想為我的行動專案做一個 app 落地頁，以及一些供行動 app 使用的 REST API。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://www.freecodecamp.org/&quot; title=&quot;freeCodeCamp&quot;&gt;FreeCodeCamp&lt;/a&gt;&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;大量動手實作，我其實覺得有點吃不消又有點重複。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://www.theodinproject.com/&quot; title=&quot;The Odin Project&quot;&gt;The Odin project &lt;/a&gt;&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;更多理論，也更深入理解程式設計的「為什麼」和「怎麼運作」。&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;所以我會建議大家兩者同時進行，相輔相成。&lt;/p&gt;
&lt;p&gt;目前為止，我在 freeCodeCamp 只完成了「Responsive Web」、「Basic JavaScript」和一半的「React」。&lt;/p&gt;
&lt;p&gt;我的學習主要建立在文字資訊和官方文件上。我很享受 React 和 NextJS 的官方教學。&lt;/p&gt;
&lt;p&gt;我完全沒有付費上任何線上課程。&lt;/p&gt;
&lt;p&gt;我的學習大多是任務導向——學會我想做的那件事，然後繼續前進到下一件事。&lt;/p&gt;
&lt;h2 id=&quot;我目前的程式設計之路&quot;&gt;我目前的程式設計之路&lt;/h2&gt;
&lt;p&gt;Swift 與一點本地 SQLite &gt; 簡單的 Flask REST API &gt; HTML/CSS &gt; JavaScript &gt; 11ty（靜態網站產生器）&gt; React（官方教學）與 NodeJS &gt; Next.js（官方教學）&gt; ExpressJS &gt; REST API 安全性（CORS 與環境變數）&gt; 重溫 React（freeCodeCamp）&gt; ……&lt;/p&gt;
&lt;h3 id=&quot;大家都說做專案很重要我非常同意&quot;&gt;大家都說做專案很重要，我非常同意&lt;/h3&gt;
&lt;p&gt;如果那不是我真心想做的東西，我早就失去興趣了。當我長時間投入某個專案而感到疲倦時，我會換成另一個用不同語言寫的專案來刺激自己。任務導向的學習最適合我。&lt;/p&gt;
&lt;h3 id=&quot;我用過一些對初學者友善的免費主機&quot;&gt;我用過一些對初學者友善的免費主機&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;GitHub page&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;免費方案下，你必須把 repo 設為公開才能發布。但你仍然可以將自己的網域對應到它。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://www.netlify.com/&quot; title=&quot;Netlify&quot;&gt;Netlify&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;非常容易與 GitHub 連接，內建聯絡表單支援，意思是你不必自己架伺服器。你也可以整合 Netlify CMS 驗證，讓你登入自己的靜態部落格，全部免費。（缺點是不支援 Next Image——也就是無法利用 &amp;#x3C;Image&gt; 最佳化。為此你可以改用 Vercel，但就會失去表單支援，所以看你取捨。我知道這件事，是因為我把 NextJS 網站推上 Netlify 時遇到了錯誤。）&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://CloudFlare.com&quot; title=&quot;Cloud Flare&quot;&gt;CloudFlare&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;相較於 Netlify，UI 沒那麼酷、也沒那麼對初學者友善，但它有無限頻寬、免費主機，甚至還有一些可用的有限雲端函式。它不像 Netlify 那麼對初學者友善，但也不算太難。它免費提供你所需與想要的一切基本功能。而且我的網域是在那裡買的，所以它現在是我首選的靜態主機。&lt;/p&gt;
&lt;h3 id=&quot;免費後端主機&quot;&gt;免費後端主機&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://www.pythonanywhere.com/&quot; title=&quot;PythonAnywhere&quot;&gt;PythonAnywhere&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;這是我的第一個後端。對基本用途來說非常容易上手。它有 CPU 計算時間限制，意思是免費方案下你無法在這台伺服器上執行大型處理任務。不過，它非常適合 RESTful API，因為它會一直運行。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://render.com&quot; title=&quot;Render&quot;&gt;Render&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;這是我託管 express.js 的新選擇——缺點是閒置 15 分鐘就會自動休眠。我還沒找到一個免費、永遠在線、又能託管 JavaScript 伺服器的主機。不過，不會休眠的伺服器每月約 $7，不算太貴，而且它接受簽帳金融卡，這點我很喜歡。UI 也很容易上手。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://aws.amazon.com/&quot; title=&quot;AWS&quot;&gt;AWS&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;不行，對我來說太複雜了，但它似乎是兼顧可擴展性與合理價格的最佳選擇之一，我還沒碰，因為網站 UI 對初學者不友善，而且我對 VPS 了解不多。&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://cloud.google.com/&quot; title=&quot;Google Cloud&quot;&gt;Google Cloud&lt;/a&gt; / &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://firebase.google.com/&quot; title=&quot;Firebase&quot;&gt;Firebase&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Google Cloud 即使要使用免費方案也需要信用卡才能開始，我剛好沒有。Firebase 很適合免費輕鬆建立驗證系統。我之後會再探索這個。&lt;/p&gt;
&lt;h2 id=&quot;學習整個網站發布流程&quot;&gt;學習整個網站發布流程&lt;/h2&gt;
&lt;p&gt;在用 HTML/CSS 和基本 JS 做了幾個簡單網站之後，我想做一個部落格。發現有大量靜態網站產生器可以做到這件事。我用 Hugo、11ty 等搜尋範本。這對我理解如何操作 NodeJS 非常有幫助，因為這些範本只需要一點程式邏輯就能運作，但你會練習到建立網站的整個流程：&lt;/p&gt;
&lt;div class=&quot;expressive-code&quot;&gt;&lt;style&gt;.expressive-code{font-family:var(--ec-uiFontFml);font-size:var(--ec-uiFontSize);font-weight:var(--ec-uiFontWg);line-height:var(--ec-uiLineHt);text-size-adjust:none;-webkit-text-size-adjust:none}.expressive-code *:not(:is(svg, svg *)){all:revert;box-sizing:border-box}.expressive-code pre{display:flex;margin:0;padding:0;border:var(--ec-brdWd) solid var(--ec-brdCol);border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));background:var(--ec-codeBg)}.expressive-code pre:focus-visible{outline:3px solid var(--ec-focusBrd);outline-offset:-3px}.expressive-code pre &gt; code{all:unset;display:block;flex:1 0 100%;padding:var(--ec-codePadBlk) 0;color:var(--ec-codeFg);font-family:var(--ec-codeFontFml);font-size:var(--ec-codeFontSize);font-weight:var(--ec-codeFontWg);line-height:var(--ec-codeLineHt)}.expressive-code pre{overflow-x:auto}.expressive-code pre.wrap .ec-line .code{white-space:pre-wrap;overflow-wrap:break-word;min-width:min(20ch, var(--ecMaxLine, 20ch))}.expressive-code pre.wrap .ec-line .code span.indent{white-space:pre}.expressive-code pre::-webkit-scrollbar,.expressive-code pre::-webkit-scrollbar-track{background-color:inherit;border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));border-top-left-radius:0;border-top-right-radius:0}.expressive-code pre::-webkit-scrollbar-thumb{background-color:var(--ec-sbThumbCol);border:4px solid transparent;background-clip:content-box;border-radius:10px}.expressive-code pre::-webkit-scrollbar-thumb:hover{background-color:var(--ec-sbThumbHoverCol)}.expressive-code pre::-webkit-scrollbar-corner{background:transparent}.expressive-code .ec-line{direction:ltr;unicode-bidi:isolate;display:grid;grid-template-areas:&apos;gutter code&apos;;grid-template-columns:auto 1fr;position:relative}.expressive-code .ec-line .gutter{grid-area:gutter;color:var(--ec-gtrFg)}.expressive-code .ec-line .gutter &gt; *{pointer-events:none;user-select:none;-webkit-user-select:none}.expressive-code .ec-line .gutter ~ .code{--ecLineBrdCol:var(--ec-gtrBrdCol)}.expressive-code .ec-line.highlight .gutter{color:var(--ec-gtrHlFg)}.expressive-code .ec-line .code{grid-area:code;position:relative;box-sizing:content-box;padding-inline-start:calc(var(--ecIndent, 0ch) + var(--ec-codePadInl) - var(--ecGtrBrdWd));padding-inline-end:var(--ec-codePadInl);text-indent:calc(var(--ecIndent, 0ch) * -1)}.expressive-code .ec-line .code::before,.expressive-code .ec-line .code::after,.expressive-code .ec-line .code :where(*){text-indent:0}.expressive-code .ec-line .code{--ecGtrBrdWd:var(--ec-gtrBrdWd);border-inline-start:var(--ecGtrBrdWd) solid var(--ecLineBrdCol, transparent)}.expressive-code .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.expressive-code .ec-line.mark{--tmLineBgCol:var(--ec-tm-markBg)}.expressive-code .ec-line.mark .code{--ecLineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line.ins{--tmLineBgCol:var(--ec-tm-insBg);--tmLabel:var(--ec-tm-insDiffIndContent)}.expressive-code .ec-line.ins .code{--ecLineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line.ins .code::before{color:var(--ec-tm-insDiffIndCol)}.expressive-code .ec-line.del{--tmLineBgCol:var(--ec-tm-delBg);--tmLabel:var(--ec-tm-delDiffIndContent)}.expressive-code .ec-line.del .code{--ecLineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line.del .code::before{color:var(--ec-tm-delDiffIndCol)}.expressive-code .ec-line.mark,.expressive-code .ec-line.ins,.expressive-code .ec-line.del{background:var(--tmLineBgCol)}.expressive-code .ec-line.mark .code,.expressive-code .ec-line.ins .code,.expressive-code .ec-line.del .code{--ecGtrBrdWd:var(--ec-tm-lineMarkerAccentWd)}.expressive-code .ec-line.mark .code::before,.expressive-code .ec-line.ins .code::before,.expressive-code .ec-line.del .code::before{display:block;position:absolute;left:0;box-sizing:border-box;content:var(--tmLabel, &apos; &apos;);padding-inline-start:var(--ec-tm-lineDiffIndMargLeft);text-align:center;white-space:pre}.expressive-code .ec-line.mark.tm-label .code::before,.expressive-code .ec-line.ins.tm-label .code::before,.expressive-code .ec-line.del.tm-label .code::before{background:var(--ecLineBrdCol);padding:0 calc(var(--ec-tm-lineMarkerLabelPadInl) + var(--ec-tm-lineMarkerAccentWd)) 0 var(--ec-tm-lineMarkerLabelPadInl);color:var(--ec-tm-lineMarkerLabelCol)}.expressive-code .ec-line mark{--tmInlineBgCol:var(--ec-tm-markBg);--tmInlineBrdCol:var(--ec-tm-markBrdCol)}.expressive-code .ec-line ins{--tmInlineBgCol:var(--ec-tm-insBg);--tmInlineBrdCol:var(--ec-tm-insBrdCol)}.expressive-code .ec-line del{--tmInlineBgCol:var(--ec-tm-delBg);--tmInlineBrdCol:var(--ec-tm-delBrdCol)}.expressive-code .ec-line mark,.expressive-code .ec-line ins,.expressive-code .ec-line del{all:unset;display:inline-block;position:relative;--tmBrdL:var(--ec-tm-inlMarkerBrdWd);--tmBrdR:var(--ec-tm-inlMarkerBrdWd);--tmRadL:var(--ec-tm-inlMarkerBrdRad);--tmRadR:var(--ec-tm-inlMarkerBrdRad);margin-inline:0.025rem;padding-inline:var(--ec-tm-inlMarkerPad);border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);background:var(--tmInlineBgCol);background-clip:padding-box}.expressive-code .ec-line mark.open-start,.expressive-code .ec-line ins.open-start,.expressive-code .ec-line del.open-start{margin-inline-start:0;padding-inline-start:0;--tmBrdL:0px;--tmRadL:0}.expressive-code .ec-line mark.open-end,.expressive-code .ec-line ins.open-end,.expressive-code .ec-line del.open-end{margin-inline-end:0;padding-inline-end:0;--tmBrdR:0px;--tmRadR:0}.expressive-code .ec-line mark::before,.expressive-code .ec-line ins::before,.expressive-code .ec-line del::before{content:&apos;&apos;;position:absolute;pointer-events:none;display:inline-block;inset:0;border-radius:var(--tmRadL) var(--tmRadR) var(--tmRadR) var(--tmRadL);border:var(--ec-tm-inlMarkerBrdWd) solid var(--tmInlineBrdCol);border-inline-width:var(--tmBrdL) var(--tmBrdR)}.expressive-code .frame{all:unset;position:relative;display:block;--header-border-radius:calc(var(--ec-brdRad) + var(--ec-brdWd));--tab-border-radius:calc(var(--ec-frm-edTabBrdRad) + var(--ec-brdWd));--button-spacing:0.4rem;--code-background:var(--ec-frm-edBg);border-radius:var(--header-border-radius);box-shadow:var(--ec-frm-frameBoxShdCssVal)}.expressive-code .frame .header{display:none;z-index:1;position:relative;border-radius:var(--header-border-radius) var(--header-border-radius) 0 0}.expressive-code .frame.has-title pre,.expressive-code .frame.has-title code,.expressive-code .frame.is-terminal pre,.expressive-code .frame.is-terminal code{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.expressive-code .frame .title:empty:before{content:&apos;\a0&apos;}.expressive-code .frame.has-title:not(.is-terminal){--button-spacing:calc(1.9rem + 2 * (var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)))}.expressive-code .frame.has-title:not(.is-terminal) .title{position:relative;color:var(--ec-frm-edActTabFg);background:var(--ec-frm-edActTabBg);background-clip:padding-box;margin-block-start:var(--ec-frm-edTabsMargBlkStart);padding:calc(var(--ec-uiPadBlk) + var(--ec-frm-edActTabIndHt)) var(--ec-uiPadInl);border:var(--ec-brdWd) solid var(--ec-frm-edActTabBrdCol);border-radius:var(--tab-border-radius) var(--tab-border-radius) 0 0;border-bottom:none;overflow:hidden}.expressive-code .frame.has-title:not(.is-terminal) .title::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-top:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndTopCol);border-bottom:var(--ec-frm-edActTabIndHt) solid var(--ec-frm-edActTabIndBtmCol)}.expressive-code .frame.has-title:not(.is-terminal) .header{display:flex;background:linear-gradient(to top, var(--ec-frm-edTabBarBrdBtmCol) var(--ec-brdWd), transparent var(--ec-brdWd)),linear-gradient(var(--ec-frm-edTabBarBg), var(--ec-frm-edTabBarBg));background-repeat:no-repeat;padding-inline-start:var(--ec-frm-edTabsMargInlStart)}.expressive-code .frame.has-title:not(.is-terminal) .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border:var(--ec-brdWd) solid var(--ec-frm-edTabBarBrdCol);border-radius:inherit;border-bottom:none}.expressive-code .frame.is-terminal{--button-spacing:calc(1.9rem + var(--ec-brdWd) + 2 * var(--ec-uiPadBlk));--code-background:var(--ec-frm-trmBg)}.expressive-code .frame.is-terminal .header{display:flex;align-items:center;justify-content:center;padding-block:var(--ec-uiPadBlk);padding-block-end:calc(var(--ec-uiPadBlk) + var(--ec-brdWd));position:relative;font-weight:500;letter-spacing:0.025ch;color:var(--ec-frm-trmTtbFg);background:var(--ec-frm-trmTtbBg);border:var(--ec-brdWd) solid var(--ec-brdCol);border-bottom:none}.expressive-code .frame.is-terminal .header::before{content:&apos;&apos;;position:absolute;pointer-events:none;left:var(--ec-uiPadInl);width:2.1rem;height:0.56rem;line-height:0;background-color:var(--ec-frm-trmTtbDotsFg);opacity:var(--ec-frm-trmTtbDotsOpa);-webkit-mask-image:var(--ec-frm-trmIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-trmIcon);mask-repeat:no-repeat}.expressive-code .frame.is-terminal .header::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-bottom:var(--ec-brdWd) solid var(--ec-frm-trmTtbBrdBtmCol)}.expressive-code .frame pre{background:var(--code-background)}.expressive-code .copy{display:flex;gap:0.25rem;flex-direction:row;position:absolute;inset-block-start:calc(var(--ec-brdWd) + var(--button-spacing));inset-inline-end:calc(var(--ec-brdWd) + var(--ec-uiPadInl) / 2)}@media (scripting: none){.expressive-code .copy{display:none}}.expressive-code .copy{direction:ltr;unicode-bidi:isolate}.expressive-code .copy button{position:relative;align-self:flex-end;margin:0;padding:0;border:none;border-radius:0.2rem;z-index:1;cursor:pointer;transition-property:opacity, background, border-color;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.25, 0.46, 0.45, 0.94);width:2.5rem;height:2.5rem;background:var(--code-background);opacity:0.75}.expressive-code .copy button div{position:absolute;inset:0;border-radius:inherit;background:var(--ec-frm-inlBtnBg);opacity:var(--ec-frm-inlBtnBgIdleOpa);transition-property:inherit;transition-duration:inherit;transition-timing-function:inherit}.expressive-code .copy button::before{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;border-radius:inherit;border:var(--ec-brdWd) solid var(--ec-frm-inlBtnBrd);opacity:var(--ec-frm-inlBtnBrdOpa)}.expressive-code .copy button::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-frm-inlBtnFg);-webkit-mask-image:var(--ec-frm-copyIcon);-webkit-mask-repeat:no-repeat;mask-image:var(--ec-frm-copyIcon);mask-repeat:no-repeat;margin:0.475rem;line-height:0}.expressive-code .copy button:hover,.expressive-code .copy button:focus:focus-visible{opacity:1}.expressive-code .copy button:hover div,.expressive-code .copy button:focus:focus-visible div{opacity:var(--ec-frm-inlBtnBgHoverOrFocusOpa)}.expressive-code .copy button:active{opacity:1}.expressive-code .copy button:active div{opacity:var(--ec-frm-inlBtnBgActOpa)}.expressive-code .copy .feedback{--tooltip-arrow-size:0.35rem;--tooltip-bg:var(--ec-frm-tooltipSuccessBg);color:var(--ec-frm-tooltipSuccessFg);pointer-events:none;user-select:none;-webkit-user-select:none;position:relative;align-self:center;background-color:var(--tooltip-bg);z-index:99;padding:0.125rem 0.75rem;border-radius:0.2rem;margin-inline-end:var(--tooltip-arrow-size);opacity:0;transition-property:opacity, transform;transition-duration:0.2s;transition-timing-function:ease-in-out;transform:translate3d(0, 0.25rem, 0)}.expressive-code .copy .feedback::after{content:&apos;&apos;;position:absolute;pointer-events:none;top:calc(50% - var(--tooltip-arrow-size));inset-inline-end:calc(-2 * (var(--tooltip-arrow-size) - 0.5px));border:var(--tooltip-arrow-size) solid transparent;border-inline-start-color:var(--tooltip-bg)}.expressive-code .copy .feedback.show{opacity:1;transform:translate3d(0, 0, 0)}@media (hover: hover){.expressive-code{}.expressive-code .copy button{opacity:0;width:2rem;height:2rem}.expressive-code .frame:hover .copy button:not(:hover),.expressive-code .frame:focus-within :focus-visible ~ .copy button:not(:hover),.expressive-code .frame .copy .feedback.show ~ button:not(:hover){opacity:0.75}}.expressive-code :nth-child(1 of .ec-line) .code{padding-inline-end:calc(2rem + var(--ec-codePadInl))}.expressive-code .gutter .ln{display:inline-flex;justify-content:flex-end;align-items:flex-start;box-sizing:content-box;min-width:var(--lnWidth, 2ch);padding-inline:2ch;color:var(--ec-lineNumbers-fg)}.highlight .expressive-code .gutter .ln{color:var(--ec-lineNumbers-hlFg)}.expressive-code .ec-section{position:relative}.expressive-code .ec-section summary{position:relative;font-family:var(--ec-cs-closedFontFml);font-size:var(--ec-cs-closedFontSize);line-height:var(--ec-cs-closedLineHt);user-select:none;-webkit-user-select:none;cursor:pointer;color:var(--ec-cs-closedTextCol);background-color:var(--ec-cs-closedBgCol);--border-color:var(--ec-cs-closedBrdCol);--border-width:var(--ec-cs-closedBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);margin:var(--ec-cs-closedMarg);padding:0}.expressive-code .ec-section summary::marker{display:inline-block;content:&quot;&quot;;width:16px;height:16px}.expressive-code .ec-section summary::-webkit-details-marker{display:none}.expressive-code .ec-section summary :is(.expand, .collapse){position:relative;display:inline-block;width:16px;height:16px;vertical-align:text-bottom;opacity:0.75}.expressive-code .ec-section summary :is(.expand, .collapse)::after{content:&apos;&apos;;position:absolute;pointer-events:none;inset:0;background-color:var(--ec-cs-closedTextCol);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;line-height:0}.expressive-code .ec-section summary .expand::after{-webkit-mask-image:var(--ec-cs-expandIcon);mask-image:var(--ec-cs-expandIcon);-webkit-print-color-adjust:exact;print-color-adjust:exact}.expressive-code .ec-section summary .collapse{display:none}.expressive-code .ec-section summary .collapse::after{-webkit-mask-image:var(--ec-cs-collapseIcon);mask-image:var(--ec-cs-collapseIcon)}.expressive-code .ec-section summary .text{margin-left:1em}.expressive-code .ec-section summary .ec-line .code{padding-block:var(--ec-cs-closedPadBlk);text-indent:0}.expressive-code .ec-section[open],.expressive-code .ec-section details[open] + .content-lines{--border-color:var(--ec-cs-openBrdCol);--border-width:var(--ec-cs-openBrdWd);box-shadow:inset 0 calc(-1 * var(--border-width)) var(--border-color), inset 0 var(--border-width) var(--border-color);padding-inline:var(--ec-cs-openPad);margin-inline:var(--ec-cs-openMarg)}.expressive-code .ec-section.github[open] summary{display:none}.expressive-code .ec-section.github[open]{background-color:var(--ec-cs-openBgCol)}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end){display:flex;flex-direction:column}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) .content-lines{display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] .collapse{display:inline-block}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] :is(.expand, .text){display:none}.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open] + .content-lines{display:block;background-color:var(--ec-cs-openBgColCollapsible)}@media print{.expressive-code .ec-section:is(.collapsible-start, .collapsible-end) details[open]{display:none}}.expressive-code .ec-section.collapsible-end{flex-direction:column-reverse}:root,:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;]{--ec-brdRad:0.3rem;--ec-brdWd:1.5px;--ec-brdCol:#1b1f23;--ec-codeFontFml:jetbrains-mono;--ec-codeFontSize:0.85rem;--ec-codeFontWg:400;--ec-codeLineHt:1.65;--ec-codePadBlk:1rem;--ec-codePadInl:1.35rem;--ec-codeBg:#24292e;--ec-codeFg:#e1e4e8;--ec-codeSelBg:#3392ff44;--ec-gtrFg:#727980;--ec-gtrBrdCol:#72798033;--ec-gtrBrdWd:1.5px;--ec-gtrHlFg:#e1e4e896;--ec-uiFontFml:jetbrains-mono;--ec-uiFontSize:0.9rem;--ec-uiFontWg:400;--ec-uiLineHt:1.65;--ec-uiPadBlk:0.25rem;--ec-uiPadInl:1rem;--ec-uiSelBg:#39414a;--ec-uiSelFg:#e1e4e8;--ec-focusBrd:#005cc5;--ec-sbThumbCol:#6a737d33;--ec-sbThumbHoverCol:#6a737dd1;--ec-tm-lineMarkerAccentMarg:0rem;--ec-tm-lineMarkerAccentWd:0.15rem;--ec-tm-lineMarkerLabelPadInl:0.2rem;--ec-tm-lineMarkerLabelCol:white;--ec-tm-lineDiffIndMargLeft:0.3rem;--ec-tm-inlMarkerBrdWd:1.5px;--ec-tm-inlMarkerBrdRad:0.2rem;--ec-tm-inlMarkerPad:0.15rem;--ec-tm-insDiffIndContent:&apos;+&apos;;--ec-tm-delDiffIndContent:&apos;-&apos;;--ec-tm-markBg:#264a8980;--ec-tm-markBrdCol:#5570b3d0;--ec-tm-insBg:#26561c80;--ec-tm-insBrdCol:#4e7e41d0;--ec-tm-insDiffIndCol:#7eb070d0;--ec-tm-delBg:#81322b80;--ec-tm-delBrdCol:#ae594fd0;--ec-tm-delDiffIndCol:#e68a7ed0;--ec-frm-shdCol:#0000005b;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #0000005b;--ec-frm-edActTabBg:#24292e;--ec-frm-edActTabFg:#e1e4e8;--ec-frm-edActTabBrdCol:transparent;--ec-frm-edActTabIndHt:1.5px;--ec-frm-edActTabIndTopCol:#f9826c;--ec-frm-edActTabIndBtmCol:#24292e;--ec-frm-edTabsMargInlStart:0;--ec-frm-edTabsMargBlkStart:0;--ec-frm-edTabBrdRad:0.3rem;--ec-frm-edTabBarBg:#1f2428;--ec-frm-edTabBarBrdCol:#1b1f23;--ec-frm-edTabBarBrdBtmCol:#1b1f23;--ec-frm-edBg:#24292e;--ec-frm-trmTtbFg:#e1e4e8;--ec-frm-trmTtbDotsFg:#e1e4e8;--ec-frm-trmTtbDotsOpa:0.15;--ec-frm-trmTtbBg:#24292e;--ec-frm-trmTtbBrdBtmCol:#1b1f23;--ec-frm-trmBg:#1f2428;--ec-frm-inlBtnFg:#e1e4e8;--ec-frm-inlBtnBg:#e1e4e8;--ec-frm-inlBtnBgIdleOpa:0;--ec-frm-inlBtnBgHoverOrFocusOpa:0.2;--ec-frm-inlBtnBgActOpa:0.3;--ec-frm-inlBtnBrd:#e1e4e8;--ec-frm-inlBtnBrdOpa:0.4;--ec-frm-tooltipSuccessBg:#228739;--ec-frm-tooltipSuccessFg:white;--ec-frm-copyIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2024%2024&apos;%20fill%3D&apos;none&apos;%20stroke%3D&apos;black&apos;%20stroke-width%3D&apos;1.75&apos;%3E%3Cpath%20d%3D&apos;M3%2019a2%202%200%200%201-1-2V2a2%202%200%200%201%201-1h13a2%202%200%200%201%202%201&apos;%2F%3E%3Crect%20x%3D&apos;6&apos;%20y%3D&apos;5&apos;%20width%3D&apos;16&apos;%20height%3D&apos;18&apos;%20rx%3D&apos;1.5&apos;%20ry%3D&apos;1.5&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-frm-trmIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2060%2016&apos;%20preserveAspectRatio%3D&apos;xMidYMid%20meet&apos;%3E%3Ccircle%20cx%3D&apos;8&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;30&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3Ccircle%20cx%3D&apos;52&apos;%20cy%3D&apos;8&apos;%20r%3D&apos;8&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-lineNumbers-fg:inherit;--ec-lineNumbers-hlFg:inherit;--ec-cs-closedBrdWd:0px;--ec-cs-closedPadBlk:4px;--ec-cs-closedMarg:0;--ec-cs-closedFontFml:inherit;--ec-cs-closedFontSize:inherit;--ec-cs-closedLineHt:inherit;--ec-cs-closedTextCol:#e1e4e8;--ec-cs-closedBgCol:#58606933;--ec-cs-closedBrdCol:#58606980;--ec-cs-openBrdWd:1px;--ec-cs-openPad:0;--ec-cs-openMarg:0;--ec-cs-openBgCol:transparent;--ec-cs-openBgColCollapsible:#5860691a;--ec-cs-openBrdCol:transparent;--ec-cs-expandIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;m8.177.677%202.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25a.75.75%200%200%201-1.5%200V4H5.104a.25.25%200%200%201-.177-.427L7.823.677a.25.25%200%200%201%20.354%200ZM7.25%2010.75a.75.75%200%200%201%201.5%200V12h2.146a.25.25%200%200%201%20.177.427l-2.896%202.896a.25.25%200%200%201-.354%200l-2.896-2.896A.25.25%200%200%201%205.104%2012H7.25v-1.25Zm-5-2a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;);--ec-cs-collapseIcon:url(&quot;data:image/svg+xml,%3Csvg%20xmlns%3D&apos;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&apos;%20viewBox%3D&apos;0%200%2016%2016&apos;%3E%3Cpath%20d%3D&apos;M10.896%202H8.75V.75a.75.75%200%200%200-1.5%200V2H5.104a.25.25%200%200%200-.177.427l2.896%202.896a.25.25%200%200%200%20.354%200l2.896-2.896A.25.25%200%200%200%2010.896%202ZM8.75%2015.25a.75.75%200%200%201-1.5%200V14H5.104a.25.25%200%200%201-.177-.427l2.896-2.896a.25.25%200%200%201%20.354%200l2.896%202.896a.25.25%200%200%201-.177.427H8.75v1.25Zm-6.5-6.5a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM6%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%206%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5ZM12%208a.75.75%200%200%201-.75.75h-.5a.75.75%200%200%201%200-1.5h.5A.75.75%200%200%201%2012%208Zm2.25.75a.75.75%200%200%200%200-1.5h-.5a.75.75%200%200%200%200%201.5h.5Z&apos;%2F%3E%3C%2Fsvg%3E&quot;)}.expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])),:root:not([data-theme=&quot;dark&quot;]) .expressive-code[data-theme=&quot;dark&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--0, inherit);background-color:var(--0bg, transparent);font-style:var(--0fs, inherit);font-weight:var(--0fw, inherit);text-decoration:var(--0td, inherit)}@media (prefers-color-scheme: light){:root:not([data-theme=&quot;dark&quot;]){--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root:not([data-theme=&quot;dark&quot;]) .expressive-code .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]),.expressive-code[data-theme=&quot;light&quot;]{--ec-brdCol:#e1e4e8;--ec-codeBg:#fff;--ec-codeFg:#24292e;--ec-codeSelBg:#0366d625;--ec-gtrFg:#1b1f2381;--ec-gtrBrdCol:#1b1f2333;--ec-gtrHlFg:#24292eab;--ec-uiSelBg:#e2e5e9;--ec-uiSelFg:#2f363d;--ec-focusBrd:#2188ff;--ec-sbThumbCol:#959da533;--ec-sbThumbHoverCol:#959da5eb;--ec-tm-markBg:#9fb6ff80;--ec-tm-insBg:#94c68480;--ec-tm-insDiffIndCol:#3a692fd0;--ec-tm-delBg:#fea09280;--ec-tm-delDiffIndCol:#97453dd0;--ec-frm-shdCol:#00000028;--ec-frm-frameBoxShdCssVal:0.1rem 0.1rem 0.2rem #00000028;--ec-frm-edActTabBg:#fff;--ec-frm-edActTabFg:#2f363d;--ec-frm-edActTabIndBtmCol:#fff;--ec-frm-edTabBarBg:#f6f8fa;--ec-frm-edTabBarBrdCol:#e1e4e8;--ec-frm-edTabBarBrdBtmCol:#e1e4e8;--ec-frm-edBg:#fff;--ec-frm-trmTtbFg:#2f363d;--ec-frm-trmTtbDotsFg:#2f363d;--ec-frm-trmTtbBg:#fff;--ec-frm-trmTtbBrdBtmCol:#e1e4e8;--ec-frm-trmBg:#f6f8fa;--ec-frm-inlBtnFg:#24292e;--ec-frm-inlBtnBg:#24292e;--ec-frm-inlBtnBrd:#24292e;--ec-frm-tooltipSuccessBg:#208638;--ec-cs-closedTextCol:#24292e;--ec-cs-closedBgCol:#d1d5da33;--ec-cs-closedBrdCol:#d1d5da80;--ec-cs-openBgColCollapsible:#d1d5da1a}:root[data-theme=&quot;light&quot;] .expressive-code:not([data-theme=&quot;dark&quot;]) .ec-line :where(span[style^=&apos;--&apos;]:not([class])),.expressive-code[data-theme=&quot;light&quot;] .ec-line :where(span[style^=&apos;--&apos;]:not([class])){color:var(--1, inherit);background-color:var(--1bg, transparent);font-style:var(--1fs, inherit);font-weight:var(--1fw, inherit);text-decoration:var(--1td, inherit)}&lt;/style&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function a(e){if(!e)return;let t=e.getAttribute(&quot;tabindex&quot;)!==null,r=e.scrollWidth&gt;e.clientWidth;r&amp;&amp;!t?(e.setAttribute(&quot;tabindex&quot;,&quot;0&quot;),e.setAttribute(&quot;role&quot;,&quot;region&quot;)):!r&amp;&amp;t&amp;&amp;(e.removeAttribute(&quot;tabindex&quot;),e.removeAttribute(&quot;role&quot;))}var u=window.requestIdleCallback||(e=&gt;setTimeout(e,1)),s=window.cancelIdleCallback||clearTimeout;function l(e){let t=new Set,r,n;return new ResizeObserver(c=&gt;{c.forEach(o=&gt;t.add(o.target)),r&amp;&amp;clearTimeout(r),n&amp;&amp;s(n),r=setTimeout(()=&gt;{n&amp;&amp;s(n),n=u(()=&gt;{t.forEach(o=&gt;e(o)),t.clear()})},250)})}function i(e,t){e.querySelectorAll?.(&quot;.expressive-code pre &gt; code&quot;).forEach(r=&gt;{let n=r.parentElement;n&amp;&amp;t.observe(n)})}var d=l(a);i(document,d);var b=new MutationObserver(e=&gt;e.forEach(t=&gt;t.addedNodes.forEach(r=&gt;{i(r,d)})));b.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document,d)});})();}catch(e){console.error(&quot;[EC] tabindex-js-module failed:&quot;,e)}&lt;/script&gt;&lt;script type=&quot;module&quot;&gt;try{(()=&gt;{function l(o){let e=document.createElement(&quot;pre&quot;);Object.assign(e.style,{opacity:&quot;0&quot;,pointerEvents:&quot;none&quot;,position:&quot;absolute&quot;,overflow:&quot;hidden&quot;,left:&quot;0&quot;,top:&quot;0&quot;,width:&quot;20px&quot;,height:&quot;20px&quot;,webkitUserSelect:&quot;auto&quot;,userSelect:&quot;all&quot;}),e.ariaHidden=&quot;true&quot;,e.textContent=o,document.body.appendChild(e);let a=document.createRange();a.selectNode(e);let n=getSelection();if(!n)return!1;n.removeAllRanges(),n.addRange(a);let r=!1;try{r=document.execCommand(&quot;copy&quot;)}finally{n.removeAllRanges(),document.body.removeChild(e)}return r}async function u(o){let e=o.currentTarget,a=e.dataset,n=!1,r=a.code.replace(/\u007f/g,`
`);try{await navigator.clipboard.writeText(r),n=!0}catch{n=l(r)}if(!n||e.parentNode?.querySelector(&quot;.feedback&quot;))return;let c=e.parentNode?.querySelector(&quot;[aria-live]&quot;),t=document.createElement(&quot;div&quot;);t.classList.add(&quot;feedback&quot;),t.append(a.copied),c.append(t),t.offsetWidth,requestAnimationFrame(()=&gt;t?.classList.add(&quot;show&quot;));let s=()=&gt;!t||t.classList.remove(&quot;show&quot;),d=()=&gt;{!t||parseFloat(getComputedStyle(t).opacity)&gt;0||(t.remove(),t=void 0)};setTimeout(s,1500),setTimeout(d,2500),e.addEventListener(&quot;blur&quot;,s),t.addEventListener(&quot;transitioncancel&quot;,d),t.addEventListener(&quot;transitionend&quot;,d)}function i(o){o.querySelectorAll?.(&quot;.expressive-code .copy button&quot;).forEach(e=&gt;e.addEventListener(&quot;click&quot;,u))}i(document);var m=new MutationObserver(o=&gt;o.forEach(e=&gt;e.addedNodes.forEach(a=&gt;{i(a)})));m.observe(document.body,{childList:!0,subtree:!0});document.addEventListener(&quot;astro:page-load&quot;,()=&gt;{i(document)});})();}catch(e){console.error(&quot;[EC] copy-js-module failed:&quot;,e)}&lt;/script&gt;&lt;figure class=&quot;frame&quot;&gt;&lt;figcaption class=&quot;header&quot;&gt;&lt;/figcaption&gt;&lt;pre data-language=&quot;plaintext&quot;&gt;&lt;code&gt;&lt;div class=&quot;ec-line&quot;&gt;&lt;div class=&quot;gutter&quot;&gt;&lt;div class=&quot;ln&quot; aria-hidden=&quot;true&quot;&gt;1&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;code&quot;&gt;&lt;span style=&quot;--0:#e1e4e8;--1:#24292e&quot;&gt;Creating a new git repository &gt; create the site with NodeJS &gt; connect &amp;#x26; auto push to 3rd party host &gt; manage your domain &gt; compare the features &amp;#x26; price for each web host to best suits your objective or language.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class=&quot;copy&quot;&gt;&lt;div aria-live=&quot;polite&quot;&gt;&lt;/div&gt;&lt;button title=&quot;Copy to clipboard&quot; data-copied=&quot;Copied!&quot; data-code=&quot;Creating a new git repository &gt; create the site with NodeJS &gt; connect &amp;#x26; auto push to 3rd party host &gt; manage your domain &gt; compare the features &amp;#x26; price for each web host to best suits your objective or language.&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/button&gt;&lt;/div&gt;&lt;/figure&gt;&lt;/div&gt;
&lt;p&gt;大多數專案中唯一不同的部分只是「用 NodeJS 建立網站」，這裡你也可以用 python，但你學到的其他東西仍然適用。&lt;/p&gt;
&lt;h3 id=&quot;更多關於建立部落格&quot;&gt;更多關於建立部落格&lt;/h3&gt;
&lt;p&gt;最大的困難不是部落格功能本身，而是留言區。如果你是初學者，想寫部落格並專注在內容上，我建議你直接用 WordPress，它什麼都幫你準備好了，省事又輕鬆。&lt;/p&gt;
&lt;p&gt;否則，要為靜態部落格整合留言區，你可以用 Disqus（在隱私問題上名聲不太好，而且載入時很吃記憶體）。或者你可以用一些開源的 GitHub 登入替代方案。但據我所知，目前還沒有任何一個免費又支援 Google 登入的。或者你可以自己架後端留言伺服器，但那樣你還得處理垃圾留言過濾之類的事。對我來說不太理想。我最後就用了 Disqus，但它不會自動載入，要等使用者點「Show comments」才載入，以節省載入時間。&lt;/p&gt;
&lt;h3 id=&quot;關於-chatgpt&quot;&gt;關於 ChatGPT&lt;/h3&gt;
&lt;p&gt;它只在某種程度上有所幫助。千萬別用它處理複雜邏輯，通常會出問題。有些惱人的問題包括它改了你的程式碼卻沒通知你。它對初稿有幫助。如果你想要沒有 bug 的程式碼，它並不適合，它從來做不到。我也發現，你越要求它重新審查你的程式碼，它出的錯就越多。這比直接學會那件事並自己寫還更惱人、更耗時。&lt;/p&gt;
&lt;h3 id=&quot;接下來&quot;&gt;接下來&lt;/h3&gt;
&lt;p&gt;學習如何建立真正的後端，包含註冊/登入驗證、SQL 資料庫伺服器。也許這次我會試試 Django，並嘗試建立一個能供跨平台 app 使用的後端。&lt;/p&gt;
&lt;h2 id=&quot;目標&quot;&gt;目標&lt;/h2&gt;
&lt;p&gt;持續學習並打造有趣的專案。&lt;/p&gt;
&lt;p&gt;感謝閱讀！&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/75e9b75e-26c5-4bd2-9584-6a3974f879c9"/><enclosure url="https://cms.hongct.com/assets/75e9b75e-26c5-4bd2-9584-6a3974f879c9" length="457560" type="image/jpeg"/></item><item><title>如何在不受支援的 macOS 上取得 Xcode 15</title><link>https://hongcheung.com/tw/post/how-to-get-xcode-15-on-unsupported-macos/</link><guid isPermaLink="true">https://hongcheung.com/tw/post/how-to-get-xcode-15-on-unsupported-macos/</guid><description>Apple 總是對 Mac 設下作業系統需求限制，但仍有辦法繞過。</description><pubDate>Sat, 04 Nov 2023 12:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;img src=&quot;https://cms.hongct.com/assets/b02ab264-b26d-4f30-bb88-2bd843b771f6&quot; alt=&quot;如何在不受支援的 macOS 上取得 Xcode 15&quot; referrerpolicy=&quot;no-referrer&quot; loading=&quot;lazy&quot;/&gt;&lt;/p&gt;&lt;p&gt;據我所知，有兩種方法。&lt;/p&gt;
&lt;h2 id=&quot;1-更新你的-macos&quot;&gt;1. 更新你的 macOS&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;如果你執行的是 Monterey（或更舊版本），請嘗試在不受支援的 Mac 上使用 OpenCore Legacy Patcher 更新 macOS。&lt;a href=&quot;how-to-update-your-old-macbook-to-ventura-using-opencore-legacy-patcher&quot;&gt;請依照這裡的指南操作&lt;/a&gt;。&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;2-將支援檔案複製到-xcode-目錄&quot;&gt;2. 將支援檔案複製到 Xcode 目錄&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;只要把支援檔案複製到 Xcode 資料夾，就能輕鬆更新 Xcode，使其支援到 iOS16 開發。GitHub repo &lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://github.com/filsv/iOSDeviceSupport&quot;&gt;在這裡&lt;/a&gt;。&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;但在 iOS17 上，Apple 做了一些變更，因此變得更難支援，需要&lt;a rel=&quot;nofollow noopener noreferrer&quot; target=&quot;_blank&quot; href=&quot;https://github.com/filsv/iOSDeviceSupport/issues/178&quot;&gt;不同的方法&lt;/a&gt;。&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;我還沒試過 python 方法，因為我已經用 OCLP 成功升級我的 macOS，反正比較省事。祝好運。&lt;/p&gt;
&lt;p&gt;乾杯&lt;/p&gt;</content:encoded><media:thumbnail url="https://cms.hongct.com/assets/b02ab264-b26d-4f30-bb88-2bd843b771f6"/><enclosure url="https://cms.hongct.com/assets/b02ab264-b26d-4f30-bb88-2bd843b771f6" length="35370" type="image/jpeg"/></item></channel></rss>