<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/">
	<channel>
		<title>Storyboard or Code? Solving the iOS UI-Building Dilemma | Infinum</title>
		<atom:link href="https://infinum.com/blog/storyboard-code-ui-building-ios/feed/" rel="self" type="application/rss+xml" />
		<link>https://infinum.com/blog/storyboard-code-ui-building-ios/</link>
		<description>Building digital products</description>
		<lastBuildDate>Fri, 03 Apr 2026 12:58:20 +0000</lastBuildDate>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>

					<item>
				<image>
					<url>32837https://infinum.com/uploads/2023/01/Pros-and-Cons-of-Building-Storyboard-or-Code-UI_hero.webp</url>
				</image>
				<title>Storyboard or Code? Solving the iOS UI-Building Dilemma</title>
				<link>https://infinum.com/blog/storyboard-code-ui-building-ios/</link>
				<pubDate>Tue, 24 Jan 2023 10:43:20 +0000</pubDate>
				<dc:creator>Petar Jadek</dc:creator>
				<guid isPermaLink="false">https://infinum.com/?p=32837</guid>
				<description>
					<![CDATA[<p>Building UI in iOS, you can choose to use storyboards or just code. We explore the pros and cons of both options. </p>
<p>The post <a href="https://infinum.com/blog/storyboard-code-ui-building-ios/">Storyboard or Code? Solving the iOS UI-Building Dilemma</a> appeared first on <a href="https://infinum.com">Infinum</a>.</p>
]]>
				</description>
				<content:encoded>
					<![CDATA[<div
	class="wrapper"
	data-id="es-122"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-92">
	</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-95"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-93">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-94'
	>
	Learning how to <a href="https://infinum.com/ui-ux-design-services/">build the UI</a> without using storyboards is an option most iOS developers will encounter at some point during their work. You could call it a natural evolution that occurs as our knowledge expands and we start to get a glimpse of a very different world.  </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-98"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-96">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-97'
	>
	The theory behind this way of thinking is quite simple – ditch the storyboard and start writing your views using just code. However, bear in mind that you&#8217;re diving into an ocean of complexity called UIKit without the inflatable floaters a storyboard provides, and you will probably need to take some time to learn new swimming techniques. </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-100"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-highlighted-text">
	<p	class='typography typography--size-36-text js-typography block-highlighted-text__typography'
	data-id='es-99'
	>
	When you finally gain some experience, you&#8217;re left with a vast amount of knowledge and a new dilemma: Should you use storyboards?</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-103"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-101">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-102'
	>
	The answer is not that simple. Even our iOS team remains neutral on this topic and doesn&#8217;t favor one option over the other by default. Since each comes with its benefits, it&#8217;s a choice based on the project situation and its necessities.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-106"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-104">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-105'
	>
	Why Storyboards?</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-109"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-107">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-108'
	>
	Why not storyboards? Creating user interfaces using storyboards is simple, and it&#8217;s what Apple recommends to everyone starting out in iOS development. </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-111"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-highlighted-text">
	<p	class='typography typography--size-36-text js-typography block-highlighted-text__typography'
	data-id='es-110'
	>
	Storyboards are elegant, easy to learn, and more intuitive than using code for everything, at least in the beginning. </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-114"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-112">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-113'
	>
	It&#8217;s easy to pick an element you want to display and position it on a screen. When you learn how to manipulate these elements to get them to look like you want, then you already know how to use outlets and constraints, connect the views, etc.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-117"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-115">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-116'
	>
	We use storyboards on our projects, and you&#8217;ll find them in practice for many types of screens – from the smallest ones containing only two labels to large scrollable ones where each section has some labels, images, or other elements. </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-120"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-118">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-119'
	>
	However, we strive to make everything reusable, which can often get complicated when using storyboards. Not impossible, though. </p></div>	</div>
</div>
</div>		</div>
	</div>

<div
	class="wrapper"
	data-id="es-125"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-media">
	<div	class="media block-media__media media__border--none media__align--center-center"
	data-id="es-123"
	 data-media-type='image'>

	<figure class="image block-media__image-figure image--size-stretch" data-id="es-124">
	<picture class="image__picture block-media__image-picture">
								
			<source
				srcset=https://infinum.com/uploads/2023/01/pros_and_cons_screens-1400x715.webp				media='(max-width: 699px)'
				type=image/webp								height="715"
												width="1400"
				 />
								
			<source
				srcset=https://infinum.com/uploads/2023/01/pros_and_cons_screens-2400x1226.webp				media='(max-width: 1199px)'
				type=image/webp								height="1226"
												width="2400"
				 />
												<img
					src="https://infinum.com/uploads/2023/01/pros_and_cons_screens.webp"
					class="image__img block-media__image-img"
					alt=""
										height="1400"
															width="2740"
										loading="lazy"
					 />
					</picture>

	</figure></div></div>		</div>
	</div>

<div
	class="wrapper"
	data-id="es-131"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-126">
	

</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-129"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-127">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-128'
	>
	The picture above displays how easy it is to create a master-detail screen using storyboards. They are very flexible, meaning you can organize as many view controllers and views as you want into a single storyboard. However, doing so comes at a price. You might be facing extended loading time, as storyboards tend to take more time to load, whereas code files load almost instantly.</p></div>	</div>
</div>
</div>		</div>
	</div>

<div
	class="wrapper"
	data-id="es-134"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-media">
	<div	class="media block-media__media media__border--none media__align--center-center"
	data-id="es-132"
	 data-media-type='image'>

	<figure class="image block-media__image-figure image--size-stretch" data-id="es-133">
	<picture class="image__picture block-media__image-picture">
												<img
					src="https://infinum.com/uploads/2023/01/pros_and_cons_label.webp"
					class="image__img block-media__image-img"
					alt=""
										height="478"
															width="1370"
										loading="lazy"
					 />
					</picture>

	</figure></div></div>		</div>
	</div>

<div
	class="wrapper"
	data-id="es-181"
	 data-animation-target='inner-items'>
		
			<div class="wrapper__inner">
			<div class="block-blog-content js-block-blog-content">
	
<div class="block-blog-content-sidebar" data-id="es-135">
	

</div>

<div class="block-blog-content-main">
	
<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-138"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-136">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-137'
	>
	Experienced iOS developers won&#8217;t take too much time creating simple storyboard views like tables or collection cells with a couple of elements like labels, images, or buttons. It is easy to make some of them reusable, and they are easy to import as views in other storyboards. </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-141"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-139">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-140'
	>
	Considering all this, editing storyboards is as simple as the storyboard is. It can get very complicated if you&#8217;re new to a project and have to investigate all the possible views and their options to replace something. Reviewing pull requests can be an even bigger challenge since Storyboards are basically Apple-inspired XML, and this makes it hard to see the important changes.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-144"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-142">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-143'
	>
	Why code?</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-147"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-145">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-146'
	>
	On the other hand, writing interfaces using code is sometimes better. Even Apple with its shiny new SwiftUI framework is telling us to do that. In my experience, the switch can be somewhat counterintuitive, and you may feel lost at first, but if you take the time to adjust and learn, you will be absolutely fine. You may even shorten your development time.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-149"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-highlighted-text">
	<p	class='typography typography--size-36-text js-typography block-highlighted-text__typography'
	data-id='es-148'
	>
	Writing views in code comes with many benefits. However, they only come to the surface when you use important reusability principles. That way, you can create a complex view by combining several separate views or adding new, extended additions to the existing ones.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-152"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-150">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-151'
	>
	For example, the code below displays <code>BaseView</code>. In this particular case, it&#8217;s the base every other view will inherit. </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-154"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-swift github-light" data-language="swift" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token">class BaseView</span><span class="token">:</span><span class="token"> </span><span class="token" style="color: #6f42c1;">UIView </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">override</span><span class="token"> </span><span class="token" style="color: #d73a49;">init(fra</span><span class="token">me</span><span class="token">: </span><span class="token">CGRect</span><span class="token">)</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #005cc5;">super</span><span class="token">.</span><span class="token" style="color: #d73a49;">init</span><span class="token">(</span><span class="token">frame:</span><span class="token"> frame</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token">setup(</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">required</span><span class="token"> </span><span class="token" style="color: #d73a49;">init?(cod</span><span class="token">er aDecoder</span><span class="token">: </span><span class="token">NSCoder</span><span class="token">)</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #005cc5;">super</span><span class="token">.</span><span class="token" style="color: #d73a49;">init</span><span class="token">(</span><span class="token">coder:</span><span class="token"> aDecoder</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token">setup(</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token" style="color: #d73a49;">private</span><span class="token"> </span><span class="token">func setup</span><span class="token">(</span><span class="token">)</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token">setupLayout(</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">let</span><span class="token"> constraints </span><span class="token" style="color: #d73a49;">= setupCo</span><span class="token">nstraints(</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">if</span><span class="token"> !constr</span><span class="token" style="color: #d73a49;">ai</span><span class="token">nts.</span><span class="token" style="color: #005cc5;">isEmpty</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">            NSLayoutConstraint.</span><span class="token">activate(</span><span class="token">constraints</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">func setupLayout</span><span class="token">(</span><span class="token">)</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #6a737d;">//</span><span class="token" style="color: #6a737d;"> Method used for overriding</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">func setupConstraints</span><span class="token">(</span><span class="token">)</span><span class="token"> </span><span class="token" style="color: #d73a49;">-&gt;</span><span class="token"> </span><span class="token">[</span><span class="token">NSLayoutConstraint</span><span class="token">]</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #6a737d;">//</span><span class="token" style="color: #6a737d;"> Method used for overriding</span><span class="token">
</span></span><span class="line"><span class="token">        </span><span class="token" style="color: #d73a49;">return</span><span class="token"> </span><span class="token">[</span><span class="token">]</span><span class="token">
</span></span><span class="line"><span class="token">    </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-157"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-155">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-156'
	>
	We can create any other view in the same way. For example, many apps have elements displaying an image and a label placed horizontally. We&#8217;ll name it <code>BaseListItem</code> for consistency. This class will inherit <code>BaseView</code>, so the methods for setting up the layout and the constraints will also be used. By the way, constraints are a whole other beast, and we won&#8217;t cover them here. When creating UI elements with code, the most important thing is to set the view property <code>translatesAutoresizingMaskIntoConstraints = <strong>false</strong></code>. If you follow my suggestion in the intended way, you make an extension to the UIKit and implement some static method that sets it to false, similar to what our create() method does here. </code></code></p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-159"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-code">
	<pre class="phiki language-php github-light" data-language="php" style="background-color: #fff;color: #24292e;"><code><span class="line"><span class="token" style="color: #d73a49;">class</span><span class="token"> </span><span class="token" style="color: #6f42c1;">BaseListItem</span><span class="token">: BaseView </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">    private</span><span class="token"> </span><span class="token" style="color: #005cc5;">lazy</span><span class="token"> </span><span class="token" style="color: #d73a49;">var</span><span class="token"> </span><span class="token" style="color: #005cc5;">image</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #005cc5;">UIImageView</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #6f42c1;">create</span><span class="token">()
</span></span><span class="line"><span class="token" style="color: #005cc5;">    private</span><span class="token"> </span><span class="token" style="color: #005cc5;">lazy</span><span class="token"> </span><span class="token" style="color: #d73a49;">var</span><span class="token"> </span><span class="token" style="color: #005cc5;">titleLabel</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #005cc5;">UILabel</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #6f42c1;">create</span><span class="token">()
</span></span><span class="line"><span class="token" style="color: #005cc5;">    private</span><span class="token"> </span><span class="token" style="color: #005cc5;">lazy</span><span class="token"> </span><span class="token" style="color: #d73a49;">var</span><span class="token"> </span><span class="token" style="color: #005cc5;">stackView</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #005cc5;">UIStackView</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #6f42c1;">create</span><span class="token">()
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">    override</span><span class="token"> </span><span class="token" style="color: #005cc5;">func</span><span class="token"> </span><span class="token" style="color: #6f42c1;">setupLayout</span><span class="token">() {</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">        super</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #6f42c1;">setupLayout</span><span class="token">()
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">        stackView</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #6f42c1;">addArrangedSubview</span><span class="token">(</span><span class="token" style="color: #6f42c1;">image</span><span class="token">)
</span></span><span class="line"><span class="token" style="color: #005cc5;">        stackView</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #6f42c1;">addArrangedSubview</span><span class="token">(</span><span class="token" style="color: #6f42c1;">titleLa</span><span class="token" style="color: #005cc5;">bel</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #6f42c1;">        addSubview</span><span class="token">(</span><span class="token" style="color: #6f42c1;">stackVi</span><span class="token" style="color: #005cc5;">ew</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">    </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">    override</span><span class="token"> </span><span class="token" style="color: #005cc5;">func</span><span class="token"> </span><span class="token" style="color: #6f42c1;">setupConstraints</span><span class="token">() -</span><span class="token" style="color: #d73a49;">&gt;</span><span class="token"> </span><span class="token">[</span><span class="token" style="color: #005cc5;">NSLayoutConstraint</span><span class="token">]</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">        var</span><span class="token"> </span><span class="token" style="color: #005cc5;">constraints</span><span class="token">:</span><span class="token"> </span><span class="token">[</span><span class="token" style="color: #005cc5;">NSLayoutConstraint</span><span class="token">]</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token">[</span><span class="token">]</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">        constraints</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #6f42c1;">append</span><span class="token">(</span><span class="token" style="color: #6f42c1;">stackVi</span><span class="token" style="color: #005cc5;">ew</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #6f42c1;">pin</span><span class="token">(</span><span class="token" style="color: #6f42c1;">to</span><span class="token">: </span><span class="token" style="color: #6f42c1;">sel</span><span class="token" style="color: #d73a49;">f</span><span class="token">)</span><span class="token">)</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">  return</span><span class="token"> </span><span class="token" style="color: #005cc5;">constraints </span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">    </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">    func</span><span class="token"> </span><span class="token" style="color: #6f42c1;">configure</span><span class="token">(</span><span class="token" style="color: #6f42c1;">wit</span><span class="token" style="color: #005cc5;">h</span><span class="token"> </span><span class="token" style="color: #005cc5;">item</span><span class="token">:</span><span class="token"> </span><span class="token" style="color: #005cc5;">ListItem</span><span class="token">)</span><span class="token"> </span><span class="token">{</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">        image</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #005cc5;">item</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">image</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">        titleLabel</span><span class="token"> </span><span class="token" style="color: #d73a49;">=</span><span class="token"> </span><span class="token" style="color: #005cc5;">item</span><span class="token" style="color: #d73a49;">.</span><span class="token" style="color: #005cc5;">title</span><span class="token">
</span></span><span class="line"><span class="token" style="color: #005cc5;">    </span><span class="token">}</span><span class="token">
</span></span><span class="line"><span class="token">}</span><span class="token">
</span></span></code></pre></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-162"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-160">
	<p	class='typography typography--size-20-text-roman js-typography block-paragraph__paragraph'
	data-id='es-161'
	>
	Any other view can be added on top of this <code>BaseListItem</code>. This class can be configured and is ready to be used anywhere else with many possible configurations. Essentially, this is more efficient and easier to understand than dragging and dropping elements without realizing what is happening in the background. Writing constraints by hand for the first time can get confusing, but this way, we control the elements exactly how we want.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-165"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-163">
	<p	class='typography typography--size-20-text-roman js-typography block-paragraph__paragraph'
	data-id='es-164'
	>
	When changes do occur, they are easily visible to your colleague in charge of the PR review. They don&#8217;t need to take a lot of time decoding the immersive XML experience and can use it in better ways.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-168"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-166">
	<p	class='typography typography--size-20-text-roman js-typography block-paragraph__paragraph'
	data-id='es-167'
	>
	As mentioned before, our team doesn&#8217;t give preference to any option, and we tend to take the best of both worlds. So in practice, both storyboard-built and code-built UI can be found in our project files.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-170"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-highlighted-text">
	<p	class='typography typography--size-36-text js-typography block-highlighted-text__typography'
	data-id='es-169'
	>
	When you&#8217;re starting to learn Swift, storyboards can be of great help, and when you gather enough experience, writing your own UI is just another adventure on the way.</p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-173"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-heading" data-id="es-171">
	<h2	class='typography typography--size-52-default js-typography block-heading__heading'
	data-id='es-172'
	>
	Ready for the future</h2></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-176"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-174">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-175'
	>
	You might wonder how useful it is to learn all this since Apple is slowly but surely pushing SwiftUI as the go-to option when developing for their platforms. It&#8217;s been up and running for over three years, and it&#8217;s getting better with every new iteration. Moreover, some features like widgets or live activities can only be implemented using SwiftUI.  </p></div>	</div>

<div
	class="wrapper wrapper__use-simple--true"
	data-id="es-179"
	 data-animation='slideFade' data-animation-target='inner-items'>
		
			<div class="block-paragraph" data-id="es-177">
	<p	class='typography typography--size-16-text-roman js-typography block-paragraph__paragraph'
	data-id='es-178'
	>
	Still, neither storyboards nor the UIKit are going away anytime soon. I would always recommend learning how to write the UI from code and using storyboards before you dive into SwiftUI. Under the hood, the modern declarative framework is still very dependent on the UIKit, and learning it will give you an excellent basis to start your journey with SwiftUI, even though its logic and ways are much different from the old ways.</p></div>	</div>
</div>
</div>		</div>
	</div><p>The post <a href="https://infinum.com/blog/storyboard-code-ui-building-ios/">Storyboard or Code? Solving the iOS UI-Building Dilemma</a> appeared first on <a href="https://infinum.com">Infinum</a>.</p>
]]>
				</content:encoded>
			</item>
		
	</channel>
</rss>