OSDN Git Service

Doutaku を 1.0 にアップデート
[kcd/KCD.git] / KCD / KCManagedObject.swift
index e45bf98..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,7 +57,10 @@ 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_") {
             
@@ -62,7 +69,7 @@ class KCManagedObject: NSManagedObject {
             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
     }
@@ -84,6 +91,6 @@ class KCManagedObject: NSManagedObject {
             return
         }
         
-        print("Entity \(type(of: self).entityName) dose not have key \(key)")
+        print("Entity \(String(describing: self)) dose not have key \(key)")
     }
 }