Try to use ?? operator:
if let amount = datasource?.incrementForCount?(count) ?? datasource?.fixedIncrement
{
count += amount
}
is it possible to combine the 2 if let statements into a single ORed one ?
It is possible to have several let statements like
if let a = optionalA, b = optionalB { ... }
And all of them should return non-nil value to pass.
But if you also want to use a logical condition it:
- Could be only the one
- Should be placed on the first place, before any let statements