Xcode Integration

Before setting up Xcode integration, we highly recommend you first get Periphery working in a terminal, as we'll be using the exact same command via Xcode. Instructions for using Periphery can be found in the Using Periphery section.

Step 1: Create an Aggregate Target

Select your project in the Project Navigator and click the + button at the bottom left of the Targets section.

Xcode integration guide step 1

Select Cross-platform and choose Aggregate. Hit Next.

Xcode integration guide step 2

Choose a name for the new target, e.g "Periphery" or "Unused Code".

Step 2: Add a Run Script Build Phase

In the Build Phases section click the + button to add a new Run Script phase.

Xcode integration guide step 3

In the shell script window enter the Periphery command. Be sure to include the --format xcode option.

Xcode integration guide step 4

Step 3: Select & Run

You're ready to roll. You should now see the new scheme in the dropdown. Select it and hit run.

Note: If you'd like others on your team to be able to use the scheme, you'll need to mark it as Shared. This can be done by selecting Manage Schemes... and selecting the Shared checkbox next to the new scheme. The scheme definition can now be checked into source control.

Xcode integration guide step 5