iOS Coding Standards

Mr.Javed Multani
2 min readMar 25, 2024

iOS Coding Standard

  • The core of our coding standards follow Apple’s Coding Guidelines for Cocoa, especially around descriptive naming of methods and properties.
  • Out-of-the-box Xcode formatting should be preserved, including using 4 space characters for tab indents.
  • New import declarations should be added to the end of existing imports in order to reduce merge conflicts.
  • If adopting a significant number of protocols (i.e. more than 2) consider alphabetizing and splitting onto separate lines — again to try and reduce merge conflicts.
  • Implementation files should contain just one class except in very special cases.

File Formats

  • Unicode (UTF-8) encoding of all text files
  • OS X / Unix line endings (LF)

Deviations

  • Braces are on new lines, except when declaring a completion block

Xcode

  • Always use the latest non-beta release of Xcode

Preferences -> Text Editing -> Editing

  • Set ‘Default text encoding’ to ‘Unicode (UTF-8)’
  • Set ‘Default line endings’ to ‘OS X / Unix (LF)’
  • Deselect ‘Convert existing files on save’

--

--

Mr.Javed Multani

Software Engineer | Certified ScrumMaster® (CSM) | UX Researcher | Youtuber | Tech Writer