I have a swiftlint warning that bothers me.
warning: Nesting Violation: Types should be nested at most 1 level deep (nesting)
However, nesting of structures is an established programming technology and quite a few people protect it.
Edit: Indeed, @vadian points out the Swift language guide rule: To nest a type in another type, write its definition in the outer braces of the type it supports. Types can be nested as many levels as needed .
I know that collisions using generics , and that Xcode can become unbearable slow . In fact, this was (through measuring the slowest compilation spots) why I started looking at this nesting rule.
What is the reason for the lint rule, and what is good practice in this regard? Please indicate technical reasons, not opinions based on recommendations.
Microsoft actually has a page about nested types and when they fit. Although not targeted at Swift, it does have some interesting trans-lingual thoughtful thoughts.
source share