Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9286599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:27:25+00:00 2026-06-18T19:27:25+00:00

Why are some libraries in iOS provided C based API? For example, Core Graphics

  • 0

Why are some libraries in iOS provided C based API? For example, Core Graphics library is provided by C based API. But, I can’t understand the reason why Apple did it.

Moreover, [[UIColor red] setStroke] which is the kind of code in drawRect: also makes me confused! If Apple decided to use C based API, why do they use object oriented style code doing graphic things?

And CGContextAddLineToPoint(), for example, takes argument CGContextRef c. I think it’s completely suitable to use object oriented things.

// current
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextMoveToPoint(context, 0, 0);
CGContextAddLineToPoint(context, 10, 10);

// looks better
CGContext *context = [UIGraphics getCurrentContext]
[context moveToPoint: CGMakePoint(0, 0)] // or [context moveToPointX: 0 y: 0]
[context addLineToPoint: CGMakePoint(10, 10)]  // or [context addLineToPointX: 10 y: 10]

So, why does Apple use C based API on some libraries?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T19:27:26+00:00Added an answer on June 18, 2026 at 7:27 pm

    Performance

    1. as there’s less memory overhead in C compared to an Objective-C object
    2. speedup as there’s no need to go through the Objective-C runtime
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application, which uses some 3rd party libraries, for example Tesseract library.
Are there some libraries with C API to draw pictures? Just like the library
Is there a simple way, without .NET? I've found some libraries but none for
I develop some native libraries for Android and use Boost libraries - just headers-based
I'm attempting to use some 3rd party libraries in my iOS app, as recommended
I am using some third party libraries in my iOS application (libraries are flurry,
Right now I have some libraries that link easily to Visual Studio projects but
I have some externally pre-compiled libraries for iOS some for debug and some for
Im looking for some sort of SDK or library on top of iOS, which
I have sucessfully built some Boost C++ 1.44.0 libraries for iOS 4.3. I now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.