diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d287f66 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Dominik Wagner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/TCMXML/TCMXMLWriter.h b/TCMXML/TCMXMLWriter.h index f18b75c..a3dcefe 100644 --- a/TCMXML/TCMXMLWriter.h +++ b/TCMXML/TCMXMLWriter.h @@ -8,14 +8,13 @@ #import -#define TCMWriterOptionNoOptions = 0UL; - -enum { +typedef NS_OPTIONS(NSUInteger, TCMXMLWriterOptions) +{ + TCMWriterOptionNoOptions = 0UL, TCMXMLWriterOptionPrettyPrinted = 1UL << 0, TCMXMLWriterOptionOrderedAttributes = 1UL << 1, // mainly for unit testing to get reproducible results, but can also be helpful otherwise for stable results TCMXMLWriterOptionPrettyBOOL = 1UL << 2 // prints BOOLEAN NSNumbers as boolYESValue and boolNOValue values - default is "yes" and "no" }; -typedef NSUInteger TCMXMLWriterOptions; @interface TCMXMLWriter : NSObject {} @@ -26,10 +25,10 @@ typedef NSUInteger TCMXMLWriterOptions; @property (nonatomic, strong) NSString *boolYESValue; @property (nonatomic, strong) NSString *boolNOValue; -- (id)initWithOptions:(TCMXMLWriterOptions)anOptionField; // stores marshalled stuff in string -- (id)initWithOptions:(TCMXMLWriterOptions)anOptionField fileURL:(NSURL *)aFileURL; +- (instancetype)initWithOptions:(TCMXMLWriterOptions)anOptionField; // stores marshalled stuff in string +- (instancetype)initWithOptions:(TCMXMLWriterOptions)anOptionField fileURL:(NSURL *)aFileURL; // stream must be open -- (id)initWithOptions:(TCMXMLWriterOptions)anOptionField outputStream:(NSOutputStream *)anOutputStream; +- (instancetype)initWithOptions:(TCMXMLWriterOptions)anOptionField outputStream:(NSOutputStream *)anOutputStream; // meta - (void)instructXMLStandalone; // diff --git a/TCMXML/TCMXMLWriter.m b/TCMXML/TCMXMLWriter.m index 4ce54f5..c8cf040 100644 --- a/TCMXML/TCMXMLWriter.m +++ b/TCMXML/TCMXMLWriter.m @@ -40,11 +40,11 @@ @implementation TCMXMLWriter @synthesize fileURL = _fileURL; -- (id)init { +- (instancetype)init { return [self initWithOptions:0]; } -- (id)initWithOptions:(TCMXMLWriterOptions)anOptionField { +- (instancetype)initWithOptions:(TCMXMLWriterOptions)anOptionField { if ((self = [super init])) { _elementNameStackArray = [NSMutableArray new]; self.writerOptions = anOptionField; @@ -57,14 +57,14 @@ - (id)initWithOptions:(TCMXMLWriterOptions)anOptionField { } return self; } -- (id)initWithOptions:(TCMXMLWriterOptions)anOptionField fileURL:(NSURL *)aFileURL { +- (instancetype)initWithOptions:(TCMXMLWriterOptions)anOptionField fileURL:(NSURL *)aFileURL { if ((self = [self initWithOptions:anOptionField])) { self.fileURL = aFileURL; } return self; } -- (id)initWithOptions:(TCMXMLWriterOptions)anOptionField outputStream:(NSOutputStream *)anOutputStream { +- (instancetype)initWithOptions:(TCMXMLWriterOptions)anOptionField outputStream:(NSOutputStream *)anOutputStream { if ((self = [self initWithOptions:anOptionField])) { self.outputStream = anOutputStream; } diff --git a/TCMXMLWriter.podspec b/TCMXMLWriter.podspec new file mode 100644 index 0000000..7130a17 --- /dev/null +++ b/TCMXMLWriter.podspec @@ -0,0 +1,14 @@ +Pod::Spec.new do |spec| + spec.name = 'TCMXMLWriter' + spec.version = '1.0.0' + spec.license = 'MIT' + spec.homepage = 'https://github.com/monkeydom/TCMXMLWriter' + spec.author = 'Dominik Wagner' + spec.summary = 'Elegant cocoa XML marshalling with a small memory footprint' + spec.source = { :git => 'https://github.com/monkeydom/TCMXMLWriter.git', :tag => spec.version.to_s } + spec.source_files = 'TCMXML/TCMXMLWriter.{h,m}' + spec.framework = 'Foundation' + spec.requires_arc = true + spec.ios.deployment_target = "6.0" + spec.osx.deployment_target = "10.8" +end