Skip to content

Support protocol init requirements #81

@bradleymackey

Description

@bradleymackey

Is your feature request related to a problem? Please describe.
A spy is currently unable to be generated for init requirements. Any protocol with an init requirement will not synthesize correctly.

Describe the solution you'd like

protocol Thing {
  init(time: Double)
}

Should generate:

class ThingSpy: Thing {
  init() {}
  var initTimeReceivedTime: Double!
  required init(time: Double) {
    initTimeReceivedTime = time
  }
}

Describe alternatives you've considered
N/A

Additional context

  • A default init without any parameters should still be generated.
  • Only 1 value needs to be captured from the init requirements, because the object can only be created once.
  • init protocol requirements must be prefixed with the required keyword.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions