You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-15Lines changed: 20 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,8 +82,7 @@ The guided setup is only intended for introductory purposes. Once you are famili
82
82
83
83
To get the most from Periphery, it’s important to understand how it works. Periphery first builds your project; it does this to generate the “index store”. The index store contains detailed information about the declarations (class, struct, func, etc.) in your project and their references to other declarations. Using this store, Periphery builds an in-memory graph of the relational structure of your project, supplementing it with additional information obtained by parsing each source file. Next, the graph is mutated to make it more suitable for detecting unused code, e.g., marking your project’s entry points. Finally, the graph is traversed from its roots to identify unreferenced declarations.
84
84
85
-
> **Tip**
86
-
>
85
+
> [!TIP]
87
86
> The index store only contains information about source files in the build targets compiled during the build phase. If a given class is only referenced in a source file that was not compiled, then Periphery will identify the class as unused. It's important to ensure you build all the targets you expect to contain references. For an Xcode project, this is controlled using the `--schemes` option. For a Swift package, all targets are built automatically.
88
87
89
88
If your project consists of one or more standalone frameworks that do not also contain some kind of application that consumes their interfaces, you need to tell Periphery to assume that all public declarations are used with the `--retain-public` option.
@@ -125,8 +124,7 @@ class InformalGreeter: Greeter {
125
124
}
126
125
```
127
126
128
-
> **Tip**
129
-
>
127
+
> [!TIP]
130
128
> You can ignore all unused parameters from protocols and conforming functions with the `--retain-unused-protocol-func-params` option.
131
129
132
130
#### Overrides
@@ -363,11 +361,11 @@ The `kind` override allows you to specify a custom kind that will be shown in th
363
361
364
362
## Xcode Integration
365
363
366
-
Before setting up Xcode integration, we highly recommend you first get Periphery working in a terminal, as you will be using the same command via Xcode.
364
+
Before setting up Xcode integration, first get Periphery working in a terminal, as you will be using the same command via Xcode. Your project may require passing the `-destination` argument to xcodebuild. This can be done by supplying it as an additional argument, e.g. `periphery scan ... -- -destination "generic/platform=iOS Simulator"`.
367
365
368
366
### Step 1: Create an Aggregate Target
369
367
370
-
Select your project in the Project Navigator and click the + button at the bottom left of the Targets section. Select **Cross-platform** and choose **Aggregate**. Hit Next.
368
+
Select your project in the Project Navigator and click the + button at the bottom left of the Targets section. Select **Other** and choose **Aggregate**. Hit Next.
371
369
372
370

373
371
@@ -381,19 +379,28 @@ In the **Build Phases** section, click the + button to add a new Run Script phas
381
379
382
380

383
381
384
-
In the shell script window, enter the Periphery command. Be sure to include the `--format xcode` option.
382
+
Copy and paste your Periphery command into the script input.
383
+
384
+
> [!TIP]
385
+
> 1. Include the `--format xcode` option to ensure results are always formatted correctly so that Xcode can parse them.
386
+
> 2. Use the absolute path to `periphery`.
385
387
386
388

387
389
388
-
### Step 3: Select & Run
390
+
### Step 3: Disable User Script Sandboxing
391
+
392
+
You must disable **User Script Sandboxing** for the Run Script phase. Periphery requires access to your project's index store and source files, which are blocked by Xcode's default sandbox. To disable sandboxing, set the `ENABLE_USER_SCRIPT_SANDBOXING` option to `No` in the Build Settings for the Periphery aggregate target.
393
+
394
+

395
+
396
+
### Step 4: Select & Run
389
397
390
398
You're ready to roll. You should now see the new scheme in the dropdown. Select it and hit run.
391
399
392
-
> **Tip**
393
-
>
400
+
> [!TIP]
394
401
> 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.
395
402
396
-

403
+

397
404
398
405
## Excluding Files
399
406
@@ -467,8 +474,7 @@ Periphery can analyze projects using other build systems, though it cannot drive
467
474
}
468
475
```
469
476
470
-
> **Tip**
471
-
>
477
+
> [!TIP]
472
478
> Relative paths are assumed to be relative to the current directory.
473
479
474
480
You can then invoke Periphery as follows:
@@ -477,8 +483,7 @@ You can then invoke Periphery as follows:
0 commit comments