Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule for creating categories extensions. #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Here are some of the documents from Apple that informed the style guide. If some
* [Comments](#comments)
* [Naming](#naming)
* [Underscores](#underscores)
* [Categories](#categories)
* [Methods](#methods)
* [Variables](#variables)
* [Property Attributes](#property-attributes)
Expand Down Expand Up @@ -228,6 +229,30 @@ An exception to this: inside initializers, the backing instance variable (i.e. _

Local variables should not contain underscores.

### Categories

When creating a category on class maintened by third party developer always use three letter prefix in methods names. This way it will not conflict with current or future implementations.

**Preferred:**

```objc
@interface NSArray (RWTExtension)

- (id)rwt_firstObject;

@end
```

**Not Preferred:**

```objc
@interface NSArray (Extension)

- (id)firstObject;

@end
```

## Methods

In method signatures, there should be a space after the method type (-/+ symbol). There should be a space between the method segments (matching Apple's style). Always include a keyword and be descriptive with the word before the argument which describes the argument.
Expand Down