24

In the Cocoa and Cocoa Touch APIs what is the meaning of the abbreviation "CG", which is used in a lot of the graphics-related classes such as CGPointand CGRect?

2
  • 1
    Maybe core graphics?
    – Guest 86
    Dec 22, 2014 at 21:40
  • 9
    This question is being discussed on meta. Jul 12, 2016 at 20:25

2 Answers 2

34

It's based on Apple's API Naming Guidelines.

You should try to choose names that clearly associate each symbol with your framework. For example, consider adding a short prefix to all external symbol names. Prefixes help differentiate the symbols in your framework from those in other frameworks and libraries. They also make it clear to other developers which framework is being used. Typical prefixes include the first couple of letters or an acronym of your framework name. For example, functions in the Core Graphics framework use the prefix “CG”.

19

It stands for Core Graphics which is the C-based graphics API on iOS. You can read more about core graphics here. CG is used as a prefix for the essential data structures that are the basic building blocks of the framework.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.