-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does TyphoonConfig work with plist/json? #241
Comments
@alexgarbarev Can you please take care of this one. Let's make plist the default in the docs. |
Hi @johntvolk-novu, thank you for feedback. To use json/plist config files use one of these methods: /** Append resource found in main bundle by name */
- (void)useResourceWithName:(NSString *)name;
/** Append resource loaded from file at path */
- (void)useResourceAtPath:(NSString *)path;
/** Append TyphoonResource with specified extension (@see availableExtensions method) */
- (void)useResource:(id<TyphoonResource>)resource withExtension:(NSString *)typeExtension; |
Sounds like it is time to delete the old method. |
Thanks, Alex/Jasper! |
Is there a way to do this at build-time using TyphoonDefinition (rather than runtime using TyphoonConfigPostProcessor)? edit: I was able to get this working by "manually" building a TyphoonDefinition with TyphoonConfigPostProcessor as the defined class: [TyphoonDefinition withClass:[TyphoonConfigPostProcessor class] ... I guess I should be asking if there's a simpler way to do this at build-time. Thanks. |
@johntvolk-novu No, currently we have not shorthands for that. Only way is creation definition manually. |
I believe @johntvolk-novu was referring to _'to attach a properties file at build-time'_ from here: . . . which for example if you're using plist bootstrapping, allows you to set up all of Typhoon, including your normal runtime config in the assembly. |
I ran into this issue tonight too after putting together a plist containing some dictionaries. So you're recommending just defining those dictionaries as definitions in the assemblies, or is there a way to declare the TyphoonConfigPostProcessor and pass the resource to it using TyphoonDefinition? @johntvolk-novu mentions manually building it, but I'm unsure of how he did that. |
Hi @dereekb // This definition will be automatically catched by Typhoon
- (TyphoonConfigPostProcessor *)configPostProcessor
{
return [TyphoonDefinition withClass:[TyphoonConfigPostProcessor class] configuration:^(TyphoonDefinition *definition) {
[definition injectMethod:@selector(useResourceWithName:) parameters:^(TyphoonMethod *initializer) {
[initializer injectParameterWith:@"you_config_file.plist"];
}];
}];
} |
Thanks! I'm still working through learning Typhoon and misunderstood what the injectMethod: method actually did. |
The documentation still refers to a short-hand approach that only works with .properties style: - (id)config
{
return [TyphoonDefinition configDefinitionWithResource:
[TyphoonBundleResource withName:@"Configuration.properties"]];
} Today I'll delete these deprecated methods, and add back a shorthand that:
|
I removed old methods and replace with new which doesn't use deprecated methods. TODO: update docs and close this ticket |
I will update docs + sample application over the weekend. |
Docs updated. |
Hi,
I'm using v2.1 and I've only ever been able to get TyphoonConfig to work using .properties files. I got curious after trying to get .plist to work again and started walking through the [TyphoonDefinition configDefinitionWithResources] method. From what I could tell, the method flow ends up in [TyphoonConfigPostProcessor configurerWithResourceList] which seems to specify to always use the "properties" style configuration. It seems like I must be getting this wrong, because the docs specifically mention json/plist. Any help would be appreciated. Thanks.
The text was updated successfully, but these errors were encountered: