Listing enum cases using CaseIterable in Swift

This can help you in creating tables in Swift featuring a dog and an elephant

Steven Curtis
Nov 7 · 4 min read

CaseIterable is a protocol, and if an enum conforms to the protocol Swift helpfully generates an array of all the cases in an enum.

These are cases. They have nothing to do with CaseIterable. Come on! Think!

That seems like it might be unimportant. But we can use it to help populate our table.

You've completed your member preview for this month, but when you sign up for a free Medium account, you get one more story.
Already have an account? Sign in

Steven Curtis

Written by

stevecurtis.me

The Startup

Medium's largest active publication, followed by +542K people. Follow to join our community.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade