Skip to content

Commit 720ab3d

Browse files
authored
run swiftlint latest version on swift samples (#6788)
1 parent 5cce9dc commit 720ab3d

581 files changed

Lines changed: 2694 additions & 3608 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

samples/client/petstore/swift5/alamofireLibrary/Package.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ let package = Package(
1414
// Products define the executables and libraries produced by a package, and make them visible to other packages.
1515
.library(
1616
name: "PetstoreClient",
17-
targets: ["PetstoreClient"]),
17+
targets: ["PetstoreClient"])
1818
],
1919
dependencies: [
2020
// Dependencies declare other packages that this package depends on.
21-
.package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.9.1"),
21+
.package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.9.1")
2222
],
2323
targets: [
2424
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
2525
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
2626
.target(
2727
name: "PetstoreClient",
28-
dependencies: ["Alamofire", ],
28+
dependencies: ["Alamofire" ],
2929
path: "PetstoreClient/Classes"
30-
),
30+
)
3131
]
3232
)

samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIHelper.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import Foundation
88

99
public struct APIHelper {
10-
public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? {
10+
public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? {
1111
let destination = source.reduce(into: [String: Any]()) { (result, item) in
1212
if let value = item.value {
1313
result[item.key] = value
@@ -20,17 +20,17 @@ public struct APIHelper {
2020
return destination
2121
}
2222

23-
public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] {
23+
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
2424
return source.reduce(into: [String: String]()) { (result, item) in
25-
if let collection = item.value as? Array<Any?> {
26-
result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",")
25+
if let collection = item.value as? [Any?] {
26+
result[item.key] = collection.filter({ $0 != nil }).map { "\($0!)" }.joined(separator: ",")
2727
} else if let value: Any = item.value {
2828
result[item.key] = "\(value)"
2929
}
3030
}
3131
}
3232

33-
public static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? {
33+
public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? {
3434
guard let source = source else {
3535
return nil
3636
}
@@ -46,15 +46,15 @@ public struct APIHelper {
4646
}
4747

4848
public static func mapValueToPathItem(_ source: Any) -> Any {
49-
if let collection = source as? Array<Any?> {
49+
if let collection = source as? [Any?] {
5050
return collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",")
5151
}
5252
return source
5353
}
5454

55-
public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? {
55+
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
5656
let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in
57-
if let collection = item.value as? Array<Any?> {
57+
if let collection = item.value as? [Any?] {
5858
collection.filter({ $0 != nil }).map({"\($0!)"}).forEach { value in
5959
result.append(URLQueryItem(name: item.key, value: value))
6060
}
@@ -69,4 +69,3 @@ public struct APIHelper {
6969
return destination
7070
}
7171
}
72-

samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ import Foundation
99
open class PetstoreClientAPI {
1010
public static var basePath = "http://petstore.swagger.io:80/v2"
1111
public static var credential: URLCredential?
12-
public static var customHeaders: [String:String] = [:]
12+
public static var customHeaders: [String: String] = [:]
1313
public static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()
1414
public static var apiResponseQueue: DispatchQueue = .main
1515
}
1616

1717
open class RequestBuilder<T> {
1818
var credential: URLCredential?
19-
var headers: [String:String]
20-
public let parameters: [String:Any]?
19+
var headers: [String: String]
20+
public let parameters: [String: Any]?
2121
public let isBody: Bool
2222
public let method: String
2323
public let URLString: String
2424

2525
/// Optional block to obtain a reference to the request's progress instance when available.
26-
public var onProgressReady: ((Progress) -> ())?
26+
public var onProgressReady: ((Progress) -> Void)?
2727

28-
required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) {
28+
required public init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) {
2929
self.method = method
3030
self.URLString = URLString
3131
self.parameters = parameters
@@ -35,7 +35,7 @@ open class RequestBuilder<T> {
3535
addHeaders(PetstoreClientAPI.customHeaders)
3636
}
3737

38-
open func addHeaders(_ aHeaders:[String:String]) {
38+
open func addHeaders(_ aHeaders: [String: String]) {
3939
for (header, value) in aHeaders {
4040
headers[header] = value
4141
}
@@ -58,5 +58,5 @@ open class RequestBuilder<T> {
5858

5959
public protocol RequestBuilderFactory {
6060
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type
61-
func getBuilder<T:Decodable>() -> RequestBuilder<T>.Type
61+
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type
6262
}

samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/AnotherFakeAPI.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
import Foundation
99

10-
11-
1210
open class AnotherFakeAPI {
1311
/**
1412
To test special tags
@@ -17,7 +15,7 @@ open class AnotherFakeAPI {
1715
- parameter apiResponseQueue: The queue on which api response is dispatched.
1816
- parameter completion: completion handler to receive the data and the error objects
1917
*/
20-
open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
18+
open class func call123testSpecialTags(body: Client, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) {
2119
call123testSpecialTagsWithRequestBuilder(body: body).execute(apiResponseQueue) { result -> Void in
2220
switch result {
2321
case let .success(response):

0 commit comments

Comments
 (0)