<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Xcode &#8211; 隨心所欲</title>
	<atom:link href="https://doeverythingiwant.com/tag/xcode/feed/" rel="self" type="application/rss+xml" />
	<link>https://doeverythingiwant.com</link>
	<description>iOS Developer 的隨筆記錄</description>
	<lastBuildDate>Sun, 08 Mar 2026 09:39:52 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://doeverythingiwant.com/wp-content/uploads/2025/08/cropped-0802.png</url>
	<title>Xcode &#8211; 隨心所欲</title>
	<link>https://doeverythingiwant.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>[AI] Xcode 26 與 AI</title>
		<link>https://doeverythingiwant.com/ai-xcode-26-and-ai/</link>
					<comments>https://doeverythingiwant.com/ai-xcode-26-and-ai/#respond</comments>
		
		<dc:creator><![CDATA[艾普利]]></dc:creator>
		<pubDate>Sun, 08 Mar 2026 09:39:49 +0000</pubDate>
				<category><![CDATA[寫程式]]></category>
		<category><![CDATA[AI]]></category>
		<category><![CDATA[Apple intelligence]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Xcode]]></category>
		<guid isPermaLink="false">https://doeverythingiwant.com/?p=2512</guid>

					<description><![CDATA[Photo by Immo Wegmann on Unspl&#8230;]]></description>
										<content:encoded><![CDATA[
<p class="has-text-align-center">Photo by <a href="https://unsplash.com/@tinkerman?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText" target="_blank" rel="noopener">Immo Wegmann</a> on <a href="https://unsplash.com/photos/a-piece-of-cardboard-with-a-keyboard-appearing-through-it-vi1HXPw6hyw?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText" target="_blank" rel="noopener">Unsplash</a></p>



<p>Xcode 26 終於可以使用 AI 啦~~雖然去年的發表了，我因為公司在趕專案累到爆，回家就不想開電腦，前一陣子才開始使用，覺得很好玩(?)</p>



<p>不過，相信很多人應該都有用 Claude code 這位神奇的夥伴，和在 Xcode 裡直接使用體驗不太一樣。 </p>



<p>這篇簡單寫一下要怎麼使用，最後加上我個人的小心得</p>



<span id="more-2512"></span>



<h2 class="wp-block-heading">前置作業</h2>



<ul class="wp-block-list">
<li>需要有 Xcode 26</li>



<li>macOS 需要升到Tahoe</li>



<li>ChatGPT 帳號或 Claude 的付費帳號<br></li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Xcode 26</h2>



<p>設定 AI Tool 的方式，先點開 Xcode 的 Setting </p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img fetchpriority="high" decoding="async" width="470" height="578" src="https://doeverythingiwant.com/wp-content/uploads/2026/03/AI01.png" alt="" class="wp-image-2514" style="width:446px;height:auto" srcset="https://doeverythingiwant.com/wp-content/uploads/2026/03/AI01.png 470w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI01-244x300.png 244w" sizes="(max-width: 470px) 100vw, 470px" /></figure>
</div>


<p>在左側選單上可以看到 Intelligence 的選項，Xcode 內建 ChatGPT 與 Claude ，只要點下去登入就可以了，ChatGPT 免費帳號就可以使用，但 Claude 必須要是付費帳號才可以使用 。</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><img decoding="async" width="1024" height="822" src="https://doeverythingiwant.com/wp-content/uploads/2026/03/AI02-1024x822.png" alt="" class="wp-image-2515" style="aspect-ratio:1.2457363416976752;width:730px;height:auto" srcset="https://doeverythingiwant.com/wp-content/uploads/2026/03/AI02-1024x822.png 1024w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI02-300x241.png 300w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI02-768x617.png 768w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI02-1536x1233.png 1536w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI02-1170x939.png 1170w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI02-585x470.png 585w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI02.png 1724w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">使用方式</h2>


<div class="wp-block-image is-style-default">
<figure class="alignleft size-full is-resized"><img decoding="async" width="784" height="2140" src="https://doeverythingiwant.com/wp-content/uploads/2026/03/AI03.png" alt="" class="wp-image-2518" style="aspect-ratio:0.3663558394999438;width:240px;height:auto" srcset="https://doeverythingiwant.com/wp-content/uploads/2026/03/AI03.png 784w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI03-110x300.png 110w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI03-375x1024.png 375w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI03-768x2096.png 768w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI03-563x1536.png 563w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI03-750x2048.png 750w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI03-585x1597.png 585w" sizes="(max-width: 784px) 100vw, 784px" /></figure>
</div>


<p>首先，要切到 AI 功能，可以由圖示中的 (1) 的按鈕作切換</p>



<p>(2) 的按鈕可以選擇想要使用的AI 模型是哪一種</p>



<p>(3) 可以選擇對話串</p>



<p>(4) 是歷史記錄，不過，不知道是不是因為我使用的是免費帳號，只要重開Xcode 後，歷史記錄就會消失了</p>



<p>(5) 就是下Prompt 的地方</p>



<p></p>



<p></p>



<p></p>



<p></p>



<p></p>



<p></p>



<p></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">Coding</h2>



<p>在範例圖中，我下了「在頂部加上搜尋列」，它就會自動幫我修改程式，會先告訴你會怎麼調整，然後就會直接調整了。</p>



<p>AI 調整的部分會用彩色Highlight 標示，一般有使用 Git 的話，也會用單一顏色來表示調整過的地方，說不定Apple 就是為了特別區別自己調整的與 AI 調整的才用彩色Highlight。</p>



<p>手機使用 AI 的時候也會有彩色Highlight出現，Apple 就是這一點我覺得做得很不錯，統一提示，只要在Apple 的產品看到彩色Highlight就會知道是AI 的東西</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="2334" height="1390" src="https://doeverythingiwant.com/wp-content/uploads/2026/03/AI04.png" alt="" class="wp-image-2519" srcset="https://doeverythingiwant.com/wp-content/uploads/2026/03/AI04.png 2334w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI04-300x179.png 300w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI04-1024x610.png 1024w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI04-768x457.png 768w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI04-1536x915.png 1536w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI04-2048x1220.png 2048w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI04-1920x1143.png 1920w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI04-1170x697.png 1170w, https://doeverythingiwant.com/wp-content/uploads/2026/03/AI04-585x348.png 585w" sizes="(max-width: 2334px) 100vw, 2334px" /></figure>
</div>


<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading">心得</h2>



<p>在 Xcode 使用 AI 就是這麼簡單，我個人覺得比 Claude code 的入門簡單一點，不過，Claude code 能做的事情很多，多學一點完全沒有問題。</p>



<p>在上面的範例中，下完指令之後它就會自動修改程式，實際上，若使用在即有專案它遇到問題的時候也是會先詢問，例如「這會影響到某個檔案是否需要一起調整」、「這需要看某個檔案是否可以檢視它」之類的。</p>



<p>若是請它調整即有的程式，我會先要求提出調整計畫，確認它會修改什麼、怎麼修改，才讓它執行，不會一下子就讓它調整。</p>



<p>當把AI 做為小幫手的時候，比較需要學習的是Prompt 要怎麼下，它寫出來的東西也要Review 。 我個人這陣子的使用心得是覺得很有趣，當然也會有覺得害怕的部分，但有趣佔大多數，它會寫出一些我從來沒有想過的方式，也可以學習，就是和過去一樣「把好的東西學起來」。</p>



<p>最後祝大家 Coding 愉快</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://doeverythingiwant.com/ai-xcode-26-and-ai/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[iOS] Xcode Preview trouble shootings</title>
		<link>https://doeverythingiwant.com/ios-xcode-preview-trouble-shootings/</link>
					<comments>https://doeverythingiwant.com/ios-xcode-preview-trouble-shootings/#respond</comments>
		
		<dc:creator><![CDATA[艾普利]]></dc:creator>
		<pubDate>Sat, 01 Feb 2025 09:26:31 +0000</pubDate>
				<category><![CDATA[寫程式]]></category>
		<category><![CDATA[Preview]]></category>
		<category><![CDATA[SwiftUI]]></category>
		<category><![CDATA[Xcode]]></category>
		<guid isPermaLink="false">https://doeverythingiwant.com/?p=2377</guid>

					<description><![CDATA[自從開始使用 SwiftUI 後，Xcode 內的 Prev&#8230;]]></description>
										<content:encoded><![CDATA[
<p>自從開始使用 SwiftUI 後，Xcode 內的 Preview 就變得非常重要，且它本身也是非常好用的東西，可以即時顯示 UI的樣式，大多數的情況下，可以說是完全反應結果，真的很好用。</p>



<p>但是在某些情況下就是無法顯示出來，會讓人覺得很煩燥，有一種解決方式是把 Perviews simulator 刪除，讓它自動重新再產生。</p>



<span id="more-2377"></span>



<p>有不少人覺得Preview 不好用，主要有幾個理由：如果不是 M系列 CPU 根本很難出現、電腦會變慢、三步五十就壞掉…等等。我自己剛開始在用的時候，也常常不知道為什麼它會跑不出來或是壞掉，簡單去研究一下才知道一些事情，也大概知道為什麼會這樣。</p>



<p>如果你的 Xcode 也常常Preview 上一秒還可以用下一秒就跑不出來的話，接下來要說的方法，說不定可以解決你的煩惱!</p>



<h2 class="wp-block-heading">認識一下 Xcode Preview</h2>



<p>在使用 SwiftUI 時，Xcode 畫面右邊這區就是 Preview畫面出現的地方，在 Xcode 裡是叫 Canvas，它是用來呈現寫在 <code>#Preview</code> 裡的程式碼，雖然不知道是不是大家都這樣，但我習慣叫它Preview 而不是 Canvas。實際上它也是把模擬器跑起來，所以若不是使用Apple 的 M 系列核心，會很難跑起來…</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="617" src="https://doeverythingiwant.com/wp-content/uploads/2025/02/Preview-1024x617.png" alt="" class="wp-image-2390" srcset="https://doeverythingiwant.com/wp-content/uploads/2025/02/Preview-1024x617.png 1024w, https://doeverythingiwant.com/wp-content/uploads/2025/02/Preview-300x181.png 300w, https://doeverythingiwant.com/wp-content/uploads/2025/02/Preview-768x463.png 768w, https://doeverythingiwant.com/wp-content/uploads/2025/02/Preview-1536x926.png 1536w, https://doeverythingiwant.com/wp-content/uploads/2025/02/Preview-2048x1234.png 2048w, https://doeverythingiwant.com/wp-content/uploads/2025/02/Preview-1920x1157.png 1920w, https://doeverythingiwant.com/wp-content/uploads/2025/02/Preview-1170x705.png 1170w, https://doeverythingiwant.com/wp-content/uploads/2025/02/Preview-585x353.png 585w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Preview的一些問題</h2>



<p>Preview 算是可以即時顯示出程式碼修改後的結果，是真的很方便，但是有時候也是會跑不出來，當然語法寫錯或是有些資料沒有給它(Preview 使用到得資料需要寫在 <code>#Preview</code> 裡，它是獨立的)，就無法顯示出來。這樣的問題可以檢查一下基本上就可以解決了，但有時候就是明明沒什麼問題，但一直轉半天畫面都沒有出現。</p>



<p>在個人經驗裡有二個情況比較容易發生</p>



<ul class="wp-block-list">
<li>在二、三個專案中切換</li>



<li>在不同的Git branch 中切換</li>
</ul>



<p>實作過程中難免會需要在不同的專案或不同的 Branch 中切換，就可能會<strong>遇到上一秒還顯示出現，下一秒就顯示不出來</strong>情況。</p>



<h2 class="wp-block-heading">解決方式</h2>



<p>如果是在同一個專案發生這個情況可以先試試 <strong>Clear Build + Delete DerivedData </strong>，也許就可以解決這個問題，但如果怎麼樣都無法解決的話，可以試試下面方式。</p>



<p>順便提一下，想刪除 <strong>DerivedData</strong> 可以從下圖開啟資料夾，再把資料夾裡的東西全丟到垃圾筒即可</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="677" src="https://doeverythingiwant.com/wp-content/uploads/2025/02/0201-1024x677.png" alt="" class="wp-image-2392" srcset="https://doeverythingiwant.com/wp-content/uploads/2025/02/0201-1024x677.png 1024w, https://doeverythingiwant.com/wp-content/uploads/2025/02/0201-300x198.png 300w, https://doeverythingiwant.com/wp-content/uploads/2025/02/0201-768x508.png 768w, https://doeverythingiwant.com/wp-content/uploads/2025/02/0201-1536x1016.png 1536w, https://doeverythingiwant.com/wp-content/uploads/2025/02/0201-1170x774.png 1170w, https://doeverythingiwant.com/wp-content/uploads/2025/02/0201-780x516.png 780w, https://doeverythingiwant.com/wp-content/uploads/2025/02/0201-585x387.png 585w, https://doeverythingiwant.com/wp-content/uploads/2025/02/0201-263x175.png 263w, https://doeverythingiwant.com/wp-content/uploads/2025/02/0201.png 1666w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="541" src="https://doeverythingiwant.com/wp-content/uploads/2025/02/02012-1024x541.png" alt="" class="wp-image-2393" srcset="https://doeverythingiwant.com/wp-content/uploads/2025/02/02012-1024x541.png 1024w, https://doeverythingiwant.com/wp-content/uploads/2025/02/02012-300x158.png 300w, https://doeverythingiwant.com/wp-content/uploads/2025/02/02012-768x406.png 768w, https://doeverythingiwant.com/wp-content/uploads/2025/02/02012-1170x618.png 1170w, https://doeverythingiwant.com/wp-content/uploads/2025/02/02012-585x309.png 585w, https://doeverythingiwant.com/wp-content/uploads/2025/02/02012.png 1522w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>剛剛有說到，其實Preview 也是跑模擬器，所以直接全部刪除讓它們重新產生，就和<strong>Delete DerivedData</strong> 的作法差不多，因為不確定到底是什麼問題就直接全刪，和「重開機治百病」一樣的感覺 <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p>首先，開啟Terminal，不需要移動到其他位置，然後輸入以下指令</p>



<pre class="wp-block-code"><code>xcrun simctl --set previews delete unavailable</code></pre>



<p>會需要跑一點點時間，跑完之後會出現以下文字</p>



<pre class="wp-block-code"><code>Using Previews Device Set: '/Users/userName/Library/Developer/Xcode/UserData/Previews/Simulator Devices'</code></pre>



<p>這樣當你重新開啟 Xcode 之後，Preview 的模擬器就會再重新Create，這樣也許可以解決 Preview 轉半天沒有出現的情況。</p>



<p>希望這個方式能有幫助~</p>



<p>最後，祝大家 Coding 愉快!!</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://doeverythingiwant.com/ios-xcode-preview-trouble-shootings/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>[iOS][UITEST]  Run destination – is not valid for you have chosen to perform</title>
		<link>https://doeverythingiwant.com/iosuitest-run-destination-is-not-valid/</link>
					<comments>https://doeverythingiwant.com/iosuitest-run-destination-is-not-valid/#respond</comments>
		
		<dc:creator><![CDATA[艾普利]]></dc:creator>
		<pubDate>Sat, 27 Aug 2022 07:18:00 +0000</pubDate>
				<category><![CDATA[寫程式]]></category>
		<category><![CDATA[#iOS]]></category>
		<category><![CDATA[UI Test]]></category>
		<category><![CDATA[Xcode]]></category>
		<guid isPermaLink="false">https://doeverythingiwant.com/?p=119</guid>

					<description><![CDATA[在跑 UI Test時候出現了一個警示，是說 iPhone &#8230;]]></description>
										<content:encoded><![CDATA[
<p>在跑 UI Test時候出現了一個警示，是說 iPhone XS 無法執行Tests，當下只是覺得奇怪明明前一陣子都跑的好好的，怎麼現在不行了</p>



<p>這個UI Test 是跑在基於 UI Kit 所建立的App ， SwiftUI 的情況是否一樣並無法保証</p>



<span id="more-119"></span>



<p>仔細看了內容，其實是告知你需選擇有支援的 iOS 版本</p>



<p>要解決這個問題的方式，在 Build Settings -&gt; Deployment -&gt; iOS Deployment Target</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="407" src="https://doeverythingiwant.com/wp-content/uploads/2022/09/001-1024x407.png" alt="" class="wp-image-176" srcset="https://doeverythingiwant.com/wp-content/uploads/2022/09/001-1024x407.png 1024w, https://doeverythingiwant.com/wp-content/uploads/2022/09/001-300x119.png 300w, https://doeverythingiwant.com/wp-content/uploads/2022/09/001-768x305.png 768w, https://doeverythingiwant.com/wp-content/uploads/2022/09/001-1536x610.png 1536w, https://doeverythingiwant.com/wp-content/uploads/2022/09/001-2048x813.png 2048w, https://doeverythingiwant.com/wp-content/uploads/2022/09/001-600x238.png 600w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>選一下比現在或更早的OS版本，再重新跑一次 UI Test 就可以</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="702" src="https://doeverythingiwant.com/wp-content/uploads/2022/09/002-1024x702.png" alt="" class="wp-image-177" srcset="https://doeverythingiwant.com/wp-content/uploads/2022/09/002-1024x702.png 1024w, https://doeverythingiwant.com/wp-content/uploads/2022/09/002-300x206.png 300w, https://doeverythingiwant.com/wp-content/uploads/2022/09/002-768x526.png 768w, https://doeverythingiwant.com/wp-content/uploads/2022/09/002-1536x1052.png 1536w, https://doeverythingiwant.com/wp-content/uploads/2022/09/002-2048x1403.png 2048w, https://doeverythingiwant.com/wp-content/uploads/2022/09/002-600x411.png 600w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>這個問題看起來並不會在Unit Test 發生，也許是因為UI Text 是必需把App 跑起來的關係吧?</p>



<p>Reference在這裡 <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2b07.png" alt="⬇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p><a href="https://stackoverflow.com/questions/58078991/unable-to-run-unit-tests-in-xcode-11-the-run-destination-is-not-valid-for-tes" rel="noreferrer noopener" target="_blank">Unable To Run Unit Tests in Xcode 11: The run destination * is not valid for tests you have chosen to perform</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://doeverythingiwant.com/iosuitest-run-destination-is-not-valid/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
