Merge pull request #1697 from wing328/objc_minor_style

[ObjC] minor style change for objc client
This commit is contained in:
wing328 2015-12-11 14:43:38 +08:00
commit 2a8afbec8d
11 changed files with 79 additions and 69 deletions

View File

@ -132,6 +132,7 @@ static void (^reachabilityChangeBlock)(int);
if (accepts == nil || [accepts count] == 0) {
return @"";
}
NSMutableArray *lowerAccepts = [[NSMutableArray alloc] initWithCapacity:[accepts count]];
for (NSString *string in accepts) {
NSString * lowerAccept = [string lowercaseString];
@ -140,9 +141,11 @@ static void (^reachabilityChangeBlock)(int);
}
[lowerAccepts addObject:lowerAccept];
}
if (lowerAccepts.count == 1) {
return [lowerAccepts firstObject];
}
return [lowerAccepts componentsJoinedByString:@", "];
}

View File

@ -6,12 +6,13 @@
- (instancetype)init {
self = [super init];
if (self)
{
if (self) {
// initalise property's default value, if any
{{#vars}}{{#defaultValue}}self.{{name}} = {{{defaultValue}}};
{{/defaultValue}}{{/vars}}
}
return self;
}

View File

@ -128,24 +128,25 @@ static void (^reachabilityChangeBlock)(int);
/*
* Detect `Accept` from accepts
*/
+ (NSString *) selectHeaderAccept:(NSArray *)accepts
{
+ (NSString *) selectHeaderAccept:(NSArray *)accepts {
if (accepts == nil || [accepts count] == 0) {
return @"";
}
NSMutableArray *lowerAccepts = [[NSMutableArray alloc] initWithCapacity:[accepts count]];
[accepts enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[lowerAccepts addObject:[obj lowercaseString]];
}];
if ([lowerAccepts containsObject:@"application/json"]) {
for (NSString *string in accepts) {
NSString * lowerAccept = [string lowercaseString];
if ([lowerAccept containsString:@"application/json"]) {
return @"application/json";
}
else {
return [lowerAccepts componentsJoinedByString:@", "];
[lowerAccepts addObject:lowerAccept];
}
if (lowerAccepts.count == 1) {
return [lowerAccepts firstObject];
}
return [lowerAccepts componentsJoinedByString:@", "];
}
/*

View File

@ -4,11 +4,12 @@
- (instancetype)init {
self = [super init];
if (self)
{
if (self) {
// initalise property's default value, if any
}
return self;
}

View File

@ -4,11 +4,12 @@
- (instancetype)init {
self = [super init];
if (self)
{
if (self) {
// initalise property's default value, if any
}
return self;
}

View File

@ -4,11 +4,12 @@
- (instancetype)init {
self = [super init];
if (self)
{
if (self) {
// initalise property's default value, if any
}
return self;
}

View File

@ -4,11 +4,12 @@
- (instancetype)init {
self = [super init];
if (self)
{
if (self) {
// initalise property's default value, if any
}
return self;
}

View File

@ -4,11 +4,12 @@
- (instancetype)init {
self = [super init];
if (self)
{
if (self) {
// initalise property's default value, if any
}
return self;
}