A Recipe for Building Grocery 2.0

The story of Grocery 2.0 begins around Christmas of 2017 with a family recipe book.

Grocery 2.0

Grocery 2.0

Ryan and I were back home with our families looking up recipes and planning holiday meals. After picking a recipe to make you typically add the ingredients to your grocery list and go shopping. We both wanted to have our recipes in Grocery to make adding those sets of ingredients easier.

I think it's important that this realization happened with family recipes because family recipes are very special. To many people, they’re as special as family photos: passed down generation to generation. If we added recipes to Grocery it would need be a great recipe feature that we could trust with those recipes. We set out to do just that and started design in January of 2018.

The obvious next step after design would have been to hit File -> New View Controller in Xcode and start adding a recipe screen to Grocery. Instead, we created an entirely new Xcode project to iterate quickly on our recipe concept. Our goal was to prove that our design worked and bring what we learned back to Grocery and quickly ship our recipe feature.

We eventually did bring that recipe feature back to Grocery and we’re excited to be shipping it in the app today! But along the way, we also re-wrote virtually all of Grocery’s UI in a way that greatly improves the consistency of elements throughout the app, as well as how code is structured for re-use across screens.

One way to look at it: Version 1.0 was basically our prototype. Version 2.0 is the real deal.

That probably sounds weird if you've already been using 1.0 and love it. We love it too! But for multiple technical and user experience reasons I can safely say that 2.0 is a huge improvement, not only to the experience of using Grocery but also to its technical future for many releases to come.


What’s the deal with a new Xcode project?

I initially resisted adding recipes to Grocery because I was in love with the idea that Grocery is just a simple shopping list. Building recipes seemed incredibly complicated. You need a list to view all your recipes, a recipe viewer for cooking and selecting ingredients, and an editor to create new recipes. You need a place to safely store all of the recipes a user adds, with all of their section headers, ingredients, steps, notes, timers, and photos.

Using a new Xcode project gave us space to work through design and technical hurdles without worrying about breaking Grocery. Once we had the new project we started attacking all of the problems involved with building recipes:

1. Using Markdown as a storage system for recipes

Our entire concept for recipes hinged around using markdown to improve flexibility for displaying recipe content. We wanted our recipes to stand the test of time with an open document format that supports interleaved ingredients and steps.

Testing this theory in the new Xcode project proved that a basic UI for creating recipe-focused markdown files was easy to use for adding recipes. ✅You can read more about the recipe markdown format we arrived at on GitHub.

2. iCloud Drive

Recipes need to be shareable across devices and with friends and family members. But we weren’t sure how well recipes sync between devices if we stored our recipe markdown files in iCloud Drive.

We tested this feature by adding support for reloading a recipe in real time as changes are made on another device, which actually works VERY well! Syncing is surprisingly quick.

3. How to support multi-line text in list cells

Multi-line text has always been a challenging problem because every cell in your list could have a different height.

Grocery 1.0 supports Dynamic Type, which requires some variation in the height of each cell, but we still limited the length of items in the list to a single line. That would never have worked for recipes that usually include long steps that span several sentences.

So instead of a standard table view, we built the recipe screen as a collection view and worked through all of the details to get multi-line text working. Our solution worked really well for recipes, and we even made the solution re-usable so that we could use it in other screens like the recipe list and ingredients list.

4. Themes

We'd been wanting to introduce different app theme colors for a long time. Because why not?

Themes!

Themes!

Building new UI components from scratch in the new project seemed like the perfect time to try it! We ended up with a very clean solution using a notification system that lets each component style itself for the selected theme. We even used Swift enums for all of the theme options!

We had assumed that there would be a new system dark mode setting in iOS 12 that we'd be well on our way to supporting, but that only debuted on the Mac. We'll be ready if that ships in iOS 13 though!


What else did we get from a new project?

Using a new Xcode project to develop recipes helped us solve a lot of problems quickly, but we actually got a lot more out of it than we could have predicted.

We eventually realized that our new Xcode project had essentially become a component-based layout system for building lists that fit our app's style. A component is just a collection view cell with enum-driven customization options like:

  • Title font style

  • Note font style

  • Left thumbnail image

  • Right thumbnail image

  • Full size image

  • Background visible or invisible

  • Attributed text (e.g. for timers and links)

  • Checkmark visible or invisible (e.g. for grocery list items)

  • Disclosure indicator visible or invisible

Example of most of the types of cell configurations that Grocery supports

