Skip to content

Commit

Permalink
Fix Constraints Error in PayPalWebCheckoutViewController (#1342)
Browse files Browse the repository at this point in the history
* fix constraints warning by adding leading and trailing constraints for nested stackViews
* remove print statement
  • Loading branch information
jaxdesmarais authored Jun 24, 2024
1 parent 1f6e26f commit f031476
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
1 change: 0 additions & 1 deletion Demo/Application/Base/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ import BraintreeCore
if let preferences = settings.object(forKey: "PreferenceSpecifiers") as? Array<[String: Any]> {
var defaultsToRegister: [String: Any] = [:]
preferences.forEach { prefSpecification in
print(prefSpecification)
if let key = prefSpecification["Key"] as? String, prefSpecification.keys.contains("DefaultValue") {
defaultsToRegister[key] = prefSpecification["DefaultValue"]
}
Expand Down
25 changes: 18 additions & 7 deletions Demo/Application/Features/PayPalWebCheckoutViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,28 @@ class PayPalWebCheckoutViewController: PaymentButtonBaseViewController {
let payPalCheckoutButton = createButton(title: "PayPal Checkout", action: #selector(tappedPayPalCheckout))
let payPalVaultButton = createButton(title: "PayPal Vault", action: #selector(tappedPayPalVault))
let payPalAppSwitchButton = createButton(title: "PayPal App Switch", action: #selector(tappedPayPalAppSwitch))
let oneTimeCheckoutStackView = buttonsStackView(label: "1-Time Checkout", views: [
UIStackView(arrangedSubviews: [payLaterToggleLabel, payLaterToggle]),
UIStackView(arrangedSubviews: [newPayPalCheckoutToggleLabel, newPayPalCheckoutToggle]),
payPalCheckoutButton
])
let vaultStackView = buttonsStackView(label: "Vault",views: [payPalVaultButton, payPalAppSwitchButton])


let stackView = UIStackView(arrangedSubviews: [
UIStackView(arrangedSubviews: [emailLabel, emailTextField]),
buttonsStackView(label: "1-Time Checkout", views: [
UIStackView(arrangedSubviews: [payLaterToggleLabel, payLaterToggle]),
UIStackView(arrangedSubviews: [newPayPalCheckoutToggleLabel, newPayPalCheckoutToggle]),
payPalCheckoutButton
]),
buttonsStackView(label: "Vault",views: [payPalVaultButton, payPalAppSwitchButton])
oneTimeCheckoutStackView,
vaultStackView
])


NSLayoutConstraint.activate([
oneTimeCheckoutStackView.leadingAnchor.constraint(equalTo: stackView.leadingAnchor),
oneTimeCheckoutStackView.trailingAnchor.constraint(equalTo: stackView.trailingAnchor),

vaultStackView.leadingAnchor.constraint(equalTo: stackView.leadingAnchor),
vaultStackView.trailingAnchor.constraint(equalTo: stackView.trailingAnchor)
])

stackView.axis = .vertical
stackView.distribution = .fillProportionally
stackView.spacing = 25
Expand Down

0 comments on commit f031476

Please sign in to comment.