J.M J.M - 2 months ago 21
Swift Question

How to 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 got the error "Use of unresolved identifier 'Error'"


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)