Hello!
For Apple Pay, I'd like to disable the option for a customer selecting Apple Pay Later (tab).
In Swift, very easily modify the PKPaymentRequest with:
if #available(iOS 17.0, *) {
paymentRequest.applePayLaterAvailability = .unavailable(.itemIneligible)
}
However, how can this be setup to test that it works?
Very easily add sandbox account, and test cards, but not so easy to enable Apple Pay Later, or documented so the end user (tester) can test it.
Anyone know how to go about setting this up?
Thanks!!
Post
Replies
Boosts
Views
Activity
Greetings,I'm currently evaluating SwiftUI, and looking to replicate the common functionalityof disabling a button until text/string are entered in 2 fields.Common Scenario:A login screen with UserName & Password enables the Login Button once valuesare contained. This is a simple affair on Swift using typical UIKit.This is accomplished quite simply with property observers and leveraging didSet, and a function to check.I can post this code, however it's not important here.With SwiftUI, Is there a suggested approach to Bind two fields to a button?I've experimented with a few things like onEditingChanged, and onCommit.A simplified version here:import SwiftUI
struct ContentView: View {
@State private var username = ""
@State private var password = ""
var body: some View {
NavigationView{
VStack {
TextField("enter user name", text: $username, onEditingChanged: { (changed) in
print("editing \(self.username)")
}) {
print("committed \(self.username)")
}
.padding(10)
SecureField("enter a password", text: $password, onCommit: { () in
print("committed password \(self.password)")
})
.padding(10)
Button(action: {
// show next screen here/nav
}) {
Text("Login")
.padding(10)
.font(.title)
Spacer()
}.padding(10)
.disabled(true) // ideally pass this a condition where both username and password have values
}
}
}
}I've also created a custom button as such, but no luck just yetstruct RoundedButton : View {
@Binding var usernameEntered: Bool
@Binding var passwordEntered: Bool
var body: some View {
Button(action: {}) {
HStack{
Spacer()
Text("Login")
.padding(10)
.font(.title)
Spacer()
}
}
.disabled(passwordEntered && usernameEntered)
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(8)
}
}Thoughts anyone?