• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Disabling auto-synthesis of property accessors.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disabling auto-synthesis of property accessors.


  • Subject: Re: Disabling auto-synthesis of property accessors.
  • From: Dave <email@hidden>
  • Date: Wed, 27 May 2015 13:42:09 +0100

> With regards to understanding what is going on in the 4000 line view controllers, the areas that were problematic for me were where the instance variables were declared in the interface as someProperty (or as Someproperty, ugh) and then the property was declared and manually synthesized with the same name.  So, then trying to wade through the code with identical names for properties and instance variables and with cases where the variable sometimes starts with a capital letter, knowing exactly what I was looking at was not exactly straightforward.

I’ve done load of this kind of thing in the past, I’ve found the best way to handle convert iVar’s to properties is as so:

1.	Refactor/Rename the iVar to the name of the property.
2.	Compile - this should produce no errors, since all you have done is change the name of the iVar.
3.	Add a property definition for the Property, this will error since there will be an iVar with the same name.
4.	Delete or comment out the iVar.
5.	Compile - there will be errors on the iVar accesses, fix as appropriate.

I’ve found it’s also better to pick a prefix for the names of iVar’s and Properties even if you get rid of the prefix once you’ve got it working, e.g.

iVar Name:		mFileNameString
Property Name:	pFileNameString

and if you want to synthesise it:

@synthesize pFileNameString = mFileNameString;

It’s then instantly obviously what you are working on which if you have a 4000+ line file helps a lot.

All the Best
Dave


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Disabling auto-synthesis of property accessors. (From: Alex Zavatone <email@hidden>)
 >Re: Disabling auto-synthesis of property accessors. (From: Kyle Sluder <email@hidden>)
 >Re: Disabling auto-synthesis of property accessors. (From: Fritz Anderson <email@hidden>)
 >Re: Disabling auto-synthesis of property accessors. (From: Quincey Morris <email@hidden>)
 >Re: Disabling auto-synthesis of property accessors. (From: Uli Kusterer <email@hidden>)
 >Re: Disabling auto-synthesis of property accessors. (From: Alex Zavatone <email@hidden>)
 >Re: Disabling auto-synthesis of property accessors. (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: Problem with Outline View and Manual Memory Management
  • Next by Date: Re: Disabling auto-synthesis of property accessors.
  • Previous by thread: Re: Disabling auto-synthesis of property accessors.
  • Next by thread: Re: Disabling auto-synthesis of property accessors.
  • Index(es):
    • Date
    • Thread