swift-style-guide
swift-style-guide copied to clipboard
What should we do about constants?
Discussion emerged as to how we should handle constants in Swift. Should they be in enums? Structs? Globals? Some other thing we're not aware of?
Do we have any resources that have a strong drive one way or the other? I cannot find any, and until we do, I vote we should avoid ruling on it until we have a good reason to encourage / discourage one use case over the other.
This is one resource: http://www.jessesquires.com/swift-namespaced-constants/
The approach shown by jessesquires is informative and innovative in handling resources, but I think R.swift pod is also a good competitor for managing resources.
@ayushcshah thanks for the feedback! That pod is pretty interesting, though I don't think it would make sense as part of the style guide. I think what we're seeing is that there are multiple valid routes; I've read that post by jessesquires before as well, and it's definitely informative but I don't feel it's necessarily definitive, if that makes any sense
Yup, makes sense.