An Xcode extension (plugin) to generate Swift test doubles automatically.
Important
Any versions previous to v1-beta.28 will expire on 10th Sept 2022. Installing this version will fix this issue.
Changes
Thanks to @MattAydin and @dannypier for pointing this out and helping me find a fix 👍
Thanks to @rolandkakonyi for fixing this 👍
For convenience, create a symbolic link to the CLI.
$ ln -s "/Applications/Swift Mock Generator for Xcode.app/Contents/MacOS/genmock" /usr/local/bin/genmock
Use $ genmock --help
for a list of options.
See how this project generates its mocks here.
This extension is fully sandboxed which means you need to give permission to read your project files before using it.
Please note if using manual project paths before v0.25 you will have to select your project path again.
Please see the latest release for a build.
Please see the latest release.
Please see the latest release.
open
keyword when used as an identifier.* Missing subscript features include closure arguments and generic parameters.
Breaking Changes
fatalError()
if a default value cannot be found for the return type.[Int!]
). They are now generated as optionals ([Int?]
).Example:
protocol P {
var property: Int! { set get }
}
Swift 4
...
var invokedProperty: Int?
var invokedPropertyList = [Int!]()
...
Swift 5
...
var invokedProperty: Int?
var invokedPropertyList = [Int?]()
...
Partial spies are spies which can also forward calls to the original implementation.
E.g.
class MyClass {
func myMethod() {
print("original implementation")
}
}
class MyClassPartialSpy: MyClass {
... // generated partial spy
}
let mySpy = MyClassPartialSpy()
mySpy.myMethod() // does not print "original implementation"
mySpy.forwardToOriginalMyMethod = true
mySpy.myMethod() // prints "original implementation"