Following these few simple steps, you can integrate mock generation with XCode, triggering it by key shortcut.
Create mock.sh
file in project root directory, that will execute mock generation. We are wrapping all mock tasks in Rakefile, so we can just trigger rake mock
.
// mock.sh
#!/bin/sh
swiftymocky generate
Make it executable, by executing in terminal:
chmod +x mock.sh
- Open settings (
⌘ ,
) - Navigate to
Behaviors
tab - Tap little
+
on bottom of the behaviors list - Name your behavior (like "Generate Mock")
- Press
⌘
(cmd) icon on the right part of added behavior entry. - Record shortcut
- Select
Run
checkbox - Choose script from disk (If it is grayed out - it means it is not enabled to be executed. Look to step 1)
- [optional] change sound notification, which will play when mock generation is finished
Execute recorded shortcut, and watch stuff being done :)