As I referred here, there is no @property or @synthesise directive present in swift.
Then,
1] how the setter and getter will be added by compiler?
2] If I have a object, how to write our own setter and getter methods?
I am new to swift Can any one explain with example?
//EDIT :
Before down voting, please let me show as in the Apple documentation.
@property (getter=isFinished) BOOL finished;
will override getter method.
In the same way how can I achieve in Swift?
For in the below example, how to make getter as isFinished
class CarPaint : NSObject {
var finished:Bool = Bool();
func getCarDoorColor() -> UIColor {
if finished { //instead here I want to `isFinished`
return UIColor.whiteColor()
}
return UIColor.brownColor()
}
}