Hi Anton, thank you for your replay, much appriciated . I’m always happy to hear the readers side and there (your) opinion.

Moving to your suggestion I think that you are absolutely right a “for-loop” could be smarter to use in this case, the reason I didn’t use it though is that looping Enums has only been introduced in Swift 4.2 and this code is writing in Swift 4.1. Although there are solutions to iterite enums in Swift 4.2 and below I choose not to do that to simplify things for any futures developers.

In my opinion readable code is more imortent then saving a few lines of code, if you understood my code as it is right now, then I did my job explaining correctly, now its up to you to add more date formats and improve the code and shape it as you think is right.

I wish to teach and inspire other developers to take a code sample and improve it , not copy paste and get it done with.

Thanks agian for your comment :) Hope you could read and comment any future articles of mine.


Senior iOS Developer, I think.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store