Skip to content

Instantly share code, notes, and snippets.

@tranhieutt
Last active July 13, 2017 04:02
Show Gist options
  • Save tranhieutt/1cb4a1967f2d5961b86c222af86c7c36 to your computer and use it in GitHub Desktop.
Save tranhieutt/1cb4a1967f2d5961b86c222af86c7c36 to your computer and use it in GitHub Desktop.
Swift coding convention
//Not preferred:
class MyViewController: UIViewController, UITableViewDataSource, UIScrollViewDelegate {
// all methods
}
//Preferred:
class MyViewController: UIViewController {
// class stuff here
}
// MARK: - UITableViewDataSource
extension MyViewController: UITableViewDataSource {
// table view data source methods
}
// MARK: - UIScrollViewDelegate
extension MyViewController: UIScrollViewDelegate {
// scroll view delegate methods
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment