Last active
August 29, 2015 14:06
-
-
Save akisute/dc603e4776815c438ffb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSManagedObject { | |
public class var entityName:String { | |
get { | |
// NSManagedObject及びそのサブクラスはObjective-Cクラスなので、 | |
// NSStringFromClass(self)の結果が素直な名前になります。 | |
// 具体的にはモジュール名.クラス名を返します。 | |
// ここでは.でセパレートしてクラス名だけを返すようにしています。 | |
return NSStringFromClass(self).componentsSeparatedByString(".").last! | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment