I was having trouble figuring out Boutique. I had used it in a test project and had no issues getting the store initialized. But this time, I kept getting an error preventing me from even building:
This took me far too long to figure out. Turns out, the model for a Store
has to have a cache key that is a String
. Mine were Int
. If I had looked at the signature more carefully, I would've noticed this. But the docs said Identifiable
was fine. But apparently that is only fine if the id is a String
. Now I know. But seems like there could've been a more helpful error.
But after that, it was really simple to get recent searches working!
It's pretty simple. When a comparison kicks off, I save the two pieces of media involved. I limit the number of recent searches to 6. I also make sure the same piece of media is not added twice.
Probably could've implemented this a ton of ways, but I wanted to give Boutique more of a try, and I have some other uses for it in mind too.
Still need a real name for this thing. The working title is Bacon. Like, six degrees of Kevin Bacon...get it? I'm really clever.