Skip to content

Coding Guidlines

Alexandru Turcanu edited this page Dec 17, 2018 · 9 revisions

Coding Style

  1. naming constants with kf as a prefix

  2. name new classes with the following as a prefix:

    • views with KFV
    • models with KFM
    • view-model with KFVM
    • view controllers with KFC
    • protocols with KFP
  3. add constants to an extension that is similar to its type:

extension UIColor {
    static let kfPrimaryColor = UIColor(...)
}
  1. if the constraint is specific to a class file or view controller, like a segue:
extension UIStoryboardSegue {
    static let showDetailedDonation = “showDetailedDonation”
}
  1. use the following in all classes larger than 50 lines of code (view here for some more details):
class MyClass {

   // MARK: - Variables

   // MARK: - Initializers

   // MARK: - Lifecycle

   // MARK: - Methods
}

// MARK: - UITableViewDataSource

extension MyClass: UITableViewDataSource {
...
}
  1. https://github.com/raywenderlich/swift-style-guide

View Styles

Architecture

Availabilities

Clone this wiki locally