Extensible Analytics Library Design with Tagless final concept

Table of Contents Keywords Expression Problem Introduction Following the ritual Not following the ritual Preface 2 classical ways to implement analytics library Enum based (Sum type based) Class, struct+protocol based (product type based) Client problem: Add ForceTapEvent & support another analytics service The limitation of enum approach The limitation of class/(struct+protocol) based approach Summarizing A radical way to solve the same issue aka Tagless final Lets get both: ability to add cases and new interpretation.

Read More

Testable Interface design with Enums

Table of Contents Writing Testable Swift API with Enums Modeling interface based on Enum Using the OneTapFeature Testing Feature Refactoring the OneTapFearure to make it testable How about testing the present() What if our client module is using Obj-C Is the feature modular? Can it be resused by other apps? Conclusion Writing Testable Swift API with Enums Encapsulate everything and try to show as little as possible. Greedy approach.

Read More