diff --git a/OmiseSDK/Sources/OmiseSDK.swift b/OmiseSDK/Sources/OmiseSDK.swift index 172db936..0ae67f15 100644 --- a/OmiseSDK/Sources/OmiseSDK.swift +++ b/OmiseSDK/Sources/OmiseSDK.swift @@ -6,7 +6,7 @@ public class OmiseSDK { public static var shared = OmiseSDK(publicKey: "pkey_") /// OmiseSDK version - public let version: String = "5.2.0" + public let version: String = "5.2.1" /// Public Key associated with this instance of OmiseSDK public let publicKey: String @@ -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 + } } } diff --git a/OmiseSDK/Sources/Views/Components/TextFieldView.swift b/OmiseSDK/Sources/Views/Components/TextFieldView.swift index 89540798..bee01702 100644 --- a/OmiseSDK/Sources/Views/Components/TextFieldView.swift +++ b/OmiseSDK/Sources/Views/Components/TextFieldView.swift @@ -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 diff --git a/OmiseSDK/Sources/Views/Components/TextFields/OmiseTextField.swift b/OmiseSDK/Sources/Views/Components/TextFields/OmiseTextField.swift index e730b489..33fca0b2 100644 --- a/OmiseSDK/Sources/Views/Components/TextFields/OmiseTextField.swift +++ b/OmiseSDK/Sources/Views/Components/TextFields/OmiseTextField.swift @@ -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 { diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Other Payments/Atome/AtomePaymentFormViewModel.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Other Payments/Atome/AtomePaymentFormViewModel.swift index 649448ab..8cfb7e42 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Other Payments/Atome/AtomePaymentFormViewModel.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Other Payments/Atome/AtomePaymentFormViewModel.swift @@ -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 } diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Other Payments/Atome/Base/PaymentFormController.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Other Payments/Atome/Base/PaymentFormController.swift index c05f63a0..2e6ff0be 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Other Payments/Atome/Base/PaymentFormController.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Other Payments/Atome/Base/PaymentFormController.swift @@ -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? diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Other Payments/FPX/FPXPaymentFormController.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Other Payments/FPX/FPXPaymentFormController.swift index 7f69d5da..1311aa79 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Other Payments/FPX/FPXPaymentFormController.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Other Payments/FPX/FPXPaymentFormController.swift @@ -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) { diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/SelectPaymentController.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/SelectPaymentController.swift index e3793cdf..66b93079 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/SelectPaymentController.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/SelectPaymentController.swift @@ -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 diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/SelectPaymentPresentableProtocol.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/SelectPaymentPresentableProtocol.swift index fb19f2d2..51ab5736 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/SelectPaymentPresentableProtocol.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/SelectPaymentPresentableProtocol.swift @@ -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 */ } } diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectDuitNowOBWBankViewModel.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectDuitNowOBWBankViewModel.swift index 1fc5c7ef..06955395 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectDuitNowOBWBankViewModel.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectDuitNowOBWBankViewModel.swift @@ -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() } diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectFPXBankViewModel.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectFPXBankViewModel.swift index 938766f3..bde82a62 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectFPXBankViewModel.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectFPXBankViewModel.swift @@ -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() } diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectInstallmentTermsViewModel.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectInstallmentTermsViewModel.swift index 156f2fe7..81ef32ed 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectInstallmentTermsViewModel.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectInstallmentTermsViewModel.swift @@ -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() } diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectPaymentMethodViewModel.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectPaymentMethodViewModel.swift index b8215e14..2a907d5f 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectPaymentMethodViewModel.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectPaymentMethodViewModel.swift @@ -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() } diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectSourceTypePaymentViewModel.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectSourceTypePaymentViewModel.swift index 4bf1f8a8..40d3e3fb 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectSourceTypePaymentViewModel.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/Select Payment From Lists/ViewModels/SelectSourceTypePaymentViewModel.swift @@ -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() } diff --git a/OmiseSDK/Sources/Views/Screens/Credit Card Payment/CCVInfoController.swift b/OmiseSDK/Sources/Views/Screens/Credit Card Payment/CCVInfoController.swift index e2ffac4b..945b6c6f 100644 --- a/OmiseSDK/Sources/Views/Screens/Credit Card Payment/CCVInfoController.swift +++ b/OmiseSDK/Sources/Views/Screens/Credit Card Payment/CCVInfoController.swift @@ -16,7 +16,7 @@ class CCVInfoController: UIViewController { } } - var onCloseTapped: () -> Void = { } + var onCloseTapped: () -> Void = { /* Non-optional default empty implementation */ } override func viewDidLoad() { super.viewDidLoad() diff --git a/OmiseSDK/Sources/Views/Screens/Credit Card Payment/CreditCardPaymentViewModel.swift b/OmiseSDK/Sources/Views/Screens/Credit Card Payment/CreditCardPaymentViewModel.swift index 78ab2a36..74951f52 100644 --- a/OmiseSDK/Sources/Views/Screens/Credit Card Payment/CreditCardPaymentViewModel.swift +++ b/OmiseSDK/Sources/Views/Screens/Credit Card Payment/CreditCardPaymentViewModel.swift @@ -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 }