Work with AI assistant in the Xcode - Github Copilot, ChatGPT
- Mason Chang
- 2024年12月9日
- 讀畢需時 2 分鐘
已更新:1月23日
Currently, both GitHub Copilot and ChatGPT Desktop have been integrated into Xcode. We are stepping into the future of coding with “AI Pair Programming,” leveraging the power of AI to boost our efficiency and creativity.
(Make your boss think you’re indispensable! 😂)
GitHub Copilot
GitHub Copilot code completion in Xcode is now available in public preview (2024.10.29)(link)
Step 1:
Enable GitHub Copilot (Skip this step if already enabled)
Register and subscribe to Copilot. (30-day free trial available; you can subscribe first and cancel if it doesn’t fit your workflow.)
Step 2:
Install GitHub Copilot for Xcode
Download Github Copilot for Xcode
Step 3:
Grant Permissions
Open GitHub Copilot for Xcode.
Grant Accessibility Permission (as shown in the image).
Select Extension Permission and grant access to Xcode Source Editor (as shown in the image).
Step 4:
Verify All Permissions Have Been Successfully Granted
Step 5:
Open Xcode to Test
Type
func CalculateDaysBetweenDates(
You should see a suggestion like the image below (if not, ensure that your GitHub Copilot for Xcode is enabled).
Step 6:
Let AI Complete the Entire Code (Feel free to test the following key combinations):
Press Tab to complete the current line of code.
Press Option to display the full recommended code.
Press Option + Tab to automatically complete the entire block of code.
ChatGPT Desktop for Xcode
前置:
You need to subscribe to the Plus plan to access the Work with Apps feature. (link)
This early beta is available to Plus and Teams users.
Step 1:
Download ChatGPT Desktop
Step 2:
Click Settings
Step 3:
Turn on Enable Work with Apps
Step 4 (optional):
If you don’t want your code to be used by ChatGPT to train its model, make sure to disable the “Improve the model for everyone” option.
留言