Example of most of the types of cell configurations that Grocery supports

All of these cells are actually the same type of component-based collection view cell

All of these cells are actually the same type of component-based collection view cell

Each component supports theming and multi-line text for all of its labels right out of the box. Multi-line support also extends to images which are automatically sized to fit the width of the screen with their aspect ratio intact. The components were exactly what we needed to build a flexible recipe layout system, but also worked great for building any other screen we wanted to.


The recipe feature works! Now what?

Our original plan called for iterating quickly on recipes in a new Xcode project before bringing the recipe feature code back into the Grocery project. In my head that essentially meant moving some files from one project to another and linking them together to present the new recipe screens.

There still wasn’t anything wrong with that plan. Grocery was still working well, and we wouldn’t have to make any changes to Grocery before inserting the new recipes feature. There was essentially zero risk to Grocery by going this route. Why would we consider doing anything else?

The other option was to go nuclear and make some major code changes to Grocery itself, while moving the recipes from the new Xcode project back into the main Grocery project. There were a few reasons why this seemed like a great idea:

  • We were way more excited about the UI system we had created in the new project than we were about the UI we had created in Grocery. The code was a lot nicer to work with, and the components fully reflected our entire visual style for the app.

  • By this point we had committed to shipping new app themes alongside recipes, and our component-based layout system already supported theming.

  • We'd been fine tuning the marginal layout in the prototype and it simply felt nicer and more consistent than some of the layout in Grocery. We were building every new screen with these components, and so all of the screens benefited from those improvements.

  • The original Grocery project essentially used different table view cells for each screen. The Grocery List and Quick Add screens had different cells to accommodate one having a checkmark selection and one having a circle selection. There were different cells for settings too, and for lists and stores. This of course caused plenty of issues any time we decided to tweak our layout spacing in the app...which led to us not doing that very often. You never want brittle code to be a reason to avoid change, and our original layout code was too brittle for our liking.


Plot twist

Instead of just moving recipes back into Grocery and calling it a day, we decided to re-build the existing Grocery UI using the new component-based layout system without changing Grocery’s existing model layer.

Grocery List + Recipes

Grocery List + Recipes

We still loved Grocery's internal model and controller layers. The interaction with Reminders, our internal sorting algorithm, Apple Watch, and the Realm database that we use for sorting were all very solid and abstracted out into their own classes.


The Merge

Besides support for themes, we also knew that two of the screens in Grocery needed to be overhauled before our next major version anyway: Stores & Lists, and Settings.

Stores & Lists:

Confusion about the difference between Stores and Lists and how to have items associated with a specific Store was easily the largest source of customer feedback from Grocery 1.0. We'd been brainstorming solutions to that almost as long as we'd been working on recipes!

The solution we arrived at was to merge Stores & Lists into one feature called Stores, and give each Store an assigned Reminders List. That gives users the flexibility to configure Stores however they want to: with a shared list for multiple stores, or a unique list for each store.

New Stores:

The new Stores feature was different enough from the original that it really needed a brand new UI no matter what. The original store/list selection screen just didn’t make sense for the new feature.

Building the new screens with the component-based layout system was incredibly fast! They were easy to build because the components handle all of the layout. The data source for each screen is essentially the a-la-carte counter at a restaurant:

"I'll take three cells with images on the left, titles, and notes on the right; a section header with some top spacing; two cells with some text and images on the right; one cell with two lines of note text; and two cells with tinted titles that make them look like buttons."

Settings:

We re-built settings in the same manner, and that only took a weekend to finish. Because the logic behind most of these screens is relatively minimal, handling all of the layout through shared components cuts out most of the work for adding new screens.

Of course, this component-based layout system only works within the constraints of what our shared components can be configured to do. Adding an entirely new "type" of component still means work. But knowing which components exist and how they can be customized is also really helpful from a design perspective because you have a better sense of what your palate looks like while designing a new screen. If you use those components in the design, you know it's going to be easy to build. It's really a tide that lifts all ships.


The Grocery List Refactor

Grocery is still a pretty simple app. When you exclude the Recipes, Stores, and Settings screens that we already re-built...the only thing left to rebuild is the list screen itself.

I have to admit, the list screen was a little embarrassing to behold. It was actually still called ViewController.swift from when I first created the Grocery Xcode project in January of 2017!

ViewController.swift wasn't quite as massive a view controller as it could have been, in part because of how much logic Grocery had abstracted out into classes that could be shared with the Apple Watch app. But it was still cluttered and disorganized and largely incompatible with the multi-line layout and theming features we were adding in 2.0.

