seanhenry / SwiftMockGeneratorForXcode

An Xcode extension (plugin) to generate Swift test doubles automatically.
MIT License
748 stars 47 forks source link

Support to create Stub for framework classes #19

Open Dinalli opened 5 years ago

Dinalli commented 5 years ago

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

import Photos

class PHAssetMock: PHAsset { }

seanhenry commented 5 years ago

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.