I am working on adding Stripe into my project. There's more code than this, but it was all working before I began adding in Stripe and the init. This is the init that Stripe says to use in their docs
Here's my beginning code and init code:
class BusinessOwnerVC: UIViewController, MyProtocol {
let paymentContext: STPPaymentContext
init() {
let customerContext = STPCustomerContext(keyProvider: SwiftAPI())
self.paymentContext = STPPaymentContext(customerContext: customerContext)
super.init(nibName: nil, bundle: nil)
self.paymentContext.delegate = self
self.paymentContext.hostViewController = self
self.paymentContext.paymentAmount = 5000 // This is in cents, i.e. $50 USD
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
.....
I am using Storyboards, as I've heard that matters. When I run the code, the fatalError gets thrown and crashes the app. The Stripe example project has this exact code in there, and it works.
Why is my app crashing? What is this required init even doing? I think I understand why I need it, but if you could elaborate beyond it's required for subclasses, that would be helpful.