Skip to content

Unnecessary parameters for Functions Callable in async/awaitย #9891

Closed
@ryanwilson

Description

@ryanwilson

I need to do a bit more investigation into this, but I'm fairly certain this function should be deprecated. It accepts an encoder and decoder as parameters but the Callable type itself is initialized with an encoder/decoder so the properties should be used instead. Right now if you use the There's no equivalent completion based call.

@available(iOS 13, tvOS 13, macOS 10.15, macCatalyst 13, watchOS 7, *)
public func call(_ data: Request,
encoder: FirebaseDataEncoder = FirebaseDataEncoder(),
decoder: FirebaseDataDecoder =
FirebaseDataDecoder()) async throws -> Response {
let encoded = try encoder.encode(data)
let result = try await callable.call(encoded)
return try decoder.decode(Response.self, from: result.data)
}

I'm not sure we can actually deprecate this though as we need to replace it with something like this:

public func call(_ data: Request) async throws -> Response { ... }

but that would be in conflict with the default arguments.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions