📜 ⬆️ ⬇️

Apple finished the Interface Builder please!

This post is a scream of anger toward Apple, and yet there is hope in me. I’ve been an iOS developer for 4 years, and what at first seemed momentary imperfection, irrelevant details, over the years turns into Chinese water torture, and you and I use IB every day, or at least once a week.



Perhaps Apple does not deserve such criticism - however, everything else, or almost everything else, is at their best. Excluding iTunes and the Apple developer portal (which in recent years has, nevertheless, become significantly better), technologies allow us to focus on what you are doing, and not on how it will look in IE.

At first I didn’t use IB at all, it seemed so crooked and wretched to me after other visual editors. Even Macromedia Dreamviewer MX, IMHO, had more chances to be called WYSIWYG editors for the UI. But several years passed, and a wonderful thing appeared - Autolayout - which is catastrophically inconvenient to implement in code. Little happiness in this code:
')
UIImageView *iv = [[UIImageView alloc] initWithImage:image]; UIView *renderView = [[UIView alloc] initWithFrame:iv.bounds]; NSInteger completedDistance = renderView.bounds.size.width * percentsCompleted; UIView *progressView = [[UIView alloc] initWithFrame:CGRectMake(completedDistance, 0, renderView.bounds.size.width, renderView.bounds.size.height)]; progressView.backgroundColor = RGB_UICOLOR(255, 255, 255, 0.8); renderView.clipsToBounds = YES; [renderView addSubview:iv]; [renderView addSubview:progressView]; 


but view code

 NSMutableArray *constraints = [@[] mutableCopy]; [constraints addObject:[NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.parentView attribute:NSLayoutAttributeWidth multiplier:1 constant:0]]; [constraints addObject:[NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.parentView attribute:NSLayoutAttributeHeight multiplier:1 constant:0]]; [constraints addObject:[NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.parentView attribute:NSLayoutAttributeTop multiplier:1 constant:0]]; [constraints addObject:[NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:self.parentView attribute:NSLayoutAttributeLeading multiplier:1 constant:0]]; [self.parentView addConstraints:constraints]; 


plunges the soul of the developer into depression and depression. In IB, the autolayout setting at the beginning is also for sugar, but as time goes on you adjust, you begin to force yourself not to notice the terrible jambs, to endure small flaws for now ... you do not get hysterical and the number of blunders that have been uncorrected for years, does not exceed all reasonable the limits. But there is no alternative, the format is undocumented, there will be no third-party tools! Here is my short little black list:



Not enough of all this, we recently added a new pain in the ass:



To its credit, Apple can say that the counters stopped moving from every sneeze on a mouse, and this brought me to a nervous breakdown 4 times in xCode 4, and my partner’s partner’s partner even died of a heart attack.

Those who have recently discovered iOS, sing “finish it!” In chorus, faithfully believing in the icon of the apple and Steve Jobs. To which I object: “Do not finish it!”, They always have a dozen more important things to do. Really important, beautiful things, but Apple - we deal with IB every day, take pity on us, mere mortal developers!

At parting, I want to offer an interesting survey:

Source: https://habr.com/ru/post/195390/


All Articles