MakeAWishFoundation / SwiftyMocky

Framework for automatic mock generation. Adds a set of handy methods, simplifying testing. One of the best and most complete solutions, including generics support and much more.
MIT License
1.03k stars 104 forks source link

RunPhase in Xcode project #328

Open kyzmitch opened 1 year ago

kyzmitch commented 1 year ago

Wasn't able to find how to integrate SwiftyMocky after installation using SPM in Issues or in documentation, also tried to find it on stackoverflow but with no luck.

Is it correct that after adding SwiftyMocky as swift package dependency to the xcode project it is necessary to add swiftymocky module to unit test target and then add a Run Script build phase like:

# To setup initial Mockfile
swiftymocky setup
# To generate mocks
swiftymocky generate

Could someone help figure out which path to use for swiftymocky executable if it was installed using SPM? Also, I noticed that after adding SwiftyMocky framework as a dependency to unit test target in Link Binary with libraries it can't be found in XCTestCase related unit test file if you use import

I didn't want to use CLI from brew or mint, because I see that binary is present already in SPM

markst commented 1 year ago

Seem to recall executing something like this:

/usr/bin/xcrun --sdk macosx swift package --allow-writing-to-package-directory sourcery-code-generation