Skip to content

Unable to use given(self) inside a convenience init #98

@markst

Description

@markst

We use convenience initialisers in order to provide reusable mocked instances:

image

The compiler is warning us of:

'given' is deprecated: Use given(_ service:) instead. 

However when replacing with:

convenience init(metadata: SpotlightMetadataModel, isInWatchlist: Bool) {
  self.init(policy: .relaxed)
  given(self)

We get the following error:

Use of 'given' refers to instance method rather than global function 'given' in module 'Mockable'

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