Not sure if there is a way to achieve it. Folding & unfolding the methods looks like an available option to me.
Fold ⌥⌘← option+command+left
Unfold ⌥⌘→ option+command+right
Frage
I don't think this one requires much sample code. But for the sake of completeness let's say I have this code.
#pragma mark Getters / Setters
- (NSMutableDictionary *)myDict
{
if (!_myDict)
{
_myDict = [[NSMutableDictionary alloc] init];
}
return _myDict;
}
- (NSMutableDictionary *)anotherDict
{
if (!_anotherDict)
{
_anotherDict = [[NSMutableDictionary alloc] init];
}
return _anotherDict;
}
#pragma mark Designated Initializer
-(id)initWithName:(NSString *)name
{
if (name)
_name = name;
return self;
}
Let's say I have numerous getters and setters here and I want to hide all of them (especially in a case like this where I'm doing simple lazy instantiation). Is there a way to do that wholesale? Right now I'm simply compressing each method as that's all XCode seems to detect.
Lösung
Not sure if there is a way to achieve it. Folding & unfolding the methods looks like an available option to me.
Fold ⌥⌘← option+command+left
Unfold ⌥⌘→ option+command+right
Andere Tipps
I don't think there is.
You could always extract that code into a separate .m file, and #include it in the place where you want it. Then the compiler will insert the code at compile-time.
Note that when you use this technique, you do NOT want to add the .m file that your #including to your target.