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
+33-1Lines changed: 33 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# Swift Mock Generator Xcode Source Editor Extension
2
2

3
3
4
-
An Xcode extension (plugin) to generate [spy](#what-is-a-spy), [stub](#what-is-a-stub), [dummy](#what-is-a-dummy), and [partial spy](#what-is-a-partial-spy) classes automatically.
4
+
An Xcode extension (plugin) and command line tool to generate [spy](#what-is-a-spy), [stub](#what-is-a-stub), [dummy](#what-is-a-dummy), and [partial spy](#what-is-a-partial-spy) classes automatically.
@@ -18,6 +18,26 @@ An Xcode extension (plugin) to generate [spy](#what-is-a-spy), [stub](#what-is-a
18
18
- Go to `System Preferences -> Security & Privacy -> Privacy -> Automation` and make sure `Swift Mock Generator` is enabled.
19
19
- Open Xcode
20
20
21
+
## Sandboxing
22
+
23
+
This extension is fully sandboxed which means you need to give permission to read your project files before using it.
24
+
25
+
### Give permission when automatically detecting the project path
26
+
27
+
- Open the companion app.
28
+
- Press "Give permission to read directory".
29
+
- Select the directory and press "Grant permission".
30
+
- In Xcode, generate your test double.
31
+
32
+
### Give permission when manually choosing the project path
33
+
34
+
- Open the companion app.
35
+
- Press the select directory button.
36
+
- Select the directory and press "Open".
37
+
- In Xcode, generate your test double.
38
+
39
+
**Please note if using manual project paths before v0.25 you will have to select your project path again.**
40
+
21
41
## How to create a new Swift test double
22
42
23
43
- Create an empty class inheriting from a class or protocols that you wish to mock.
@@ -47,6 +67,18 @@ The mock generator will replace anything that is currently in your class with th
47
67
48
68
Undo is supported for Xcode plugins but you're safer to use a version control system such as `git` in the event of unexpectedly generating a test double.
49
69
70
+
## Using the command line tool
71
+
72
+
For convenience, create a symbolic link to the CLI.
73
+
74
+
```
75
+
$ ln -s "/Applications/Swift Mock Generator for Xcode.app/Contents/MacOS/genmock" /usr/local/bin/genmock
76
+
```
77
+
78
+
Use `$ genmock --help` for a list of options.
79
+
80
+
See how this project generates its mocks [here](https://github.com/seanhenry/SwiftMockGeneratorForXcode/blob/master/genmocks.sh).
0 commit comments