04

Andrew Bancroft walks through his approach for encapsulating Storyboard segue identifiers using a Swift Enumeration.

“What can I do to avoid these ‘magic strings’ in my code?” – This was the question I asked myself recently as I found myself in prepareForSegue comparing segue.segueIdentifier to in-line hard-coded Strings.

By creating an Enumeration that stores raw String values, I was able to encapsulate what would otherwise be “magic strings” in a type-safe construct for easier, cleaner use in my code.

Read full article on andrewcbancroft.com