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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:41:38+00:00 2026-06-17T09:41:38+00:00

I know now the new Objective-C compiler lets you not need to synthesize your

  • 0

I know now the new Objective-C compiler lets you not need to synthesize your properties anymore. I have one file that has two classes in it. My .h for a simple helper class looks like this:

@interface ViewFrameModel : NSObject

@property (nonatomic, strong) UIView *view;
@property (nonatomic, assign) CGRect frame;

- (id)initWithView:(UIView *)view frame:(CGRect)frame;

@end

In the same .h file, for my other class (class 2), I have:

@property (nonatomic, strong) ViewFrameModel *viewFrameModel;

In class 2.m, I can do this:

- (void)setViewFrameModel:(ViewFrameModel *)viewFrameModel {
    _viewFrameModel = viewFrameModel;        
    [self pushViewFrameModel:viewFrameModel];
}

This works fine with no complaints from the compiler, however, when I add this:

- (ViewFrameModel *)viewFrameModel {
    return _viewFrameModel;
}

I get two complaints, one on the first method setViewFrameModel:

“Use of undeclared identifier _viewFrameModel, did you mean viewFrameModel”

And the other on return _viewFrameModel:

“Use of undeclared identifier _viewFrameModel, did you mean viewFrameModel”
“Reference to local variable viewFrameModel’ declared in enclosing context”

Why do I get these errors when I add in the

- (ViewFrameModel *)viewFrameModel {
    return _viewFrameModel;
}

method? I want to override this method with some custom info, but it’s complaining at me :-. Thoughts? TIA.

  • 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-17T09:41:39+00:00Added an answer on June 17, 2026 at 9:41 am

    If you override both the setter and the getter, the compiler will not automatically create the instance variable for you anymore. You can add it to your class implementation like so:

    @implementation ClassName {
        ViewFrameModel *_viewFrameModel;
    }
    ...
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Ruby on Rails, I know things but now I have to
I have one main outstanding issue, I know now how to databind to lists
I know how to use new Date(UTCStrings) to local timezone. But now, the question
So I know now that the debug assemblies have been intentionally left out of
Now i know to use the method of float.Parse but have bumped into a
I'm new with Objective-C, i'm working in an application and I need to connect
I'm pretty new to the Objective-C world and I have a long history with
I resort to your expertly advice because I am sort of new to Objective-C,
First of all I have to inform you that I am new to Objective-C
Hello everyone I have an objective-c dilema :P I am quite new to objective-c,

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.