mirror of
https://github.com/divkit/divkit.git
synced 2026-05-07 20:02:32 +00:00
d58ed61064
commit_hash:b66893660e9a04cbc958a27778a932d6b9740aa7
13 lines
496 B
Swift
13 lines
496 B
Swift
import DivKit
|
|
|
|
extension Dictionary where Key == String {
|
|
func makeDivActions(for key: String) -> [DivAction]? {
|
|
let actions = (self[key] as? [[String: Any]])?.map {
|
|
DivTemplates.empty.parseValue(type: DivActionTemplate.self, from: $0)
|
|
}
|
|
actions?.compactMap(\.warnings).reduce([], +).forEach { DivKitLogger.warning($0.errorMessage) }
|
|
actions?.compactMap(\.errors).reduce([], +).forEach { DivKitLogger.error($0.errorMessage) }
|
|
return actions?.compactMap(\.value)
|
|
}
|
|
}
|