diff --git a/ReactiveNSXMLParserLib/ReactiveNSXMLParser.podspec b/ReactiveNSXMLParser.podspec similarity index 97% rename from ReactiveNSXMLParserLib/ReactiveNSXMLParser.podspec rename to ReactiveNSXMLParser.podspec index 857e965..d29b4eb 100644 --- a/ReactiveNSXMLParserLib/ReactiveNSXMLParser.podspec +++ b/ReactiveNSXMLParser.podspec @@ -3,7 +3,7 @@ Pod::Spec.new do |s| # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # s.name = "ReactiveNSXMLParser" - s.version = "0.1.1" + s.version = "0.1.2" s.summary = "ReactiveCocoa extensions for NSXMLParser: A concise, stream-based API for parsing XML with NSXMLParser." s.description = <<-DESC @@ -29,7 +29,7 @@ Pod::Spec.new do |s| # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # - s.ios.deployment_target = '5.0' + s.ios.deployment_target = '6.0' s.osx.deployment_target = '10.7' diff --git a/ReactiveNSXMLParserLib/ReactiveNSXMLParserLib/Classes/NSXMLParser+ReactiveCocoa.h b/ReactiveNSXMLParserLib/ReactiveNSXMLParserLib/Classes/NSXMLParser+ReactiveCocoa.h index 189af5c..88b81f6 100644 --- a/ReactiveNSXMLParserLib/ReactiveNSXMLParserLib/Classes/NSXMLParser+ReactiveCocoa.h +++ b/ReactiveNSXMLParserLib/ReactiveNSXMLParserLib/Classes/NSXMLParser+ReactiveCocoa.h @@ -73,4 +73,20 @@ typedef BOOL (^ElementFilterBlock)(NSString *elementName); + (RACSignal *)rac_dictionaryFromString:(NSString *)string elementFilter:(ElementFilterBlock)filterBlock; +/** + * Parse a XML using a pre-init'ed parser. + * + * @return RACSignal Will 'next' exactly once, with a NSDictionary parameter + */ +- (RACSignal *)rac_parser; + +/** + * Parse a XML using a pre-init'ed parser. + * + * @param filterBlock ElementFilterBlock (optional) Enables filtering on an element-name level + * + * @return RACSignal Will 'next' exactly once, with a NSDictionary parameter + */ +- (RACSignal *)rac_parserWithElementFilter:(ElementFilterBlock)filterBlock; + @end diff --git a/ReactiveNSXMLParserLib/ReactiveNSXMLParserLib/Classes/NSXMLParser+ReactiveCocoa.m b/ReactiveNSXMLParserLib/ReactiveNSXMLParserLib/Classes/NSXMLParser+ReactiveCocoa.m index aca2e39..a2515de 100644 --- a/ReactiveNSXMLParserLib/ReactiveNSXMLParserLib/Classes/NSXMLParser+ReactiveCocoa.m +++ b/ReactiveNSXMLParserLib/ReactiveNSXMLParserLib/Classes/NSXMLParser+ReactiveCocoa.m @@ -58,6 +58,16 @@ + (RACSignal *)rac_dictionaryFromData:(NSData *)data elementFilter:(ElementFilte return [self rac_dictionaryFromSignal:[self rac_parseData:data] elementfilter:filterBlock]; } +- (RACSignal *)rac_parser +{ + return [NSXMLParser rac_parseWithParser:self]; +} + +- (RACSignal *)rac_parserWithElementFilter:(ElementFilterBlock)filterBlock +{ + return [NSXMLParser rac_dictionaryFromSignal:[self rac_parser] elementfilter:filterBlock]; +} + #pragma mark - Internal /**