Using Resolver? Check In!

Just curious where my dependency injection system ended up...

Michael Long
The Swift Cooperative
4 min readAug 7, 2022

--

Photo by Maranda Vandergriff on Unsplash

The status on my LinkedIn page is now “Open for Work” and it’s funny how doing that one simple thing changes your mindset and attitude, even to the point where it affects your dreams.

To that point, a few days ago I had a dream where I was sitting in a conference room for a technical job interview — yeah, yeah, I’m a developer, I have weird dreams, okay? And so anyway, in this dream the interviewer looks up from their notebook and says, “We use a dependency injection system called Resolver. Ever worked with it?”

I began to smile and reply that not only have I used Resolver… I wrote it! And then suddenly the alarm clock rang and the whole silly fantasy vanished into a puff of smoke.

Sigh.

Disappointed that I never got to see my fictional interviewer’s reaction to my earthshaking revelation, I got up, got on with my day, and didn’t think much more about it.

Until this morning, when I was browsing LinkedIn and ran across the following ad in my feed.

Now, I don’t really have plans to move to Budapest in the near future, but I clicked through to the job description anyway, just to see what people were looking for and what skills were in demand. You know. Research.

And then I found this.

Resolver.

Huh. Perhaps my dream wasn’t so far-fetched after all…

Resolver

I wrote Resolver about five years ago. We were using Swinject Storyboard in a project and I disliked the way you had to explicitly specify the type for each and every dependency injection registration and injection.

Swift, I reasoned, had type-inteferrence. Why couldn’t I use that to figure out what was needed and skip all of the boilerplate? Long story short, I could, and low and behold Resolver was born.

There the same registration is written as…

The registration function infers the type from the return type of the factory, and the resolve function automatically infers the parameter type needed for the lookup.

Less code that better reveals my intent… what’s not to like?

So I published Resolver as an open-source project on Github, added the library to CocoaPods, and we even began to use it in our own projects where I work. (I might have been a little pushy about that, but everyone eventually agreed that it was a good idea… Eventually.)

So at any rate I wrote it and the the project has grown, and more and more people have downloaded it, starred it, forked it, and used it, and quite a few people have contributed to it.

Since then Ray Wenderlich did a tutorial on it, and last year in 2021 it even won me an Open Source Peer Award from Google. (A little weird for an iOS developer to win an award from Google… but there you have it.)

And of course, I kept it up to date, fixed the occasional issue, and from time to time added some new feature or behavior. (Like the @Injected property wrappers made possible by Swift 5.1, which in turn became its own story here on Medium.)

My work on Resolver also lead me to write Factory, its compile-time safe brother and eventual replacement, but that’s yet another story.

So who’s using it?

Finding Resolver mentioned in the above job description made me think a little bit about my journey with it, but more to the point, it also lead me to wonder… if a team in Budapest is using it, just who else is using it?

Where else did it end up?

And that leads us to the here and now. If you’re still reading this, then there’s probably a good chance that you or your team have used (or are still using) Resolver.

If so, for what? Personal project? Commercial or enterprise application? I’d really, really, really like to know, so if you have some experience with it please take a second and leave me a quick comment.

No need to name company or application names if it’s a confidentiality problem or trade secret. Just drop a “Used Resolver in a major mobile banking project and it worked like a charm” kind of comment in that case.

Completion Block

So that’s it. My curiosity was stoked, but I couldn’t quite figure out how to get any answers to my question. But then I thought, “Hey, I’ve got a few people following me now on Medium, maybe I can just ask them directly.”

And so I have.

Two last things.

I’ve been on one journey with Resolver, but I’ve also been on another here on Medium. Just know that if you’re reading this, or if you’ve read some of my other work… I appreciate it.

Until next time.

This article is part of The Swift Dependency Injection Series.

--

--

Michael Long
The Swift Cooperative

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.