diff --git a/MVMCore/MVMCore/Models/ActionType/AlertModel.swift b/MVMCore/MVMCore/Models/ActionType/AlertModel.swift index 6b4c634..e85e7c2 100644 --- a/MVMCore/MVMCore/Models/ActionType/AlertModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/AlertModel.swift @@ -10,21 +10,38 @@ import UIKit public class AlertButtonModel: Codable { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + public var title: String public var action: ActionModelProtocol public var style: UIAlertAction.Style = .default + + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + public init(_ title: String,_ action: ActionModelProtocol,_ style: UIAlertAction.Style = .default) { self.title = title self.action = action self.style = style } + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { case title case action case style } + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) title = try typeContainer.decode(String.self, forKey: .title) @@ -44,21 +61,38 @@ public class AlertButtonModel: Codable { } public class AlertModel: Codable { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + public var title: String public var message: String public var alertActions: [AlertButtonModel] + + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + public init(_ title: String,_ message: String,_ alertActions: [AlertButtonModel]) { self.title = title self.message = message self.alertActions = alertActions } + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { case title case message case alertActions } + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- + required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) title = try typeContainer.decode(String.self, forKey: .title)