-
-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Labels
enhancementNew feature or requestNew feature or request
Description
This might be a welcomed alternative to finding a unique name for something that, in most situations, doesn't require naming. Plus it has the added benefit of being familiar to someone coming from one of the many frameworks that use this approach.
My current approach, sadly, uses AnyCodable as Leaf's encoder isn't public.
import Vapor
import AnyCodable
extension ViewRenderer {
public func render(_ name: String, _ context: [String: Any]) async throws -> View {
let data = context.reduce(into: [:]) { $0[$1.0] = AnyCodable($1.1) }
return try await self.render(name, data)
}
}Maybe making Leaf's builtin encoder public might be a possible compromise.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request