본문 바로가기

Programming/iPhone, Xcode

iOS - Core Data attribute types

iOS 에서 Core Data 를 사용할 때, attribute 들의 type 들이 각각 무슨의미인 지 궁금 했다.


  • Integer 16, Integer 32, and Integer 64 data types are for storing signed integers. The range of values that these types are able to store is as follows:
    • Integer 16:-32,768 to 32, 767
    • Integer 32:-2,147,483,648 to 2,147,483,647
    • Integer 64:-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
  • Decimal, Double, and Float data types are for storing fractional numbers. The Double data type uses 64 bits to store a value while the Float data type uses 32 bits for storing a value. The only limitation with these two data types is that they round off the values. To avoid any rounding of values, theDecimal data type is preferred. The Decimal type uses fixed point numbers for storing values, so the numerical value stored in it is not rounded off.
  • String data type is used for storing text contents.
  • Boolean data type is used for storing YES or NO values.
  • Date data type is used for storing dates as well as timestamps.
  • Binary data type is used for storing binary data.
  • Transformable data type works along with Value Transformers that help us create attributes based on any Objective-C class, that is, we can create custom data types other than the standard data types. This data type can be used to store an instance of UIColor, UIImage, and so on. It archives objects to instances of NSData.

출처: http://www.packtpub.com/article/core-data-ios-designing-data-model-building-data-objects