-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
@@ -209,9 +209,56 @@ class MyViewController: UIViewController, UITableViewDataSource, UIScrollViewDel | |||
} | |||
``` | |||
|
|||
Since the compiler does not allow you to re-declare protocol conformance in a derived class, it is not always required to replicate the extension groups of the base class. This is especially true if the derived class is a terminal class and a small number of methods are being overridden. When to preserve the extension groups is left to the discretion of the author. | |||
For UIKit views and controllers, besides separating protocol methods into their own extesion, also separate your class into section using `// MARK: -` to group lifecycle methods, setup methods, and action methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments
Where possible, separate your classes into sections using // MARK: - comments to group lifecycle methods, setup methods, and action methods. Like TODO: and FIXME:, MARK: comments appear in the Xcode source navigator.
// setup Refresh Controller | ||
} | ||
|
||
// MARK: - Action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button actions
|
||
} | ||
|
||
// MARK: - UITableView DataSource and Delegate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UITableViewDataSource and UITableViewDelegate methods
// table view data source methods | ||
} | ||
|
||
// MARK: - UIScrollViewDelegate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UIScrollViewDelegate methods
// init code here.. | ||
} | ||
|
||
// MARK: - Life Cycle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UI Lifecycle
1.) Generalized the Protocol Conformance rule for all classes instead of just models.
2.) Removed confusing paragraph about replicating extensions.
3.) Added a rule to help standardize the layout of UIViews and UIViewControllers.