The new list screen is infinitely nicer and actually has a real name: GroceryListViewController.swift!

GroceryListViewController + Extensions

GroceryListViewController + Extensions

Developing the new GroceryListViewController was an incredible lesson in refactoring that I want to describe for you here. This is what the process looked like:

The simple stuff:

Some pieces of the original ViewController had an obvious home in the new GroceryListViewController. If a method is simple and important, just putting it into a more organized place in the new GroceryListViewController or one of its extensions was all that was needed. I saw those pieces as low hanging fruit and tried to move all of them first.

Anything I moved to the new GroceryListViewController I also deleted from the old ViewController.

More complex parts:

Certainly some parts of the original ViewController weren’t needed anymore, or could be better replaced by newer components we’d been developing alongside recipes. After clearing out the low hanging fruit I started combing through the remaining methods following this pattern:

  • Select a method in the old ViewController.

  • Figure out what it's doing.

  • Write a new method in GroceryListViewController that implements the essential features of the old method, generally using newer support systems.

  • Delete the old method from the old ViewController.

As the ViewController file shrank, other files related to the new GroceryListViewController grew. The refactor would be complete when ViewController.swift was empty and could be deleted from the Xcode project.

Drag and Drop:

The most care was needed around features like Drag and Drop. Grocery's original table-view-based drag and drop was incompatible with the new iOS 11 Drag and Drop that supports dropping items from other apps. That sort of refactor required saving the underlying logic of what to do when an item is dropped while supporting a new type of user interaction.

Gaining support for features like iOS 11’s Drag and Drop was yet-another reason that I'm glad we decided to give the grocery list screen a do-over. Eventually the last method was removed from the old ViewController.swift and the file was deleted from the Xcode project. Refactor complete!

Once the refactor was finished, every screen in the Grocery project worked the same way. Having one way of doing things makes the app easier to maintain because there's less context switching across features, and less surface area for bugs to pop up. That by itself can be a very valid reason to perform a major refactoring effort if it means unifying the way core functionality in your app works!


Grocery list, recipes, and back again

A friend at work asked an important philosophical question recently: if you replace every plank on a ship is it still the same ship? Grocery still feels like the same app to me. Sorting the list and adding items still works the same way. Settings carry over to 2.0, with the addition of a few new ones. Quick Add works the same way. But using the app with recipes and themes is so much nicer as a user, and the code base is easier to work with as a developer. I'm not sure if it's truly the same ship or not, but I do know it's a ship I love using and working on!

We're really excited for people to try the new version and hope that you enjoy it. Grocery is free to download and available on the App Store!

Review: Running Belts for the iPhone 6s Plus

It's prime running season here in Austin, TX and I've finally finished up a new batch of running belt reviews. I've been using several of these belts for a while now with my iPhone 6s Plus, though the FlipBelt Zipper is a very recent (if greatly anticipated) addition. The iPhone 6s Plus is of course the same basic size as it's predecessor, so running with a large iPhone isn't a very different experience than it was last year. But, I do think the popularity of the large phones is fueling a larger market for iPhone running belts, which warrants expanding my reviews to include more products as they come on the market.

Note: The links below are Amazon Affiliate links. If you find this review useful and decide to purchase any of these belts, consider using the links below and you'll support this site.

Note: You can find a link to all of my previous (and future) running belt reviews here at the Running Belt Mega Review.

Daswise Waterproof Running Belt

Daswise Waterproof Running Belt

Daswise Waterproof Exercise Runners Belt (Amazon) - Facebook

I picked up the Daswise runners belt after seeing the great reviews on Amazon and being curious to try a waterproof belt. Even though I'm usually not taking my phone out to run in the rain, protection from sweat was a key reason for me switching to running belts over armbands in the first place, so moisture protection is a welcome feature.

The pocket on the Daswise feels like the right size for an iPhone 6s Plus. It needs to stretch a little when headphones are plugged in, but that's very typical with most running belts. The snugness means that the phone will lay flat while running and not tilt down to either side.

I did notice that the Daswise straps were fairly smooth. The friction point between the straps and the buckles is low, making it fairly easy to adjust by pushing on the buckles. For this reason, I feel like this belt was probably designed to be worn with the pocket on your back. In this orientation, one would simply grab both buckles and pull backwards to tighten, or flick forward to loosen. That seems like a natural interaction to me, but for someone who wears their belt facing forwards, I had a little trouble getting the right fit. Once I found the right fit it did stay put without accidentally loosening.

