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 6979577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:54:17+00:00 2026-05-27T17:54:17+00:00

By reading this post , It looks like certain rules should be considered when

  • 0

By reading this post, It looks like certain rules should be considered when declaring global variables.

So I tried declaring global variables in the .m file. However, the code sense seems not happy to do this for me. For example, say I already have 2 lines in the .m file:

@implementation ViewController
@synthesize abc, xyz;

Now I want to add “BOOL isChecked;”.

If I type this below “@synthesize” (or just between @implementation and @synthesize), the code sense actually suggests me to input “bool” (lower case) as I am typing “BOOL”. If I type “BOOL” above “@implementation”, it would suggest “BOOL” successfully.

Surely, the global variable is part of this class which means it should be inside the implementation. I am not sure why it doesn’t like to let us do this.

This makes me feel that Objective-C doesn’t like us to declare global variables below @synthesize. But my question is WHY? What I feel is that there may be a reason or Apple made a bug here.

  • 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-05-27T17:54:18+00:00Added an answer on May 27, 2026 at 5:54 pm

    Surely, the global variable is part of this class which means it should be inside the implementation. I am not sure why it doesn’t like to let us do this.

    Global variables aren’t part of a class. Sure, you can put them inside an @implementation block, but they’re really not a part of the class — they’re global — so they don’t really belong there.

    Objective-C doesn’t have class variables like Java or other languages do. You can fake them with global variables and class methods that access those variables, but at the end of the day, they’re global, not specific to a class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just finished reading this post: https://developer.yahoo.com/performance/rules.html#flush and have already implemented a flush after
I've tried to do this several times with no luck. After reading this post
I have a file that looks like this: Alpha,25,SomeBrand,Info Gamma,2039,Crisps,Foobar Epic,240,Win,Post And I want
Reading this post has left me wondering; are nightly builds ever better for a
After reading this post I kinda felt in the same position as the guy
Well I was reading this post and then I came across a code which
I've recently heard about the CaptureStackBackTrace function by reading this post . I cannot
Reading this blog post about HttpOnly cookies made me start thinking, is it possible
I was reading this thread/post: https://stackoverflow.com/questions/262298/windows-c-ui-technology and am also wondering about a non .NET
Just finished reading this blog post: http://www.skorks.com/2010/03/an-interview-question-that-prints-out-its-own-source-code-in-ruby/ In it, the author argues the case

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.