FP and OOP operate on different design-granularity levels. While in FP, functions/methods are the most important building blocks and programming is done at a low level, in OOP, classes/objects/modules are the most important building blocks and programing is done at a high level.
To overcome this granularity mismatch, we need to find answers for the following questions:
- Where do we locate the source of individual functions in an OOP architecture?
- Where do we relate such individual functions to an OOP architecture?
In Swift, we can place functions inside source files and outside of classes, or we can place them as static or class methods.