mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
50 lines
1.5 KiB
Swift
50 lines
1.5 KiB
Swift
// Generated code. Do not modify.
|
|
|
|
import Foundation
|
|
import Serialization
|
|
import VGSL
|
|
|
|
public final class DivDownloadCallbacks: Sendable {
|
|
public let onFailActions: [DivAction]?
|
|
public let onSuccessActions: [DivAction]?
|
|
|
|
public convenience init(dictionary: [String: Any], context: ParsingContext) throws {
|
|
self.init(
|
|
onFailActions: try dictionary.getOptionalArray("on_fail_actions", transform: { (dict: [String: Any]) in try? DivAction(dictionary: dict, context: context) }),
|
|
onSuccessActions: try dictionary.getOptionalArray("on_success_actions", transform: { (dict: [String: Any]) in try? DivAction(dictionary: dict, context: context) })
|
|
)
|
|
}
|
|
|
|
init(
|
|
onFailActions: [DivAction]? = nil,
|
|
onSuccessActions: [DivAction]? = nil
|
|
) {
|
|
self.onFailActions = onFailActions
|
|
self.onSuccessActions = onSuccessActions
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
extension DivDownloadCallbacks: Equatable {
|
|
public static func ==(lhs: DivDownloadCallbacks, rhs: DivDownloadCallbacks) -> Bool {
|
|
guard
|
|
lhs.onFailActions == rhs.onFailActions,
|
|
lhs.onSuccessActions == rhs.onSuccessActions
|
|
else {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
#endif
|
|
|
|
extension DivDownloadCallbacks: Serializable {
|
|
@_optimize(size)
|
|
public func toDictionary() -> [String: ValidSerializationValue] {
|
|
var result: [String: ValidSerializationValue] = [:]
|
|
result["on_fail_actions"] = onFailActions?.map { $0.toDictionary() }
|
|
result["on_success_actions"] = onSuccessActions?.map { $0.toDictionary() }
|
|
return result
|
|
}
|
|
}
|