Skip to content

Commit ff819df

Browse files
henry-cooper-primerOnurVar
authored andcommitted
chore: Add standard header as SwiftFormat rule (#1396)
1 parent f08ddd3 commit ff819df

20 files changed

+54
-50
lines changed

BuildTools/.swiftformat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
--rules isEmpty, preferCountWhere, redundantExtensionACL, modifierOrder, consecutiveBlankLines, blankLineAfterImports, andOperator, elseOnSameLine, fileHeader, hoistPatternLet, leadingDelimiters, modifiersOnSameLine, preferKeyPath, redundantInternal
2+
--header "\n {file}\n\n Copyright © {year} Primer API Ltd. All rights reserved. \n Licensed under the MIT License. See LICENSE file in the project root for full license information."

Debug App/Sources/Extension/Collection+Extensions.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
//
2+
// Collection+Extensions.swift
3+
//
4+
// Copyright © 2025 Primer API Ltd. All rights reserved.
5+
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
6+
17
extension Collection {
28
subscript(safe index: Index) -> Element? {
39
indices.contains(index) ? self[index] : nil

Sources/PrimerSDK/Classes/Core/PrimerHeadlessUniversalCheckout/Managers/VaultManager.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// VaultManager.swift
33
//
4-
// Copyright © 2025 Primer API Ltd. All rights reserved.
4+
// Copyright © 2025 Primer API Ltd. All rights reserved.
55
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
66

77
// swiftlint:disable cyclomatic_complexity
@@ -33,7 +33,7 @@ extension PrimerHeadlessUniversalCheckout {
3333

3434
// MARK: Public functions
3535

36-
public override init() {
36+
override public init() {
3737
PrimerInternal.shared.sdkIntegrationType = .headless
3838
PrimerInternal.shared.intent = .checkout
3939

@@ -50,7 +50,7 @@ extension PrimerHeadlessUniversalCheckout {
5050
try self.validate()
5151
}
5252

53-
internal func validateAdditionalDataSynchronously(vaultedPaymentMethodId: String, vaultedPaymentMethodAdditionalData: PrimerVaultedPaymentMethodAdditionalData) -> [Error]? {
53+
func validateAdditionalDataSynchronously(vaultedPaymentMethodId: String, vaultedPaymentMethodAdditionalData: PrimerVaultedPaymentMethodAdditionalData) -> [Error]? {
5454
var errors: [Error] = []
5555

5656
guard let vaultedPaymentMethod = vaultedPaymentMethods?.first(where: { $0.id == vaultedPaymentMethodId }) else {
@@ -259,7 +259,7 @@ extension PrimerHeadlessUniversalCheckout {
259259
case .succeed:
260260
return nil
261261

262-
case .continueWithNewClientToken(let newClientToken):
262+
case let .continueWithNewClientToken(newClientToken):
263263
let apiConfigurationModule = PrimerAPIConfigurationModule()
264264
try await apiConfigurationModule.storeRequiredActionClientToken(newClientToken)
265265

@@ -269,7 +269,7 @@ extension PrimerHeadlessUniversalCheckout {
269269

270270
return (decodedJWTToken, paymentMethodTokenData)
271271

272-
case .fail(let message):
272+
case let .fail(message):
273273
let merchantErr: Error
274274
if let message {
275275
merchantErr = PrimerError.merchantError(message: message)
@@ -281,7 +281,7 @@ extension PrimerHeadlessUniversalCheckout {
281281

282282
} else if let resumeDecisionType = resumeDecision.type as? PrimerHeadlessUniversalCheckoutResumeDecision.DecisionType {
283283
switch resumeDecisionType {
284-
case .continueWithNewClientToken(let newClientToken):
284+
case let .continueWithNewClientToken(newClientToken):
285285
let apiConfigurationModule: PrimerAPIConfigurationModuleProtocol = PrimerAPIConfigurationModule()
286286
try await apiConfigurationModule.storeRequiredActionClientToken(newClientToken)
287287

@@ -470,7 +470,7 @@ extension PrimerHeadlessUniversalCheckout {
470470

471471
if let resumeDecisionType = resumeDecision.type as? PrimerResumeDecision.DecisionType {
472472
switch resumeDecisionType {
473-
case .fail(let message):
473+
case let .fail(message):
474474
let err: Error
475475
if let message {
476476
err = PrimerError.merchantError(message: message)

Sources/PrimerSDK/Classes/Extensions & Utilities/CancellableTask.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// CancellableTask.swift
33
//
4-
// Copyright © 2025 Primer API Ltd. All rights reserved.
4+
// Copyright © 2025 Primer API Ltd. All rights reserved.
55
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
66

77
actor CancellableTask<Success> {

Sources/PrimerSDK/Classes/Extensions & Utilities/ImageFileProcessor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// ImageFileProcessor.swift
33
//
4-
// Copyright © 2025 Primer API Ltd. All rights reserved.
4+
// Copyright © 2025 Primer API Ltd. All rights reserved.
55
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
66

77
import Foundation

Sources/PrimerSDK/Classes/Services/Network/PrimerAPIClient.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// PrimerAPIClient.swift
33
//
4-
// Copyright © 2025 Primer API Ltd. All rights reserved.
4+
// Copyright © 2025 Primer API Ltd. All rights reserved.
55
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
66

77
import Foundation
@@ -15,7 +15,7 @@ let defaultNetworkService = DefaultNetworkService(
1515
// swiftlint:disable:next type_body_length
1616
final class PrimerAPIClient: PrimerAPIClientProtocol {
1717

18-
internal let networkService: NetworkServiceProtocol
18+
let networkService: NetworkServiceProtocol
1919

2020
// MARK: - Object lifecycle
2121

@@ -29,7 +29,7 @@ final class PrimerAPIClient: PrimerAPIClientProtocol {
2929
switch result {
3030
case .success:
3131
completion(.success(true))
32-
case .failure(let error):
32+
case let .failure(error):
3333
completion(.failure(error))
3434
}
3535
}
@@ -45,10 +45,10 @@ final class PrimerAPIClient: PrimerAPIClientProtocol {
4545
let endpoint = PrimerAPI.fetchVaultedPaymentMethods(clientToken: clientToken)
4646
networkService.request(endpoint) { (result: Result<Response.Body.VaultedPaymentMethods, Error>) in
4747
switch result {
48-
case .success(let vaultedPaymentMethodsResponse):
48+
case let .success(vaultedPaymentMethodsResponse):
4949
AppState.current.selectedPaymentMethodId = vaultedPaymentMethodsResponse.data.first?.id
5050
completion(.success(vaultedPaymentMethodsResponse))
51-
case .failure(let err):
51+
case let .failure(err):
5252
completion(.failure(err))
5353
}
5454
}
@@ -94,7 +94,7 @@ final class PrimerAPIClient: PrimerAPIClientProtocol {
9494
switch result {
9595
case .success:
9696
completion(.success(()))
97-
case .failure(let error):
97+
case let .failure(error):
9898
ErrorHandler.shared.handle(error: error)
9999
completion(.failure(error))
100100
}
@@ -119,9 +119,9 @@ final class PrimerAPIClient: PrimerAPIClientProtocol {
119119
let retryConfig = RetryConfig(enabled: true)
120120
networkService.request(endpoint, retryConfig: retryConfig) { (result: Result<PrimerAPIConfiguration, Error>, headers) in
121121
switch result {
122-
case .success(let result):
122+
case let .success(result):
123123
completion(.success(result), headers)
124-
case .failure(let error):
124+
case let .failure(error):
125125
ErrorHandler.shared.handle(error: error)
126126
completion(.failure(error), nil)
127127
}
@@ -330,9 +330,9 @@ final class PrimerAPIClient: PrimerAPIClientProtocol {
330330
let endpoint = PrimerAPI.requestPrimerConfigurationWithActions(clientToken: clientToken, request: request)
331331
networkService.request(endpoint) { (result: Result<PrimerAPIConfiguration, Error>, headers) in
332332
switch result {
333-
case .success(let result):
333+
case let .success(result):
334334
completion(.success(result), headers)
335-
case .failure(let error):
335+
case let .failure(error):
336336
ErrorHandler.shared.handle(error: error)
337337
completion(.failure(error), nil)
338338
}
@@ -481,7 +481,7 @@ final class PrimerAPIClient: PrimerAPIClientProtocol {
481481
switch result {
482482
case .success:
483483
completion(.success(()))
484-
case .failure(let err):
484+
case let .failure(err):
485485
completion(.failure(err))
486486
}
487487
}
@@ -577,9 +577,9 @@ private extension PrimerAPIClient {
577577
func execute<T>(_ endpoint: Endpoint, completion: @escaping APICompletion<T>) -> PrimerCancellable? where T: Decodable {
578578
networkService.request(endpoint) { (result: Result<T, Error>) in
579579
switch result {
580-
case .success(let result):
580+
case let .success(result):
581581
completion(.success(result))
582-
case .failure(let error):
582+
case let .failure(error):
583583
ErrorHandler.shared.handle(error: error)
584584
completion(.failure(error))
585585
}

Sources/PrimerSDK/Classes/Services/Network/Protocols/PrimerAPIClientBanksProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// PrimerAPIClientBanksProtocol.swift
33
//
4-
// Copyright © 2025 Primer API Ltd. All rights reserved.
4+
// Copyright © 2025 Primer API Ltd. All rights reserved.
55
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
66

77
import Foundation

Sources/PrimerSDK/Classes/User Interface/Root/CVVRecapture/CVVRecaptureViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// CVVRecaptureViewController.swift
33
//
4-
// Copyright © 2025 Primer API Ltd. All rights reserved.
4+
// Copyright © 2025 Primer API Ltd. All rights reserved.
55
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
66

77
import UIKit

Sources/PrimerSDK/Classes/User Interface/TokenizationViewModels/PrimerTestPaymentMethodTokenizationViewModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// PrimerTestPaymentMethodTokenizationViewModel.swift
33
//
4-
// Copyright © 2025 Primer API Ltd. All rights reserved.
4+
// Copyright © 2025 Primer API Ltd. All rights reserved.
55
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
66

77
import UIKit
@@ -22,7 +22,7 @@ final class PrimerTestPaymentMethodTokenizationViewModel: PaymentMethodTokenizat
2222
180+(CGFloat(decisions.count)*tableView.rowHeight)
2323
}
2424

25-
internal lazy var tableView: UITableView = {
25+
lazy var tableView: UITableView = {
2626
let theme: PrimerThemeProtocol = DependencyContainer.resolve()
2727

2828
let tableView = UITableView()

Sources/PrimerSDK/Classes/User Interface/Vault/VaultPaymentMethodViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// VaultPaymentMethodViewController.swift
33
//
4-
// Copyright © 2025 Primer API Ltd. All rights reserved.
4+
// Copyright © 2025 Primer API Ltd. All rights reserved.
55
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
66

77
// swiftlint:disable function_body_length

0 commit comments

Comments
 (0)