Small knowledge, big challenge! This paper is participating in theEssentials for programmers”Creative activities.

This paper also participates inProject DigginTo win the creative gift package and challenge the creative incentive money.

preface

I’m in a Swift development group, and we talk about development issues.

Every time we talk about UI issues for iOS development, there is always a debate about whether to use XIB /storyboard or pure code.

Here I would like to throw this question out and share my personal views and views.

I know that once we start talking about this topic, we may inadvertently get into a backfire, but I want to talk about it.

To declare my position: I am pure code flow

First of all, I’m a guy who learned xiB/Storyboard drag for UI construction.

I learned how to write UI in xiB /storyboard first, and then I learned how to write UI in pure code.

Logically, this technique is usually a first touch, first become habit, and you’d prefer to use XIB/Storyboard streams.

But after my own experience with XIB/storyboards and pure code, I basically went pure code flow, right?

Why is this?

There’s a lot of online talk about xiB /storyboard being bad, or pure code being good. I have a more material reason:

The xib/storyboard feels a bit too screeny for me, especially when I only have an iMac in my company and don’t have an external monitor, and the xib/storyboard drag feels a bit too tight.

Or when you’re developing on a 13-inch MacBook Pro, the XIB/Storyboard makes you feel like the screen isn’t enough.

Buying a monitor always costs money, so why not save it when you can?

Advantages and disadvantages of XIB/Storyboard flows

Of course, as the saying goes, existence is reason.

Xib/Storyboard flows certainly have their advantages

  • Development efficiency is high, because basically do not write code, pure drag control, as long as familiar with the operation and control, for a UI preparation is certainly faster than pure code.

  • Developing the UI is a wysiwyg. For beginners, mastering the features of the controls is a great learning process, and this is where I learned xiB/Storyboard flows before moving to pure code flows.

Disadvantages and challenges of XIB/Storyboard flows:

  • Xib/Storyboard streams are difficult to maintain and prone to conflict with Git management in the early days, which can be circumvent by optimizing the submission specification, but the real difficulty is the ongoing maintenance cost:

    1. Xib/Storyboards can be a big headache for developers who leave or need to make a transition because they don’t understand the logic and business, and changing a XIB/Storyboard is often a complete mess

    2. As the business continues, the UI changes and the XIB /storyboard needs to be modified. In many cases, the xiB/Storyboard needs to be modified with a lot of time and labor costs.

Pure code flow, on the other hand, as long as the code is not too messy and there are documentation or comments, it’s not too difficult to understand a UI, and you can get up to speed and change the UI to follow the business.

  • Whether it’s cross-platform Flutter or SwiftUI, we can see that declarative code flow is the future of development. If you need to do cross-side development, the habit of pure code may be more suitable.
Flutter SwiftUI

Big guy some views

When it comes to xiB/Storyboard flows versus pure code flows, Meow’s opinions and articles are often brought up over and over again: the code writing UI, the XIB /storyboard game, and some tips on Interface Builder.

What are you talking about when the big guys are talking?

However, IN my opinion, the reference and study of technical articles also need different occasions and time. This article was first published in 2013, of course, it has been updated recently:

This article is also the basic article for me to get started on XIB/Storyboard. However, the current environment and thinking of App writing have changed a lot. Nowadays, xiB/Storyboard is really not fast in this era of rapid iteration.

In addition, Meow god is more focused on iOS development, in our current environment, we can not achieve iOS all the way to the end.

So listen to good tips and advice, but also combine your own work and development.

Pure code stream

Because of the advantages and disadvantages of XIB/Storyboard flows, the advantages and disadvantages of pure code flows are needless to say.

The only thing I mention is that Apple’s system-level API is really not good enough. Although Apple has optimized a lot, SnapKit or navigation is still recommended.

In a sense, pure code takes away these two frameworks and basically makes no sense.

Take a look directly at SnapKit Documentation, which covers everything: Snapkit-documentation

Reference documentation

Code writing UI, xiB vs. StoryBoard game, and some tips for Interface Builder

Let’s look at some of the arguments about storyboards

Snapkit – Documentation

conclusion

Kids make choices. Adults, of course, want them all.

In fact, I think the choice between xiB/Storyboard stream and pure code stream depends on the scenario. For example, if you are writing a quick Demo, you can use XIB/Storyboard stream if you don’t have high UI requirements, or if you are working on a personal project, you can do whatever you like. You just might need to pay attention on corporate projects.

The last thing I want to say about xiB/Storyboard flows versus pure code flows is that it’s from the heart.

Others say others, I use mine, own happy good.

Who TM Cares

About the Cover

The characters are based on the White Album 2, although I am not sure, it is supposed to be by Fukasaki. The author of White Album 2, Shiaki Maruto, collaborated with Fukasaki on another work, The Way of The Female Protagonist.

White Album 2 is a classic love triangle story, where xiB/Storyboard flow or pure code flow is a choice.

We’ll see you next time.

Please comment on whether you are a XIB/Storyboard stream or a pure code stream, and the pros and cons.