Tagged Questions
10
votes
4answers
10k views
How to avoid “incomplete implementation” warning in partial base class
I have created a protocol that my classes need to implement, and then factored out some common functionality into a base class, so I did this:
@protocol MyProtocol
- (void) foo;
- (void) bar;
@end
...
1
vote
1answer
51 views
Naming conventions for parameters in Objective-C
When naming parameters in Objective-C, does it matter -that is, it is advisable for documentation / legibility - if I use the same name for similar methods? For example:
@interface Zookeeper : ...
0
votes
2answers
22 views
NSError objects with NSFetchedResultsControllers
This is a simple one: I'm currently creating a new NSError object every time I perform a fetch on my NSFetchedResultsController. This occurs across a number of methods, so there are currently nine of ...
2
votes
2answers
86 views
Coding convention for space after pointer * [duplicate]
In Cocoa, what's the best convention on writing the * for pointer?
@property (nonatomic, retain) MyClass * instance;
or
@property (nonatomic, retain) MyClass *instance;
I noticed that the ...
3
votes
4answers
1k views
Are there any useful naming conventions for *your* constant/static variable in Cocoa?
I know that constants start with the k prefix, but does anyone have their own constant prefix, so they can easily get completion on their constants, instead of Apple's?
I use a three letter prefix ...
5
votes
4answers
4k views
Dot notation vs square brackets and casting in Objective-C
Which of the following is best practice in Objective-C?
UITableView* view = (UITableView*) [self view];
[view setSeparatorColor:[UIColor blackColor]];
[view release];
vs.
((UITableView*) ...
94
votes
4answers
21k views
Why rename synthesized properties in iOS with leading underscores? [duplicate]
Possible Duplicate:
How does an underscore in front of a variable in a cocoa objective-c class work?
When creating a new project in Xcode 4, the boilerplate code adds an underscore ...
2
votes
2answers
146 views
Wich pattern to update interface using background thread?
I'm looking for a common and elegant way to manage interfaces update.
I know that user interface code must be run in main thread, so when i need some computation o network task i use GDC with this ...
0
votes
3answers
71 views
Are C functions bad style in Objective-C interfaces?
I declare an interface with some functions and some methods. Instead of declaring:
-(void)foo;
+(void)bar;
I declare:
-(void)foo;
void bar();
I think it's fine. The compiler thinks it's fine. Do ...
6
votes
6answers
512 views
Objective-C class naming convention vs Uncle Bob
In Chapter 2: Meaningful Names Uncle Bob writes:
Don't Add Gratuitous Context
In an imaginary application called "Gas Station Deluxe," it is bad idea to prefix every class with GDS. Frankly, ...
0
votes
4answers
90 views
if statements, a faster way?
I know this can be faster but i dont have years of experience in coding so i am just learning the hard way..
I made a function that checks if a string is not "" if not add it to a nsurl and then i ...
0
votes
1answer
56 views
Abstraction of Model objects reasonable?
I'm currently working on a project where I'm adding a new rest interface.
I've written a generic converter which converts the response into some objects.
Now i'm asking myself if I should convert ...
4
votes
1answer
153 views
Declare properties in .h interface or in an extension in .m file?
In Objective-C, is it best practice to:
Declare objects such as buttons in the .h and then synthesize in the .m
.h
@interface SomeViewController : UIViewController
@property (strong, ...
0
votes
2answers
92 views
Objective-c coding
I'm really confused about using proprieties.
if i declare this
@property (nonatomic, strong) NSString* aString;
what is the difference between this
1.@synthesize aString = _aString
and
...
3
votes
1answer
94 views
Is there any benefit to condensed code?
Let's say I have a statement which is several lines long:
NSString *urlString = @"http://www.example.com";
NSURL *url = [NSURL urlWithString:urlString];
ASIFormDataRequest *request = ...