Factory: The Function that Isn’t There

Five years of Factory, one operator, and the registration I should have sugared on day one…

Factory: The Function that Isn’t There

Five years of Factory, one operator, and the registration I should have sugared on day one…

Michael Long
Michael Long in The Swift Cooperative
  ∙  
June 15, 2026
  ∙  
7 min read
Member-only content
  ∙  
View on Medium
Post image

There’s a piece of received wisdom in Swift API design that says callAsFunction is a parlor trick. A novelty. The sort of thing you reach for to win an argument on a forum and then never ship.

And to be fair, most of the examples you see make it look that way. A struct Adder you call like adder(2, 3). A wrapper around a closure that already worked fine as a closure. Cute. But pointless.

Well, I’ve spent the last five years building a dependency injection library on top of it, and I’m here to tell you it’s the single…

Continue reading
This is a member-only story and can only be read on Medium.
Join The Writer's Circle event
Sent to sikubaycom.s3cr3tz@blogger.com by Michael Long on Medium
Unsubscribe from this writer's email notifications
Manage your email settings

3500 South DuPont Highway, Suite IQ-101, Dover, DE 19901
Careers·Help Center·Privacy Policy·Terms of service