Releases ยท seanhenry/SwiftMockGeneratorForXcode

v1-beta.28

Important

Any versions previous to v1-beta.28 will expire on 10th Sept 2022. Installing this version will fix this issue.

Changes

  • Resigns with new Developer ID to extend signing expiry date.
  • Makes universal build for both x86_64 and arm64 architectures.
  • Minimum OS version is now 11.0 (Big Sur)

Big Sur Support

  • #43 Rebuilds in Xcode 12.1 to support the new security features in Big Sur.

Thanks to @MattAydin and @dannypier for pointing this out and helping me find a fix ๐Ÿ‘

  • #41 Fixes typo in error message

Thanks to @rolandkakonyi for fixing this ๐Ÿ‘

Command line support

  • Now bundled with a command line tool to generate mocks from Terminal.
  • The app and Xcode extension are now fully sandboxed.
  • The project dependencies are now compiled and included so it can be built be anyone.
  • Improves formatting of the generated code.

Using the command line tool

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.

Sandboxing

This extension is fully sandboxed which means you need to give permission to read your project files before using it.

Give permission when automatically detecting the project path

  • Open the companion app.
  • Press "Give permission to read directory".
  • Select the directory and press "Grant permission".
  • In Xcode, generate your test double.

Give permission when manually choosing the project path

  • Open the companion app.
  • Press the select directory button.
  • Select the directory and press "Open".
  • In Xcode, generate your test double.

Please note if using manual project paths before v0.25 you will have to select your project path again.

Fixes automation issue

v1-beta.24

Merge sk-fix into master

Catalina and Xcode 11 support

  • Built for Catalina and Mojave only.
  • Performance fixes for resolving mocked types.

Please see the latest release for a build.

Improved Xcode 11 support

Please see the latest release.

Xcode 11

Please see the latest release.

Parses `open` keyword

  • Parses the open keyword when used as an identifier.

Subscripts

  • Supports most subscript features *
  • Adds fixes for Swift 5
  • The app bundle is now notarized by Apple

* Missing subscript features include closure arguments and generic parameters.

Breaking Changes

  • Dummies now generate a fatalError() if a default value cannot be found for the return type.
  • Swift 5 no longer allows for IUOs in arrays ([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

  • Adds more logging around SourceKit errors
  • Adds a new test double - "partial spy"

What is a partial spy?

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"