While I haven't tested the Daswise out in a storm, I have noticed that my phone feels less damp after a long run when using this belt. I definitely think that it protects against moisture better than my other belts, but I would hesitate to call it waterproof. Fortunately though, the iPhone 6s Plus has been tested as far more resistant to moisture than previous iPhones, and the iPhone 7 is rumored to be totally waterproof, so this feature may not be required for long.

The build quality of this belt felt better than the TAPP-C, but not quite up to the level of the higher priced and very popular SPIbelt or FlipBelt. But for the price ($9.99 at time of writing) and with the additional moisture protection, this belt feels like a great bargain.

FlipBelt Zipper

FlipBelt Zipper

FlipBelt Zipper - Website

A favorite from my original Running Belt review last year, FlipBelt recently released a Zipper addition that addresses one of my early qualms with the original. Adding a zipper pocket makes a lot of sense for people running with loose items like a credit card or a single key that they don't want to worry about losing.

As I noted in my expansion review last year, the FlipBelt has actually become one of my favorite and most used running belts. A lot of this just comes down to comfort. The FlipBelt is soft and fits evenly around you, which makes it feel great for longer runs.

One downside is the sizing. FlipBelt isn't adjustable, so if you're really on the bubble between sizes I suggest ordering the smaller of the two. I actually ran into this issue this year because of losing weight. I'm now closer to the Large fit than the XL. My FlipBelt still fits and does work, but it's not quite as comfortable as it was previously.

The FlipBelt Zipper retains the great ease of use of the original. Getting your large iPhone 6s Plus in and out is still the easiest of any belt I've tried. Distributing snacks and other objects around the belt to spread out weight or bulk is also still a thing you can do.

As for the zipper pocket, it feels well made with a quality zipper, and is actually pretty large. It's big enough to hold an iPhone 6s Plus, but I wouldn't recommend putting it there. You have to really stretch the pocket to make the phone fit, but I think that's fine because that's not the intended use for that pocket. Keep the phone in the primary pockets, and use the zippered pocket for keys/cards/cash. If you've been holding out on FlipBelt until they added a zipper, then this is definitely the one for you.

Run Baby Running Belt

Run Baby Running Belt

Run Baby Running Belt (Amazon) - Facebook

Run Baby's belt borrows an aspect of its design from FlipBelt, going with a slot opening pocket rather than a zipper. While this design for a pocket works well, especially given its size, the other aspects of this belt are very different from FlipBelt.

The Run Baby belt uses a large band with a wide buckle. It's actually the largest buckle of any of the belts I've tested. In practice, this buckle felt too large for me. The size of the band and buckle are necessary to support the size of the rest of the belt and its pocket. Of course, having a buckle also makes this belt more adjustable than the FlipBelt, but the tradeoff didn't make this belt any more comfortable.

The downside of the Run Baby belt's pocket design and how it impacts comfort is the woven seems around the edges of the main pocket. The seems were irritating whenever they came in contact with skin, scratching in a similar way to velcro. If you tend to wear your belts over clothing this wouldn't be an issue, but I usually run with mine underneath my shirt.

The final area where this belt differs from the FlipBelt is around the pocket slot openings. The FlipBelt slots are fairly easy to locate because of an inseam that separates them from the rest of the main seam. The slots on the Run Baby blend in a little more, and are also a tad smaller. My iPhone 6s Plus still fits, but experienced a fair bit of friction when used with a case.

While I appreciate the ability to adjust a belt with a slotted pocket, the comfort issues were enough for me not to want to use this belt day to day.

Gear Beast Running Belt

Gear Beast Running Belt

Gear Beast Running Belt (Amazon) - Website

Gear Beast's belt is of a minimal style similar to SPIbelt or Daswise. The pocket is only barely big enough to hold an iPhone 6s Plus, and does hold it tightly. The straps are thin, but not too thin. The material is wicking, but isn't advertised to be waterproof.

After testing a large number of running belts, I appreciated the tight-elastic nature of the band on the Gear Beast. You can definitely tell that your phone isn't going to end up bouncing around, because the band does hold very fight after you snap the buckle.

The band attaches to the pocket in an interesting fashion, whereby the pocket itself sort of wraps around the back of the band. While I can see this being a win for durability, it has the side effect of torquing the pocket around the band. This means that unless your phone is perfectly leveled within the pocket, the compartment could be torqued up into your waist, or down towards your groin while running. This likely wouldn't be an issue for people that run with their belt behind them on their back, however I found it to be a little fiddly until I got the positioning right.

