diff --git a/.gitignore b/.gitignore index f271cb0e..7de6f148 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ profile *.moved-aside # Desktop Servies .DS_Store +.idea diff --git a/Mantle/MTLXMLAdapter.h b/Mantle/MTLXMLAdapter.h index d3dab134..62dfa90b 100644 --- a/Mantle/MTLXMLAdapter.h +++ b/Mantle/MTLXMLAdapter.h @@ -7,9 +7,9 @@ // #import -#import "DDXML.h" -#import "DDXMLNode.h" +@class DDXMLNode; +@class DDXMLElement; @class MTLModel; @protocol MTLXMLSerializing diff --git a/Mantle/NSValueTransformer+MTLXMLTransformerAdditions.m b/Mantle/NSValueTransformer+MTLXMLTransformerAdditions.m index 614745e9..e4b0506f 100644 --- a/Mantle/NSValueTransformer+MTLXMLTransformerAdditions.m +++ b/Mantle/NSValueTransformer+MTLXMLTransformerAdditions.m @@ -10,24 +10,24 @@ #import "MTLModel.h" #import "MTLValueTransformer.h" #import "MTLXMLAdapter.h" - +#import "DDXML.h" @implementation NSValueTransformer (MTLXMLTransformerAdditions) -+ (NSDateFormatter *)dateFormatter -{ - static NSDateFormatter* _dateFormatter; - if (!_dateFormatter) - { - _dateFormatter = [NSDateFormatter new]; - [_dateFormatter setDateStyle:NSDateFormatterFullStyle]; - [_dateFormatter setTimeStyle:NSDateFormatterFullStyle]; ++ (NSDateFormatter *)dateFormatter { + NSMutableDictionary *dictionary = [[NSThread currentThread] threadDictionary]; + NSDateFormatter *dateFormatter = dictionary[@"MTLDateFormatter"]; + if (!dateFormatter) { + dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.dateStyle = NSDateFormatterFullStyle; + dateFormatter.timeStyle = NSDateFormatterFullStyle; + dictionary[@"MTLDateFormatter"] = dateFormatter; } - - return _dateFormatter; + + return dateFormatter; } -+ (NSValueTransformer *)mtl_XMLTransformerForDateWithFormat:(NSString*)dateFormat { ++ (NSValueTransformer *)mtl_XMLTransformerForDateWithFormat:(NSString *)dateFormat { return [MTLValueTransformer reversibleTransformerWithForwardBlock:^id(NSArray *nodes) { if (nodes == nil || nodes.count == 0) return nil; @@ -149,7 +149,7 @@ + (NSValueTransformer *)mtl_XMLArrayTransformerWithModelClass:(Class)modelClass ]; } -+ (NSValueTransformer *)mtl_XMLNonUniformObjectArrayTransformerWithModelClass:(Class)modelClass { ++ (NSValueTransformer *)mtl_XMLNonUniformObjectArrayTransformerWithModelClass:(Class)modelClass { return [MTLValueTransformer reversibleTransformerWithForwardBlock:^ id (NSArray *nodes) { diff --git a/MantleXMLAdapter.podspec b/MantleXMLAdapter.podspec index d069dfe0..e2cd01a2 100644 --- a/MantleXMLAdapter.podspec +++ b/MantleXMLAdapter.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = "MantleXMLAdapter" s.platform = :ios, "5.0" - s.version = "0.2.2" + s.version = "0.2.5" s.summary = "MantleXMLAdapter adds support to Mantle to create MTLModel objects from xml documents and (optionally) from models into xml documents." s.homepage = "https://github.com/mbaranowski/MantleXMLAdapter" s.license = "MIT" s.authors = { "Matthew Baranowski" => "matt.baranowski@willowtreeapps.com" } - s.source = { :git => "https://github.com/mbaranowski/MantleXMLAdapter.git", :tag => '0.2.2' } + s.source = { :git => "https://github.com/mbaranowski/MantleXMLAdapter.git", :tag => '0.2.5' } s.source_files = 'Mantle/MTLXMLAdapter.{h,m}', 'Mantle/NSValueTransformer+MTLXMLTransformerAdditions.{h,m}' s.dependency 'KissXML' s.dependency 'Mantle'