Q&A
Ask and answer questions to make information more available to wider audiences.
Nora Marlowe @marlowenora   20, Jun 2023 12:00 AM
Unnamed categories
Unnamed categories – what are they?
answers 2
 
Answer 1
John Caroso @johncaroso123   27, Jun 2023 02:47 PM
. Example:

Foo.h
@interface Foo:NSObject
@property(readonly, copy) NSString *bar;
-(void) publicSaucing;
@end
Foo.m
@interface Foo()


@property(readwrite, copy) NSString *bar;
- (void) superSecretInternalSaucing;
@end
@implementation Foo
@synthesize bar;
.... must implement the two methods or compiler will warn ....
@end

 
Answer 2
John Caroso @johncaroso123   27, Jun 2023 02:47 PM
The category without a name is no longer favored since the extension of @protocol to support @optional methods. We use the @interface Foo() class extension to declare additional private API, known as the system programming interface (SPI), which is utilized for implementing the internal workings of the class. This declaration is typically placed at the beginning of the .m file. All methods and properties declared within the class extension must be implemented in the @implementation, similar to the methods and properties found in the public @interface. Class extensions also provide the ability to change a publicly read-only @property to read-write before using @synthesize on the accessors.