From d4ab61f923bbfe0045d89001432c30ffb12c4680 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Mon, 20 Jul 2020 13:57:06 -0400 Subject: [PATCH] less confusing --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject+Swift.swift | 5 +++-- MVMCore/MVMCore/Models/ActionType/AlertModel.swift | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject+Swift.swift b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject+Swift.swift index 1e65c97..162dd2d 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject+Swift.swift +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertObject+Swift.swift @@ -36,8 +36,9 @@ public extension MVMCoreAlertObject { actions: actionsForAlert, isGreedy: false) - let alertStyle = alertJson.int32ForKey("style") - alertObject?.alertStyle = alertStyle == 0 ? .actionSheet : .alert + if let alertStyle = alertJson.optionalStringForKey("style") { + alertObject?.alertStyle = UIAlertController.Style(rawValue: alertStyle) + } return alertObject } diff --git a/MVMCore/MVMCore/Models/ActionType/AlertModel.swift b/MVMCore/MVMCore/Models/ActionType/AlertModel.swift index 3d299a3..866bfb3 100644 --- a/MVMCore/MVMCore/Models/ActionType/AlertModel.swift +++ b/MVMCore/MVMCore/Models/ActionType/AlertModel.swift @@ -111,6 +111,6 @@ public class AlertModel: Codable { try container.encode(title, forKey: .title) try container.encode(message, forKey: .message) try container.encode(alertActions, forKey: .alertActions) - try container.encode(style, forKey: .style) + try container.encode(style.rawValueString, forKey: .style) } }