How I can make Optional promises chaining? e.g., I have two promises and I have to check second only by some conditions from first promise results.
promise1(). then { result -> Promise? in
if result.success {
return promise2()
}
return nil
}
.then { secondResult -> Void in
}
.always {...}
.catch ...
But when I write something like this compiler thinks that type of is Promise?, not Any (bit "Any" I mean any other class/structure)
So, how I can make some kind of chaining? And there should be one always and one catch handlers as usual.