J.M J.M - 1 year ago 119
Swift Question

How do I write these functions in Swift 2.2?

I am trying to set up two delegates in different classes on my iOS app, however, the SDK declarations are written in Swift 3. Below is what I am trying to convert to Swift 2.2

func paymentMethodsViewController(_ paymentMethodsViewController: STPPaymentMethodsViewController, didFailToLoadWithError error: Error)

func paymentContext(_ paymentContext: STPPaymentContext, didFinishWith status: STPPaymentStatus, error: Error?)

func paymentContext(_ paymentContext: STPPaymentContext, didFailToLoadWithError error: Error)

I get the error "Use of unresolved identifier 'Error'"

Answer Source

Try this

func paymentMethodsViewController(paymentMethodsViewController: STPPaymentMethodsViewController, didFailToLoadWithError error: NSError)

func paymentContext(paymentContext: STPPaymentContext, didFinishWith status: STPPaymentStatus, error: NSError?)

func paymentContext(paymentContext: STPPaymentContext, didFailToLoadWithError error: NSError)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download