This question was originally asked for the objective-c programming language. At the time of writing, swift didn\'t even exist yet.
Is it po
If you find yourself needing to do this sort of individual component modification, it may be worthwhile having macros like these somewhere accessible by all of your code:
#define CGRectSetWidth(rect, w) CGRectMake(rect.origin.x, rect.origin.y, w, rect.size.height)
#define ViewSetWidth(view, w) view.frame = CGRectSetWidth(view.frame, w)
This way, whenever you need to change the width alone - you would simply write
ViewSetWidth(self, 50);
instead of
self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, 50);