Skip to content

Commit

Permalink
Add comments to empty non-optional closures
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Solovev committed May 27, 2024
1 parent ca5e791 commit 3d69d52
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 17 deletions.
4 changes: 3 additions & 1 deletion OmiseSDK/Sources/OmiseSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ public class OmiseSDK {

private extension OmiseSDK {
private func preloadCapabilityAPI() {
client.capability { _ in }
client.capability { _ in
// Preload capability and auto cache it as client.latestLoadedCapability
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions OmiseSDK/Sources/Views/Components/TextFieldView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class TextFieldView: UIView {
}()

var onTextFieldShouldReturn: () -> (Bool) = { return false }
var onTextChanged: () -> Void = { }
var onBeginEditing: () -> Void = { }
var onEndEditing: () -> Void = { }
var onTextChanged: () -> Void = { /* Non-optional default empty implementation */ }
var onBeginEditing: () -> Void = { /* Non-optional default empty implementation */ }
var onEndEditing: () -> Void = { /* Non-optional default empty implementation */ }

// swiftlint:disable attributes
@ProxyProperty(\TextFieldView.textField.keyboardType) var keyboardType: UIKeyboardType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class OmiseTextField: UITextField {
}

public var onTextFieldShouldReturn: () -> (Bool) = { return false }
public var onValueChanged: () -> Void = { }
public var onValueChanged: () -> Void = { /* Non-optional default empty implementation */ }

@IBInspectable var borderWidth: CGFloat {
get {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AtomePaymentFormViewModel: AtomePaymentFormViewModelProtocol, CountryListV
}
}

var onSelectCountry: (Country) -> Void = { _ in }
var onSelectCountry: (Country) -> Void = { _ in /* Non-optional default empty implementation */ }

var countryListViewModel: CountryListViewModelProtocol { return self }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import UIKit

class PaymentFormController: UIViewController {
var onSubmitButtonTappedClosure: () -> Void = { }
var onSubmitButtonTappedClosure: () -> Void = { /* Non-optional default empty implementation */ }

@ProxyProperty(\PaymentFormController.headerTextLabel.text)
var details: String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class FPXPaymentFormController: UIViewController, PaymentFormUIController {

@IBAction private func submitForm(_ sender: AnyObject) {
emailValue = emailTextField.text?.trimmingCharacters(in: CharacterSet.whitespaces)
delegate?.fpxDidCompleteWith(email: emailValue) {}
delegate?.fpxDidCompleteWith(email: emailValue) { /* no action is required */ }
}

@IBAction private func validateFieldData(_ textField: OmiseTextField) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ class SelectPaymentController: UITableViewController {

let viewModel: SelectPaymentPresentableProtocol

var customizeCellAtIndexPathClosure: (UITableViewCell, IndexPath) -> Void = { _, _ in }
var customizeCellAtIndexPathClosure: (UITableViewCell, IndexPath) -> Void = { _, _ in
// Non-optional default empty implementation
}

init(viewModel: SelectPaymentPresentableProtocol) {
self.viewModel = viewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ extension SelectPaymentPresentableProtocol {
var errorMessage: String? { nil }
var viewShowsCloseButton: Bool { false }
var viewDisplayLargeTitle: Bool { false }
func viewDidTapClose() {}
func viewDidTapClose() { /* Default empty implementation */ }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import UIKit
class SelectDuitNowOBWBankViewModel {
private weak var delegate: SelectSourcePaymentDelegate?

private var viewOnDataReloadHandler: () -> Void = { } {
private var viewOnDataReloadHandler: () -> Void = { /* Non-optional default empty implementation */ } {
didSet {
self.viewOnDataReloadHandler()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class SelectFPXBankViewModel {

let errorMessage: String?

private var viewOnDataReloadHandler: () -> Void = { } {
private var viewOnDataReloadHandler: () -> Void = { /* Non-optional default empty implementation */ } {
didSet {
self.viewOnDataReloadHandler()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class SelectInstallmentTermsViewModel {
weak var delegate: SelectSourcePaymentDelegate?
let sourceType: SourceType

private var viewOnDataReloadHandler: () -> Void = { } {
private var viewOnDataReloadHandler: () -> Void = { /* Non-optional default empty implementation */ } {
didSet {
self.viewOnDataReloadHandler()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SelectPaymentMethodViewModel {
private let filter: Filter
private weak var delegate: SelectPaymentMethodDelegate?

private var viewOnDataReloadHandler: () -> Void = { } {
private var viewOnDataReloadHandler: () -> Void = { /* Non-optional default empty implementation */ } {
didSet {
self.viewOnDataReloadHandler()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class SelectSourceTypePaymentViewModel {
private weak var delegate: SelectSourceTypeDelegate?
private let title: String

private var viewOnDataReloadHandler: () -> Void = { } {
private var viewOnDataReloadHandler: () -> Void = { /* Non-optional default empty implementation */ } {
didSet {
self.viewOnDataReloadHandler()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CCVInfoController: UIViewController {
}
}

var onCloseTapped: () -> Void = { }
var onCloseTapped: () -> Void = { /* Non-optional default empty implementation */ }

override func viewDidLoad() {
super.viewDidLoad()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class CreditCardPaymentViewModel: CreditCardPaymentViewModelProtocol, CountryLis
}
}
}
var onSelectCountry: (Country) -> Void = { _ in }

var onSelectCountry: (Country) -> Void = { _ in /* Non-optional default empty implementation */ }

func error(for field: AddressField, validate text: String?) -> String? {
guard isAddressFieldsVisible else { return nil }
Expand Down

0 comments on commit 3d69d52

Please sign in to comment.