<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Doruk Çoban on Medium]]></title>
        <description><![CDATA[Stories by Doruk Çoban on Medium]]></description>
        <link>https://medium.com/@drkcbn?source=rss-c2e86ce19168------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZGKHsnSUw-xH1MG9ywFw4Q.jpeg</url>
            <title>Stories by Doruk Çoban on Medium</title>
            <link>https://medium.com/@drkcbn?source=rss-c2e86ce19168------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:41:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@drkcbn/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[D V N C I — A Storyboardless & Clean & Multidirectional Architecture]]></title>
            <link>https://medium.com/@drkcbn/d-v-n-c-i-a-storyboardless-clean-multidirectional-architecture-cb9321db2687?source=rss-c2e86ce19168------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb9321db2687</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[uikit]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <dc:creator><![CDATA[Doruk Çoban]]></dc:creator>
            <pubDate>Thu, 03 Feb 2022 09:14:39 GMT</pubDate>
            <atom:updated>2022-02-06T01:44:43.341Z</atom:updated>
            <content:encoded><![CDATA[<h3>D V N C I — A Storyboardless &amp; Clean &amp; Multidirectional Architecture Pattern</h3><p>In these days iOS applications are in a <strong>transition</strong>, slow paced passing to <strong>SwiftUI</strong> framework from our beloved <strong>UIKit</strong>. Who knows how many years left we can keep using UIKit but my purpose is to make best of it</p><p>When it comes to build an app in <strong>UIKit</strong> with a clean structure, we all use most common patterns such as <strong>MVVM, VIPER, VIP, MVVM-C</strong>…<br>However they are mainly designed for projects that are using Storyboard.<br>And when you want to develop a project without Storyboard, you are simply out of these standards.</p><p>In professional area, -I am too- developing apps using these accepted standards, using storyboards… Yet in my playgrounds i am working on a new pattern to support <strong>Storyboardless</strong> development style and be more <strong>Single Responsibility </strong>focused.</p><p>Let’s keep it short, <br>I call it DVNCI, reading it as you guess “Da Vinci” <br>All letters come from layers;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LMvFSgI77OIqXG0j1ir_1w.png" /></figure><p>As stated in the diagram, it is multidirectional. But it is dangerous in terms of <strong>memory leaks</strong> if you do not be careful. So, in DVNCI, Controller has <strong>strong references</strong> of all layers. but others have <strong>weak reference</strong> of Controller. In this way we <strong>avoid memory leaks</strong>, when a scene gets dismissed, all layers get completely <strong>deinitialized</strong>.</p><p>Other than that, let’s check out all layers and have a brief description.</p><p><strong>DataSource</strong><br>I don’t see a <strong>best practice</strong> in conforming reusable view protocols on UIViewController, so DVNCI has an extra layer that <strong>extends NSObject, so it can conform</strong> reusable view protocols. It holds items array [Any] which can hold different types of objects. You can reuse <strong>different cell types</strong> by type checking at <strong>IndexPath</strong> on <strong>cellForRowAt</strong> method.</p><p>What if you don’t have a reusable view(tableView, collectionView) <br>in module? You can still stash your updatable properties here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sR8gfTqb2qbU1lrJI3_B7A.png" /></figure><p><strong>View<br></strong>This is a <strong>UIView</strong> class. We create subviews, adjust auto layout and pass user input into Controller from here. There is <strong>no business logic</strong> here, this layer has to have no idea of what it is. View layer is expected to present what is demanded by controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rHU74vbwq5gOFiUabtGeCg.png" /></figure><p><strong>Navigator<br></strong>Some call it coordinator, i call it navigator. This layer is assigned to manage navigation across modules with dependency injection if needed. It also creates an instance of the module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lPYGcKSzT96s2kfutfHm9Q.png" /></figure><p><strong>Controller</strong><br>In Swift, we don’t have a <strong>pure Controller</strong>, by default, it’s unified with View layer, yet still, it has one job in DVNCI, <strong>control the flow</strong>. If you want to <strong>configure</strong> UIViewController for <strong>transitions, navigationBar</strong>… You can commit them all at creation of module, in navigator layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z55TgK1S0YwcHSL3Sk0vdA.png" /></figure><p><strong>Interactor<br></strong>VIPER users are familiar with this layer, that uses <strong>network</strong> or <strong>coredata</strong> workers to <strong>get data</strong>, then <strong>passes decoded object</strong> into Controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cErtzK8BJOvnGHen-Tr71A.png" /></figure><p><strong>Sublayers</strong>;<br>There is a <strong>Cell</strong> folder in every module. Reusable view files which belong to module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*-9HRmGEoMnBy-hjro23alw.png" /></figure><p>There is also <strong>Model</strong> folder too in a module, which holds <strong>Decodable</strong> <strong>Structs</strong>, if there any <strong>business logic</strong> needs to be handled, there is <strong>ViewModel</strong> too for mapping <strong>raw</strong> <strong>Decodable</strong> to <strong>present</strong> data in view layer.</p><blockquote>If we want to implement <strong>Single Responsibility </strong>principle, All layers have to have their own specific job.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ahi7X6L73kxl5bbedAgM3g.png" /><figcaption>This is a Reusable Cell</figcaption></figure><p>Off the topic but<strong> prepareForReuse</strong> method is significant. Since you have to nullify <strong>reusable</strong> <strong>labels</strong>, <strong>imageviews</strong>, hopefully i have an extension deals with all.</p><p>Setting up views and layout <strong>programmatically</strong>, is beyond easier than you think, if you were using stackviews and auto-layout libraries such as <strong>Constren</strong></p><p>As you can see <strong>bind</strong> method <strong>does not have any knowledge</strong> what type of data is coming to present. It expects an optional <strong>Any</strong> type.</p><p>If you want to use a reusable view on <strong>multiple</strong> <strong>modules</strong>, you can easily extend it by protocols with multiple methods in order to bind different types of data.</p><p>Passing user inputs<strong> by protocols</strong> directly <strong>to the Controller</strong>, since <strong>we conformed</strong> this protocol <strong>in DataSource</strong> layer.</p><p>Developers are mostly using <strong>ViewModel </strong>in popular architectures, assigning other jobs for instance handling network requests. Yet true purpose of a <strong>ViewModel </strong>is below, <strong>UIKit</strong> is not imported here. And if <strong>Unit Tests </strong>required, you can easily put these structs to test by mocking, without having affairs with <strong>UIKit </strong>classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oLE4LMDRGCSe_DqvBertug.png" /></figure><p>As you can see, this architecture is the cleanest you could ever seen. I am developing my personal apps using this architecture. No matter how complex the app, it never gets messy.</p><p>Once you get used to, <strong>maintenance, modifications</strong>, <strong>Unit Tests</strong> can be made so easily and without breaking <strong>SOLID</strong> principles. I say, give it a try. Feedbacks are always good, since no one can have a perfect knowledge, only sharing will improve us all…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SjABSDK9zUoWpY_rrRyGgw.png" /></figure><p>As a parting gift, I have prepared an <strong>XCode template</strong> which will help you to create a DVNCI module like you create a swift file. You can get from <a href="https://github.com/dorvk/DVNCI-Module.git">here</a></p><p>Thanks for your reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb9321db2687" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let there be no storyboard]]></title>
            <link>https://medium.com/@drkcbn/let-there-be-no-storyboard-786086f2b1ed?source=rss-c2e86ce19168------2</link>
            <guid isPermaLink="false">https://medium.com/p/786086f2b1ed</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[uikit]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Doruk Çoban]]></dc:creator>
            <pubDate>Thu, 12 Aug 2021 14:34:17 GMT</pubDate>
            <atom:updated>2021-08-12T15:23:46.666Z</atom:updated>
            <content:encoded><![CDATA[<p>Developing apps, building their interfaces, managing navigation with Storyboard is so common in the market. And so easy to use according to many developers. Yet, is it the best practice in the long term?</p><p>With the introduction of SwiftUI at Apple WWDC 2019, Apple presented its vision in coming years… There will be no storyboards in the future, replacing them with code-reactive Canvas which is super cool and able to work with UIKit thanks to extensions. Ahoy! storyboard lovers, no need to worry. Even Objective-C is not dead yet.</p><p>Anyway,</p><p>We will not discuss here, pros and cons of using Storyboards. I will directly try to convince you that Storyboards are disgusting :)</p><p>Many developers state that building an interface with the storyboard is easy and it is the way that they have learned in the beginning. However, people always hesitate to change their ways…</p><p>Let’s say you have a page built with a storyboard, and it has 5 or 6 UITextField and lots of other stuff on it, a form page. One day your Project Manager comes up with the news that they want to add one more UITextField between them.</p><p>Oh no! What should you do?</p><p>If those text fields weren’t contained in a UIStackView, you are going to have a big headache… Remove all constraints, re-constrain them each by each… Oh, and the storyboard is lagging so much?! Spending so much time with this nonsense… Which is so annoying. Right?</p><p>When I have a storyboard on a project, I am trying to avoid even misclicks on Project Navigator since it’s disgustingly laggy!</p><p>On the other hand, if you had your interface developed with code, this process was easy as copy-paste. You just create another UITextField property, which you will probably copy from another, add it to the superview, then make some modifications in the constraint codes. That’s it.</p><p>This process will take 2 minutes at most.</p><p>Guys, let me show you how I develop a simple cell with title and description labels aligned vertically,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3436fb73889ba28a41de055e2734c4bc/href">https://medium.com/media/3436fb73889ba28a41de055e2734c4bc/href</a></iframe><p>As you can see, there are a few custom classes and extensions which makes it even easier and faster to develop or adding new features in our view…</p><p>I also want to show you the UIView class which is replacing Storyboard and how it is connected to its ViewController</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aeac9c64e5b9f0cc5472fe3f95a0e597/href">https://medium.com/media/aeac9c64e5b9f0cc5472fe3f95a0e597/href</a></iframe><blockquote><em>note: View is a Subclass of UIView</em></blockquote><p>Quite simple right? in the loadView override method, you can assign any UIView class so UIViewController can manage.</p><p>Maybe you are wondering how i manage the tableView delegate and dataSource… In the module i am architecting, a ViewModel or an Interactor layer -which you probably know from VIPER- is a good place to manage dataSource in, which conformed from Router layer.</p><p>Anyway, i will not argue about architecture, but this topic thankfully leads us to Navigation without storyboards.</p><p>Normally developers establish connection between ViewControllers in the Storyboard, passing data through prepareForSegue method…</p><p>A good thing about developing without storyboards, it pushes developer to use more advanced architectures since when you don’t use storyboards, Massive View Controller gets even more Massive.</p><p>Navigation or Router Layers helps to develop even cleaner code but that’s not our topic.</p><p>Let’s investigate how we start an app without Storyboard,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a198234aded8442dd4c95f29d612efa0/href">https://medium.com/media/a198234aded8442dd4c95f29d612efa0/href</a></iframe><p>This is the first place you start. Initializing a UIWindow, making it key and visible, assigning the rootViewController…</p><p>Normally i don’t initialize it here but we are keeping it simple.</p><p>That’s it then. You can build and run this app and see the MainViewController() pops up which is presenting MainView() as its view.</p><p>Let’s say you want to push another page which is SecondViewController(). There are two common ways to do it.</p><p>First option is, calling “present” method from UIViewController(), presented UIViewController() will be placed over top of UIWindow’s Z stack. And it is not the best practice, keep presenting ViewControllers over and over.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/72f244668fd8c318a98066f40d56042e/href">https://medium.com/media/72f244668fd8c318a98066f40d56042e/href</a></iframe><p>Second option is to “push” from navigationController if we initialized a UINavigationController() at first which containing our UIViewController()</p><p>Lastly i will show you some constraint tricks and finish the article.</p><p>Before this, i would like to share an <a href="https://github.com/dorvk/UIViewPreviewProvider">extension</a> which will help you to present your view at Canvas like you were developing with SwiftUI</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b9b46ae2e72dbe564c997f437c87571/href">https://medium.com/media/5b9b46ae2e72dbe564c997f437c87571/href</a></iframe><p>After you have the <a href="https://github.com/dorvk/UIViewPreviewProvider">extension</a> in your project, add this block under the UIView class you want to present on canvas.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f4c3b73c81fe2e4aea39082d9985db95/href">https://medium.com/media/f4c3b73c81fe2e4aea39082d9985db95/href</a></iframe><p>And here it is…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9O8fkGZ_m5o2f7IoGM4-w.png" /></figure><p>Hope you enjoyed the article and have chance to give up on storyboards. :)</p><p>Thanks for reading…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=786086f2b1ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>