I'm trying to write XCTests for my 3D Touch code for quick actions (when you 3D Touch on the icon and launch the app). However, I can't seem to figure out a good way to write a protocol that would allow me to mock UIApplication.sharedApplication() so that, when the tests are running and that is called, the test data goes to the mock class instead of the actual shortcutItems. Any suggestions?
Originally I was thinking
protocol MockShortcutItems {
var shortcutItems: [UIApplicationShortcutItem] { get set }
}
extension UIApplication: MockShortcutItems {}
Aucun commentaire:
Enregistrer un commentaire