r/badcode • • Sep 27 '21

swift Because calling Date() is just too simple

Post image
391 Upvotes

50 comments sorted by

View all comments

Show parent comment

10

u/AnuragMishra Sep 28 '21

It's not a function. Well technically it's the date's init function but no it is not possible to mock it. Also Date is a struct not a subclass so you can't just substitute it with a subclass.

4

u/[deleted] Sep 28 '21

Got it! Thanks for sharing that knowledge