Just wondering is there is any way to open a viewcontroller by using URL scheme.
This is my class:
class SwishManager: NSObject, URLSessionDelegate{
.
.
.
.
.
func schemeAvailable(token: String){
let notAllowedCharactersSet = CharacterSet(charactersIn: "!*'();:@&=+$,/?%#[]")
let allowedCharactersSet: CharacterSet = notAllowedCharactersSet.inverted
let callbackURLStr = "helpie://"
let encodedCallbackURLStr = callbackURLStr.addingPercentEncoding(withAllowedCharacters: allowedCharactersSet)
let swishURLStr = "swish://paymentrequest?token=\(token)&callbackurl=\(encodedCallbackURLStr ?? "")"
let swishURL = URL(string: swishURLStr)
if let anURL = swishURL {
if UIApplication.shared.canOpenURL(anURL) {
print("app has been installed")
if UIApplication.shared.canOpenURL(anURL) {
UIApplication.shared.open(swishURL!, options: [:], completionHandler: { (success) in
self.confirmpayment()
})
} else {
print("Failed")
}
} else {
print("app has been installed, NOT!")
}
}
}
.
.
.
.
.
.
}What I want to do is when user going back from the payment app to the orignal app after the payment, the user shall be in the payment confirmation page(viewcontroller). since my class is not viewcontroller and i do not know how to change the viewcontroller. Any solution for this case? ;S