Closed technicat closed 2 years ago
This isn't a bug, it's the enumNamespaces
rule.
Hmm, well, OK, not so crazy about that rule, but the whole thing is working alright as an enum (it's got some static functions in there, too). Thanks.
@technicat the idea behind it is that if you are using a type purely as a namespace, it makes sense to use an empty enum, which can't be instantiated and takes up no space in memory.
But if you don't like the rule you can disable it with --disable enumNamespaces
.
Just seems hackish to me to use enums not to enum (reminds me of the Java practice of using interface classes to hold constants), but that's OK, if I really want to avoid it looks like I can use class instead of static for the properties, which maybe is more appropriate anyway,.
Because Swift doesn't have namespaces, it's actually more appropriate to use an enum
for the allocation reason over a class. I've done this and have worked with many who have as well.
Running swiftformat 0.49.12 from the shell on a file with just this
replaces the class with enum
The key piece seems to be the static var, if that's removed, no problem