-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guidelines for the logical lumping of types into a file. #5
Comments
I would say separate file for all classes. Grouping causes way more confusion than it solves, especially when there's no way to apply it consistently |
I think one file per type is overly restrictive, but I agree that there are no easy rules for when to group things. Personally I say take a stab at using one file for similar things when it feels good. General guidelines:
|
I like how Apple treats UITableView. This file has 3 classes, 2 protocols, 4 enums and an extension. It's ~400 (swift) lines. I would happily find a WT VC of similar length, with a similar num of types. |
We did already decide that private types should be "namespaced" by being inside the type that uses them, right? If so, then one file per "over-type" makes sense to me. |
What are people's opinions on when we should add a class/struct to an already existing swift file rather than creating a dedicated file for that class/struct? Also, if we do logically lump classes/structs together, what should this file be named?
For Example: If we have a
UITableViewController
, should theUITableViewCell
s that theUITableViewController
uses be in the same file? What if later on down the road we want to use thatUITableViewCell
somewhere else?My initial opinion on this is that each class should be in a dedicated file so that classes are easier to find.
The text was updated successfully, but these errors were encountered: