Skip to content

Commit

Permalink
Added support NSCopying protocol for JSReportPagesRange
Browse files Browse the repository at this point in the history
  • Loading branch information
ogubariev committed Jun 1, 2016
1 parent 2288692 commit 1dcbd17
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/JSReportExtention/JSReportExecutionConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
@property (nonatomic, strong, nullable) NSString *transformerKey;
@property (nonatomic, strong, nonnull) NSString *outputFormat;
@property (nonatomic, strong, nonnull) NSString *attachmentsPrefix;
@property (nonatomic, strong, nonnull) JSReportPagesRange *pagesRange;
@property (nonatomic, copy, nonnull) JSReportPagesRange *pagesRange;

+(nonnull instancetype)saveReportConfigurationWithFormat:(nonnull NSString *)format pagesRange:(nonnull JSReportPagesRange *)pagesRange;

Expand Down
2 changes: 1 addition & 1 deletion Sources/JSReportExtention/JSReportPagesRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@since 2.3
*/

@interface JSReportPagesRange : NSObject
@interface JSReportPagesRange : NSObject <NSCopying>

@property (nonatomic, assign) NSUInteger startPage;
@property (nonatomic, assign) NSUInteger endPage;
Expand Down
9 changes: 9 additions & 0 deletions Sources/JSReportExtention/JSReportPagesRange.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ - (NSString *)formattedPagesRange {
return [NSString stringWithFormat:@"%@-%@", @(self.startPage), @(self.endPage)];
}

#pragma mark - NSCopying
- (id)copyWithZone:(NSZone *)zone {
JSReportPagesRange *newRange = [[self class] allocWithZone:zone];
newRange.startPage = self.startPage;
newRange.endPage = self.endPage;

return newRange;
}

#pragma mark - Description
- (NSString *)description {
return [NSString stringWithFormat:@"PagesRange from: %@, to: %@", @(self.startPage), @(self.endPage)];
Expand Down

0 comments on commit 1dcbd17

Please sign in to comment.