ios - Objective-C: conditionally call different properties -
say there's class contains 2 different properties such as: @interface myclass : nsobject @property id valuewhenno; @property id valuewhenyes; @end while using class boolean value called 'state', know can property according 'state' by: myclass *myclass; id value = state ? myclass.valuewhenyes : myclass.valuewhenno; but found using lot of conditional statement in complex code can make readability of hard. since intend give no information 'state' 'myclass', there cannot additional boolean property in 'myclass'. is there way in objective-c class can used property conditionally short line of code such following? id value = myclass.valuebystate; have 2 instances of class 1 property instead of 1 instance 2 properties. then, when state changes switch instance instead of having code everywhere check state.