mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-05 15:10:49 +00:00
Merge pull request #1697 from wing328/objc_minor_style
[ObjC] minor style change for objc client
This commit is contained in:
commit
2a8afbec8d
@ -132,6 +132,7 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
if (accepts == nil || [accepts count] == 0) {
|
if (accepts == nil || [accepts count] == 0) {
|
||||||
return @"";
|
return @"";
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableArray *lowerAccepts = [[NSMutableArray alloc] initWithCapacity:[accepts count]];
|
NSMutableArray *lowerAccepts = [[NSMutableArray alloc] initWithCapacity:[accepts count]];
|
||||||
for (NSString *string in accepts) {
|
for (NSString *string in accepts) {
|
||||||
NSString * lowerAccept = [string lowercaseString];
|
NSString * lowerAccept = [string lowercaseString];
|
||||||
@ -140,9 +141,11 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
}
|
}
|
||||||
[lowerAccepts addObject:lowerAccept];
|
[lowerAccepts addObject:lowerAccept];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lowerAccepts.count == 1) {
|
if (lowerAccepts.count == 1) {
|
||||||
return [lowerAccepts firstObject];
|
return [lowerAccepts firstObject];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [lowerAccepts componentsJoinedByString:@", "];
|
return [lowerAccepts componentsJoinedByString:@", "];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,12 +6,13 @@
|
|||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self)
|
|
||||||
{
|
if (self) {
|
||||||
// initalise property's default value, if any
|
// initalise property's default value, if any
|
||||||
{{#vars}}{{#defaultValue}}self.{{name}} = {{{defaultValue}}};
|
{{#vars}}{{#defaultValue}}self.{{name}} = {{{defaultValue}}};
|
||||||
{{/defaultValue}}{{/vars}}
|
{{/defaultValue}}{{/vars}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,24 +128,25 @@ static void (^reachabilityChangeBlock)(int);
|
|||||||
/*
|
/*
|
||||||
* Detect `Accept` from accepts
|
* Detect `Accept` from accepts
|
||||||
*/
|
*/
|
||||||
+ (NSString *) selectHeaderAccept:(NSArray *)accepts
|
+ (NSString *) selectHeaderAccept:(NSArray *)accepts {
|
||||||
{
|
|
||||||
if (accepts == nil || [accepts count] == 0) {
|
if (accepts == nil || [accepts count] == 0) {
|
||||||
return @"";
|
return @"";
|
||||||
}
|
}
|
||||||
|
|
||||||
NSMutableArray *lowerAccepts = [[NSMutableArray alloc] initWithCapacity:[accepts count]];
|
NSMutableArray *lowerAccepts = [[NSMutableArray alloc] initWithCapacity:[accepts count]];
|
||||||
[accepts enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
for (NSString *string in accepts) {
|
||||||
[lowerAccepts addObject:[obj lowercaseString]];
|
NSString * lowerAccept = [string lowercaseString];
|
||||||
}];
|
if ([lowerAccept containsString:@"application/json"]) {
|
||||||
|
|
||||||
|
|
||||||
if ([lowerAccepts containsObject:@"application/json"]) {
|
|
||||||
return @"application/json";
|
return @"application/json";
|
||||||
}
|
}
|
||||||
else {
|
[lowerAccepts addObject:lowerAccept];
|
||||||
return [lowerAccepts componentsJoinedByString:@", "];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lowerAccepts.count == 1) {
|
||||||
|
return [lowerAccepts firstObject];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [lowerAccepts componentsJoinedByString:@", "];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self)
|
|
||||||
{
|
if (self) {
|
||||||
// initalise property's default value, if any
|
// initalise property's default value, if any
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self)
|
|
||||||
{
|
if (self) {
|
||||||
// initalise property's default value, if any
|
// initalise property's default value, if any
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self)
|
|
||||||
{
|
if (self) {
|
||||||
// initalise property's default value, if any
|
// initalise property's default value, if any
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self)
|
|
||||||
{
|
if (self) {
|
||||||
// initalise property's default value, if any
|
// initalise property's default value, if any
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
|
|
||||||
- (instancetype)init {
|
- (instancetype)init {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self)
|
|
||||||
{
|
if (self) {
|
||||||
// initalise property's default value, if any
|
// initalise property's default value, if any
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user