OSDN Git Service

Doutaku を 1.0 にアップデート
[kcd/KCD.git] / KCD / KCManagedObject.swift
index 82d968b..e669ea4 100644 (file)
@@ -8,6 +8,7 @@
 
 import Foundation
 import CoreData
+import Doutaku
 
 enum KCManagedObjectError: Error {
     
@@ -37,7 +38,10 @@ class KCManagedObject: NSManagedObject {
         
         if KCManagedObject.intValueKyes.contains(key) {
             
-            if let _ = value.pointee as? Int { return }
+            if let _ = value.pointee as? Int {
+                
+                return
+            }
             if let s = value.pointee as? String {
                 
                 value.pointee = Int(s) as AnyObject?
@@ -53,16 +57,19 @@ class KCManagedObject: NSManagedObject {
     
     override func value(forUndefinedKey key: String) -> Any? {
         
-        if key == "description" { return value(forKey: "description_") }
+        if key == "description" {
+            
+            return value(forKey: "description_")
+        }
         
         if key.hasPrefix("api_") {
             
-/* MARK: CONVERT */            let k = String(key[key.index(key.startIndex, offsetBy: 4)...])
+            let k = String(key[key.index(key.startIndex, offsetBy: 4)...])
             
             return value(forKey: k)
         }
         
-        print("Entity \(type(of: self).entityName) dose not have key \(key)")
+        print("Entity \(String(describing: self)) dose not have key \(key)")
         
         return nil
     }
@@ -78,12 +85,12 @@ class KCManagedObject: NSManagedObject {
         
         if key.hasPrefix("api_") {
             
-/* MARK: CONVERT */            let k = String(key[key.index(key.startIndex, offsetBy: 4)...])
+            let k = String(key[key.index(key.startIndex, offsetBy: 4)...])
             setValue(value, forKey: k)
             
             return
         }
         
-        print("Entity \(type(of: self).entityName) dose not have key \(key)")
+        print("Entity \(String(describing: self)) dose not have key \(key)")
     }
 }