Skip to content

Releases: seanhenry/SwiftMockGeneratorForXcode

Mojave and Xcode 10 Support

12 Oct 14:56

Choose a tag to compare

Pre-release
  • Built against the latest macOS SDK.
  • Supports Swift 4.2 syntax
  • Fixes issue where app cannot be opened when Xcode app has different name #15
  • Supports inferred properties with String, Int, Double, Bool literal types. var a = "abc"
  • Supports inferred properties with Array/Dictionary literals with resolvable types or supported literals. var a = [0, 1, 2]
  • Supports inferred properties with resolvable initializers. var a = A()
  • Supports inferred properties with as or is expression. var a = b as String or var a = b is Bool
  • Supports inferred properties with tuple types with resolvable items or supported literals. var a = (0, true)
  • Logs SourceKit errors

Important
Mojave now requires apps to request permission when automating other apps. This app automates Xcode to find the open project directory. Starting with this release you must select OK for the '"Swift Mock Generator for Xcode" wants access to control "Xcode"' alert when you open the app. Check System Preferences -> Security & Privacy -> Privacy -> Automation and make sure Swift Mock Generator is allowed to control Xcode.

Class support I

15 Jul 13:51

Choose a tag to compare

Class support I Pre-release
Pre-release

This is the first release to support mocking classes 🎉

Please note that note that properties with inferred types are not yet supported and are ignored. Mocks with these items should still compile. Support for these are coming soon.

Release notes:

  • Generate a mock inheriting from a class.
  • Generate a mock inheriting from a class and one or more protocols.
  • A convenience initializer is generated and a super initializer is called with default values where possible.
  • Unoverridable items like private, fileprivate, static, and final are ignored.
  • Instance methods from classes are supported including methods with default parameters.
  • Properties with explicit type annotations are supported var myProp: String = ""
  • Properties with unoverridable setters using private(set), fileprivate(set) are supported.
  • Computed properties are supported var myProp: String { return "" }
  • Transient properties are supported
var myProp: String {
  get { return otherValue }
  set { otherValue = newValue }
}

Performance improvements

23 Jun 10:45

Choose a tag to compare

Pre-release

Thanks to everyone who filled out the survey. It's given me a good idea what to build next... starting with this performance improvements release. The survey is still open if you want to help shape this project. Class support is my next focus.

Release notes:

  • Reduces the overall memory footprint.
  • Improves resolving performance and caches already resolved items.
  • Improves performance of indenting the generated code.
  • Efficiently removes and inserts code, greatly shortening the time to generate a nested test double class.
  • Indents code using tabs or spaces defined in your Xcode project.

Spies, Stubs and Dummies

02 Jun 10:39

Choose a tag to compare

Pre-release

I have 5 multiple choice questions for you to help make this plugin better. 60 seconds of your time will really help! Take the survey. Answers are completely anonymous - thanks in advance!

Release notes:

  • 'Generate mock' has been renamed to 'Generate spy' to fit in better with test double naming. Important: you may have to reassign your shortcut
  • Can now generate a simpler test double when only stubbing is required. Choose 'Generate stub'.
  • Can now generate the simplest possible test double; a dummy. Choose 'Generate dummy'.

Multiple Protocols

21 Apr 06:53

Choose a tag to compare

Multiple Protocols Pre-release
Pre-release
  • Supports a mock conforming to one or many protocols.
  • Supports a mock conforming to a protocol who also conforms to other protocols.
  • Ignores classes or type which cannot be resolved.
  • Removes duplicate initializers, properties and methods from multiple protocols.
  • Adds default return type for closures and tuples where possible.
  • Supports most initializers (generic initializers not yet supported).

Breaking changes

  • No longer calls empty closures automatically. You must now instruct the mock to call empty closures just like you would closures with arguments. Example: myMock.shouldInvokeEmptyClosure = true

Xcode 9.3

08 Apr 23:09

Choose a tag to compare

Xcode 9.3 Pre-release
Pre-release
  • App and dependencies built using Xcode 9.3 and Swift 4.1
  • Fixes issue with automatically detecting projects

New parser

15 Mar 07:21

Choose a tag to compare

New parser Pre-release
Pre-release

This release swaps SourceKit for a custom Swift parser. This is a huge change so please raise any new issues that you find.

Also in this release:

  • Support for methods with where clauses
  • Support for methods with generic arguments inside arrays, dictionaries and optionals.
  • Stub a throwing method to throw if required.

Generic method support and new icon

03 Mar 05:56

Choose a tag to compare

Pre-release
  • Captures generic parameters as Any.
  • Enables stubbing of generic return types.
  • New app icon.
  • Sends anonymous usage statistics.

Note: where clauses are not supported yet.

Auto-detect Xcode project path

24 Feb 01:24

Choose a tag to compare

Pre-release
  • Attempts to automatically detect the working project directory.
  • Option to turn off auto detection and manually override the project path.

Typealias closure support

04 Feb 06:23

Choose a tag to compare

Pre-release
  • Detects closures referenced by typealiases.
  • Supports attributed closures referenced by typealiases.