How To Test Locale In Your Playground in Swift

Today I was preparing a fancy Playground for my talk at Wearables + Things Conference. This is the first time I created a Playground for educational purposes, so naturally I thought it would be super cool to demonstrate how values change based on locale! However, I quickly ran into a problem changing the locale for the entire playground.

After tweeting out for help, @ayanonagon provided this beautiful solution:

Try it out with these locales. Enjoy!

Note: Don’t actually do this in production code! This is just for fun experimental / educational purposes 🙂

Enjoy the article? Join over 14,500+ Swift developers and enthusiasts who get my weekly updates.