Small fix and clean
This commit is contained in:
parent
a7c25f0bdf
commit
441fb0c0e1
@ -18,9 +18,6 @@ public protocol ActionModelProtocol: Model {
|
||||
var extraParameters: JSONValueDictionary? { get set }
|
||||
var analyticsData: JSONValueDictionary? { get set }
|
||||
|
||||
static var categoryName: String { get }
|
||||
static var categoryCodingKey: String { get }
|
||||
|
||||
// Temporary fix till server changes
|
||||
var title: String? { get set }
|
||||
}
|
||||
|
||||
@ -33,13 +33,7 @@ public struct ModelRegistry {
|
||||
/// Registers models for Atomic use.
|
||||
public static func register<M: Model>(_ type: M.Type) throws {
|
||||
|
||||
var category: Category
|
||||
|
||||
if let c = categories[M.categoryName] {
|
||||
category = c
|
||||
} else {
|
||||
category = Category(name: M.categoryName, codingKey: M.categoryCodingKey)
|
||||
}
|
||||
var category = categories[M.categoryName] ?? Category(name: M.categoryName, codingKey: M.categoryCodingKey)
|
||||
|
||||
// Check to ensure the Category/Type combination doesn't exist.
|
||||
if category.instanceTypes[M.identifier] != nil {
|
||||
@ -59,11 +53,9 @@ public struct ModelRegistry {
|
||||
}
|
||||
|
||||
private static func getCategory(for typeString: String) -> Category? {
|
||||
|
||||
for (_, value) in categories where value.codingKey == typeString {
|
||||
return value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user