less confusing

This commit is contained in:
Kevin G Christiano 2020-07-20 13:57:06 -04:00
parent bc9c28aa3f
commit d4ab61f923
2 changed files with 4 additions and 3 deletions

View File

@ -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
}

View File

@ -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)
}
}