I'm calling a method expecting a String...
variadic parameter, but the only thing it allows receiving from the enclosing function is a plain String
.
My method looks like this:
public func deleteKeys(keysReceived:String..., completionHandler:@escaping () -> Void)
{
RedisClient.getClient(withIdentifier: RedisClientIdentifier()) {
c in
do {
let client = try c()
client.delete(keys: keysReceived){}
completionHandler()
}
//...
}
}
The compile error is
Cannot convert value of type '[String]' to expected argument type 'String'
This method (client.delete()
) is from a Redis API for Perfect-Swift so I cannot change the signature, but I can change the enclosing function (deleteKeys). I also cannot call the function directly because it is within a callback closure
Any suggestions on how I can pass a received variadic parameter to an enclosed variadic function? I can break the array down to Single strings and delete individually but that doesn't seem very efficient