-
Notifications
You must be signed in to change notification settings - Fork 268
1.x_Autowiring
Jasper Blues edited this page Apr 26, 2014
·
4 revisions
Block Assembly | Xml Assembly | Autowring | Using-assembled-components | Installing | Configuration-Management-&-Testing
In simple cases you may wish to use auto-wiring by type:
In your main prefix header file (or somewhere appropriate) add the following:
#define typhoon_shorthand
This will allow 'autoWire' as a shorthand to 'typhoon_autoWire'.
@implementation AutoWiringKnight
autoWire(@selector(quest), @selector(horse)) //Comma separated list of property names.
//Main implementation body here
@end
#Now use your component
TyphoonComponentFactory* factory = [[TyphoonComponentFactory alloc] init];
Knight* knight = [factory componentForType:[Knight class]];
You can mix-and-match auto-wiring with other assembly styles:
TyphoonComponentFactory* factory = [TyphoonComponentFactory defaultFactory];
Knight* knight = [factory componentForType:[Knight class]];
##Autowiring Features
- Auto-wiring will match by a single instance of the required class or protocol.
- Adding the auto-wiring macro to a class will register that class with the container, if it is not already.
- Auto-wiring is only available for property style injection (initializer not supported).
- You can mix-and-match auto-wiring with other assembly types.
Something still not clear? How about posting a question on StackOverflow.
Get started in two minutes.
Get familiar with Typhoon.
- Types of Injections
- What can be Injected
- Auto-injection (Objective-C)
- Scopes
- Storyboards
- TyphoonLoadedView
- Activating Assemblies
Become a Typhoon expert.
For contributors or curious folks.