Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 22, 2011, 08:23 AM   #1
iFaisal
macrumors newbie
 
Join Date: Apr 2011
@property ?


hello everyone ,

what is the different between set/get function and @property/@synthesize ?

is it just syntax code or not ? and what does mean ?
iFaisal is offline   0 Reply With Quote
Old Apr 22, 2011, 09:05 AM   #2
gnasher729
macrumors G5
 
gnasher729's Avatar
 
Join Date: Nov 2005
Quote:
Originally Posted by iFaisal View Post
hello everyone ,

what is the different between set/get function and @property/@synthesize ?

is it just syntax code or not ? and what does mean ?
The Objective-C 2.0 language manual on Apple's web site will answer all these questions. And playing around with styles like you did is _very_ impolite.
gnasher729 is online now   0 Reply With Quote
Old Apr 22, 2011, 02:06 PM   #3
Psilocybin
macrumors 6502a
 
Psilocybin's Avatar
 
Join Date: Jan 2011
Location: Ontario, Canada
Send a message via MSN to Psilocybin
synthsize sets up its own get/set methods
Psilocybin is offline   0 Reply With Quote
Old Apr 22, 2011, 06:20 PM   #4
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
At first we had to code our own getters and setters. There was no concept of a property in Objective-C 1.0, except by the convention that if a class had a method x and a method setX: then it could have been said to have property x.

Then Apple created Objective-C 2.0 and it introduced the @property and @synthesise directives, as well as the dot notation. And the number of getters and setters we had to write was reduced to near zero. And our getters and setters become correct in the face of concurrency (assuming no nonatomic) which set us up well for the days of multicore CPUs and GCD.

And the people programming in the land of Apple were happy. (Well generally, some have some valid objections to dot notation).

So yeah, it's just syntax. But I'd highly recommend you use it, unless you have strong reasons not to.
jiminaus is offline   0 Reply With Quote
Old Apr 23, 2011, 04:19 PM   #5
iFaisal
Thread Starter
macrumors newbie
 
Join Date: Apr 2011
thank you everyone ... I'm understanding now what is the different .
iFaisal is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Property not found on object Kapthehat iPhone/iPad Programming 11 Aug 21, 2013 03:26 PM
Applescript rsync and property Polansky Mac Programming 1 Jan 14, 2013 07:54 AM
How do I retain a readonly property? ramy1989 Mac Programming 4 Dec 23, 2012 10:30 AM

Forum Jump

All times are GMT -5. The time now is 05:58 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC