Comments (4)
It is odd that we don't have a system for this. I'd like to propose an alternate system:
Group methods in pragmas in order of inheritance, then class/instance, then rough chronology.
So something like
#pragma mark - NSObject
+ (void)initialize {
}
- (void)dealloc {
}
#pragma mark - UIViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
}
- (void)viewDidLoad {
}
#pragma mark - NYTArticleViewController
- (instancetype)initWithArticle:(NYTArticle *)article section:(NYTSection *)section {
}
#pragma mark - UIScrollViewDelegate
- (void) scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
}
from objective-c-style-guide.
I agree that systematic is better than haphazard..or idiosyncratic :)
from objective-c-style-guide.
@mattbischoff Your proposal is exactly how I write code. Always use pragma mark whenever overriding a method in a superclass (yes, NSObject counts) or implementing a delegate method. There should probably be a separate section for that.
from objective-c-style-guide.
To expand a bit more: group methods in pragmas in order of inheritance, then delegate methods separated by protocol, then public methods, then private methods.
from objective-c-style-guide.
Related Issues (20)
- "command + z "does not work
- Execute HOT 2
- Fix broken links HOT 2
- hello
- Any plans on a swift style guide? HOT 2
- Request Create README_id-ID.md HOT 1
- let me try it
- Apple objetive C documet link don't work HOT 2
- Long time no see HOT 1
- Account has been flagged HOT 1
- printing prime numbers in N range without using function in python HOT 2
- Constants can be changed? HOT 1
- test
- test issue HOT 1
- test issue HOT 1
- obj-©
- how to convert string to Boolean?
- Ik
- Switch case
- Archive this repository HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from objective-c-style-guide.