Similar to the Daswise belt, the straps on the Gear Beast were fairly low friction. I found them to be just a little bit tighter than the Daswise, making it easier to get the right fit while wearing the belt facing forwards.

With the same price and a very similar build quality to the Daswise, it might be difficult to choose between these two belts. I think the difference will come down to fit preference. The Gear Beast will be easier to get and keep the right fit, because of it's higher friction point and tighter elastic. The Daswise pocket is more evenly leveled though, so your phone will sit straighter in the pocket while at rest. Either way, both belts are quite cheap and are a good value.

 

SPI H20 Companion

SPI H20 Companion

SPI H20 Companion (Amazon) - Website

While not itself a running belt, the SPI H20 Companion water bottle does fit nicely as an accessory to really any running belt because of it's clip on design. The companion is marketed as an add on to the SPIBelt (Amazon), but really applies to anyone interested in trying to add hydration to their running routine.

What I found while testing the companion is that carrying hydration during my workouts was an adjustment I hadn't really considered before. It's something extra you need to plan for and optimize, and I honestly just hadn't thought about that challenge before. I've been very used to running in urban areas with lots of water fountains, but that's not always something that people have available to them while training.

I found the companion bottle to be an easy fit on the belts I tested it with. The clip on the back is easy to use while running. Drinking out of any bottle while actually running is a skill all of its own, but I appreciated the nozzle design of the companion that felt easy to direct the flow of water.

The one area that I wish were improved was the angle of the nozzle backwards towards the clip. When worn beneath clothing, I could feel the nozzle rub against my skin. I found myself just tucking the edge of my shirt around it, which had the benefit of preventing the rubbing as well as making it easier to pull out of the belt.

While the companion isn't something I carry with me on every run, it is something I can add to one of my belts for longer runs or when I'm out running in a place with less hydration available.

Note: SPIBelt supplied me with a SPI H20 Companion bottle for the purpose of this review.


Conclusion

So which belt do I choose which running belt I use for a given run? I usually go with lighter weight ones for longer runs, unless I need to carry bars or gels, when I'll choose one like the FlipBelt that offers more options for packing extra goods. Moisture protection isn't a big factor for me, and neither is fit. All of these belts fit me well. Comfort is very important though, and I usually find the smaller/lighter belts to be more comfortable for me, with the exception of the FlipBelt which remains my most comfortable belt.

Whichever belt you go with, I'll give one more shout out to running with the Apple Watch. In watchOS 2, Apple further expanded the workout tracking capabilities of the watch, making it a wonderful companion to any runner. I still carry my phone with me when I go running though, which is why I still feel it's important to have a good running belt.

I hope this helps you choose the running belt that is right for you. I think it's safe to say that larger iPhones are here to stay, which will make these running belts great running companions for us for a long time to come.

Mega Review: Running Belts for the iPhone

When the iPhone 6 Plus came out I decided to buy several running belts to try out for my own use as a runner, and after realizing how much I enjoyed using each unique belt I decided to start reviewing them.

FlipBelt Zipper

FlipBelt Zipper

Running belts have been a trend for a while now because of how well they solve the issue of carrying a large phone while running. They're quite comfortable, and not overly distracting while running. They're worn over your shorts or shirt which makes them get far less sweaty than an arm band, and they hold other things like keys or food. They're useful for more than just running, more comfortable than velcro arm bands, and are now made in dozens of models.

This post is a reference point to those reviews to make it easy to find information about each of the belts that I've reviewed. You can visit each of the reviews for details and images of each belt, or tap the links to visit the Amazon page or manufacturer's website for more information.

Review: Running Belts for the iPhone 6 Plus

Further Review: Running Belts for the iPhone 6 Plus

Review: Running Belts for the iPhone 6s Plus

Running with my phone in a belt ends up being a far better experience than running with an arm band. It's more comfortable and less intrusive, doesn't get as sweaty, and lets me carry some extra goodies for longer runs.

For runners looking to stay connected with their phone in a belt, running with the Apple Watch has been a great experience for me. It allows me to keep my phone tucked in its zipper pocket while tracking my workout and changing music tracks from my watch.

If you found any of these reviews useful and plan to purchase a running belt through Amazon, please consider using one of the affiliate links above to help support this site.