Maybe you should give an obj-c seminar
Clean, Modern Objective-C
11–20 of 48 posts
Re: Clean, Modern Objective-C
#12Stylistic stuff like this is not something you need to give rules for. Create an automated formatter, run it on your or others source files, and get back to solving real problems.
Re: Clean, Modern Objective-C
#13All of these things are something you use an automated formatter for, not regard as some kind of 'modern objc'. I guess people like to focus on pointless stuff like this because it's easier to worry about than whether you should use an eventbus or a delegate - you know, actual hard choices. Stylistic stuff like this is not something you need to give rules for. Create an automated formatter, run it on your or others s…
Also, #'s 1, 2, 4, and to a certain extent 8 are more questions of design pattern than 'style'.
Re: Clean, Modern Objective-C
#14I'm surprised that he provides five versions of the method definition syntax and none of them are what Apple does and what I consider to be the standard: - (void)doSomethingWithParameter:(NSString *)parameter;
That is my preferred method as well, but I've seen a lot of templates use: -(void) doSomethingWithParameter:(NSString *)parameter;
Re: Clean, Modern Objective-C
#15I really like point #4. I'd take that further and say that most "keyed access" classes should be wrapped in a more domain-specific wrapper class (thinking of NSUserDefaults, and the like).
With regards to point #8, Apple actually recommends against naming functions starting with get... also, unless they are property getter overrides. (https://developer.apple.com/library/mac/documentation/Cocoa/...)
Thanks for the article.
Re: Clean, Modern Objective-C
#16 - Use MVVM and some method of bindings (e.g. ReactiveCocoa) [0]
- Split up ViewControllers and DataSources [1]
- Split up classes using Categories (I've seen so many blown up AppDelegates)
- Use CocoaPods (this should be a given by now)
- probably much more I forgot about...
oh, and btw: those `@directives` go by the name of `literals`[0] - http://lmgtfy.com/?q=mvvm+objective-c [1] - http://www.objc.io/issue-1/
Re: Clean, Modern Objective-C
#17@private NSString dog;
@public NSString cat;
... Oh Wait! We do, it's just that nobody uses it anymore. http://stackoverflow.com/questions/4869935/objective-c-priva...
Well we have syntax sugar for iVars... I think it's so messy putting some properties in the header and some in the implementation file with a private category - come on we can't have better syntax than that?
Re: Clean, Modern Objective-C
#18My points on Modern Objective-C: - Use MVVM and some method of bindings (e.g. ReactiveCocoa) [0] - Split up ViewControllers and DataSources [1] - Split up classes using Categories (I've seen so many blown up AppDelegates) - Use CocoaPods (this should be a given by now) - probably much more I forgot about... oh, and btw: those `@directives` go by the name of `literals` [0] - http://lmgtfy.com/?q=mvvm+objective-c [1] -…
- I'm super guilty of just handling everything in AppDelegate (notifications, URI schemes, etc.) I need to work on this.
- CocoaPods are the greatest
Re: Clean, Modern Objective-C
#19Re: Clean, Modern Objective-C
#20The ridiculous amount of effort that we have to go through to define private properties (just sheer amount of text around them) makes me miss the pre-property days... I still define iVars the old fashioned way. The whole language would do well to have some syntax sugar added akin to Java's private, public, protected for properties so we could just go @private NSString dog; @public NSString cat; ... Oh Wait! We do, it…