CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | Custom |
| ReleasedLast Release | Sep 2015 |
Maintained by Dustin Bachrach.
AtSugarMixin extends AtSugar to easily uses Mixins. Mixin functionality is provided by ObjectiveMixin.
Then include the header:
#import <AtSugarMixin/ASMixin.h>First, declare a protocol for behavior implemented by a mixin. AtSugarMixin even allows you to mixin properties!
@protocol MyMixinProtocol <NSObject>
@property (strong, nonatomic) NSString* aStringProperty;
@property (strong, nonatomic) NSArray* anArrayProperty;
- (void)doSomething;
@endYou then create a class that will provide the mixin implementation. This class conforms to your mixin protocol.
#define MyMixinSynthesizeProperties aStringProperty, anArrayProperty
@interface MyMixin : NSObject <MYMixinProtocol>
@endWe need to define MyMixinSynthesizeProperties so that that AtSugarMixin will synthesize the properties from the protocol.
@implementation MyMixin
@synthesize_from_mixin (MyMixin)
- (void)doSomething
{
// implementation
}
@endNow we can mixin our MyMixin behavior to any class we want.
@interface MyObject : NSObject <MyMixinProtocol>
@end
@implementation MyObject
@synthesize_from_mixin (MyMixin)
@endNow MyObject has 2 mixed in properties: aStringProperty and anArrayProperty. It also has a mixed in method: -doSomething.
MediaHound
AtSugarMixin is available under the Apache License 2.0. See the LICENSE file for more info.