SwiftMockGeneratorForXcode icon indicating copy to clipboard operation
SwiftMockGeneratorForXcode copied to clipboard

Support to create Stub for framework classes

Open Dinalli opened this issue 6 years ago • 1 comments

I would like to be able to create Stub / Spy of framework objects.

import Photos

class PHAssetMock: PHAsset { }

Dinalli avatar Dec 18 '18 15:12 Dinalli

Hi @Dinalli

Thanks for raising this issue. Creating test doubles from frameworks will require a more sophisticated configuration for SourceKit which unfortunately is quite involved see this previous issue. I'm planning to eventually add support for third party support but it won't be ready any time soon since it is a lot of work.

The easiest work around for now would be to extract PHAsset to a protocol and decouple yourself from the Photos framework which would allow you to stub the protocol.

seanhenry avatar Dec 26 '18 14:12 seanhenry