• Me
  • Tutorials
  • Blog
  • Little Bits
  • Poker

Luke Parham

iOS Developer + Other Stuff

  • Me
  • Tutorials
  • Blog
  • Little Bits
  • Poker

Header File #import Best Practices

Since a header file's imports are then all imported into whatever files that particular header is imported into, they can cause a lot of unnecessary importing.

A good rule of thumb seems to be that you should only #import whatever class the current class is a subclass of and any protocols it conforms to.  This is a good reason to separate protocols into their own files so they can be imported where necessary without bringing along a whole other class.

All other necessary classes (for properties and method definitions) can be forward declared using the @class declaration.

Wednesday 02.24.16
Posted by Luke Parham
Newer / Older

Powered by Squarespace.