Follow the steps below to view ARHeadsetKit's tutorials in the Xcode documentation viewer.
- In Xcode, go to File -> New -> Project.
- Ensure you are under the "iOS" template section.
- The "App" template is selected by default. Leave this template selected.
- Click "Next". Enter "ARHeadsetKit Documentation" as the product's name.
- Under "Team", select your Apple account.
- Click "Next" and save the project.
If this is your first time using Xcode, perform the following steps to ensure the project can compile:
- Connect your iPhone or iPad to your Mac.
- At the top of the Xcode window, a simulator will be selected as the run destination. Change that to your device.
- Press
Cmd + B
. No errors should appear in Xcode.
- In the menu bar, go to File -> Add Packages. A window for searching Swift packages will pop up.
- In the search bar on the top right, paste this link: https://github.com/philipturner/ARHeadsetKit
- Set "Dependency Rule" to "Branch". Ensure "main" is in the text box to the right of that.
- Click "Add Package" on the bottom right. Click "Add Package" again in the window that pops up.
- Press
Ctrl + Cmd + Shift + D
. The documentation viewer will pop up. - In the navigator on the left, there is a section titled "Workspace Documentation". "ARHeadsetKit Documentation" will appear underneath it, with a blue Xcode logo next to it.
- Unravel the contents of "ARHeadsetKit Documentation" and click "Welcome to ARHeadsetKit".
- Go to Chapter 1: Essentials. Click on "Setting Up ARHeadsetKit".
- A tutorial will pop up. Download the project files, which contain sample code. After practicing how to update documentation (shown below), proceed with the tutorial.
When first opening sample code from a tutorial, there may be an error with loading Swift packages. If that happens, close out of the project and open it a second time.
Periodically, do the following to make sure ARHeadsetKit and its tutorials are up to date:
- In the bottom left of the Xcode window, right-click "ARHeadsetKit" under "Package Dependencies".
- Click "Update Package". In the top of the Xcode window, you will see tasks related to package loading in progress.
- Once the package has finished updating, press
Ctrl + Cmd + Shift + D
. - If you are working on a project that uses ARHeadsetKit, go to that one and repeat steps 1–2.
To view documentation for a specific symbol while working on source code:
- Right-click on any ARHeadsetKit type or function in your Swift source code.
- Click "Quick Help".
- In the popup, click "Open in Developer Documentation".
Xcode's documentation viewer only supports Swift code, not ARHeadsetKit's Metal utility functions. Metal code will only show documentation in the "Quick Help" panel.
Note: The "Open in Developer Documentation" link may not appear for Swift types and functions when another Xcode project was opened recently. If that happens, restart Xcode and open just the project you intend to work on. After that, you may open others.