Skip to content

Commit

Permalink
[Fix] capitalizedString issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheng Pan committed Nov 21, 2017
1 parent 41576a0 commit 56efa1b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Source/AccessCodeGenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,22 @@ + (NSString *)getterWithPSProperty:(PSProperty *)model

+ (NSString *)setterWithPSProperty:(PSProperty *)model {
NSString *setter = @"";
if (model.name.length < 1) {
return setter;
}

NSString *firstLetter = [model.name substringToIndex:1];
NSString *name = [model.name stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:firstLetter.uppercaseString];
if (model.isObjectType) {
setter = [NSString stringWithFormat:@"\n- (void)set%@:(%@ *)%@ {\n _%@ = %@;\n}",
[model.name capitalizedString],
name,
model.dataType,
model.name,
model.name,
model.name];
} else {
setter = [NSString stringWithFormat:@"\n- (void)set%@:(%@)%@ {\n _%@ = %@;\n}",
[model.name capitalizedString],
name,
model.dataType,
model.name,
model.name,
Expand Down

0 comments on commit 56efa1b

Please sign in to comment.