<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Emmanuel-Okwara on blog.iankulin.com</title><link>https://blog.iankulin.com/tags/emmanuel-okwara/</link><description>Recent content in Emmanuel-Okwara on blog.iankulin.com</description><generator>Hugo</generator><language>en-AU</language><lastBuildDate>Sun, 07 Aug 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.iankulin.com/tags/emmanuel-okwara/index.xml" rel="self" type="application/rss+xml"/><item><title>MVVM Explained</title><link>https://blog.iankulin.com/mvvm-explained/</link><pubDate>Sun, 07 Aug 2022 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/mvvm-explained/</guid><description>&lt;p&gt;The first nine minutes of &lt;a href="https://www.youtube.com/watch?v=sLHVxnRS75w"&gt;this video&lt;/a&gt; from &lt;a href="https://twitter.com/Its_Macco"&gt;Emmanuel Okwara&lt;/a&gt; finally gave me a clear understanding of the difference between MVC and MVVM.&lt;/p&gt;
&lt;div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"&gt;
 &lt;iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/sLHVxnRS75w?autoplay=0&amp;amp;controls=1&amp;amp;end=0&amp;amp;loop=0&amp;amp;mute=0&amp;amp;start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"&gt;&lt;/iframe&gt;
 &lt;/div&gt;

&lt;p&gt;In both MVC and MVVM the data &amp;amp; logic (Model) are separated from the part that the user interacts (View). Usually the View is a screen with controls and so on, but that&amp;rsquo;s not compulsory - for example a voice mail app interface would be all audio and DTMF. The point is that in both, the user interface (view) does not mess directly with the data (model) - it has to go through some sort of gatekeeper.&lt;/p&gt;
&lt;p&gt;The new understanding I got from Emmanuel is that in MVVM, the View Model does not know what is in the View. It does not alter the view, just broadcasts that there&amp;rsquo;s been a change and lets the view go ahead and update itself. It makes sense that this would be the paradigm for SwiftUI&amp;rsquo;s declarative interface style, and is also (I imagine but actually have no idea) the basis for React.js&lt;/p&gt;
&lt;p&gt;One thing Emmanuel mentions that I&amp;rsquo;m not clear on is that each View will have it&amp;rsquo;s own View Controller. Currently all my tiny apps have had one view in the SwiftUI sense. I have pulled out sub views, and some have had views within views - for example with the Navigation View. So I guess my question would be, &amp;ldquo;What constitutes a View in MVVM?&amp;rdquo;&lt;/p&gt;
&lt;p&gt;I noped out at the nine minute mark as soon as Interface Builder showed it&amp;rsquo;s face. I&amp;rsquo;m an iOS15 SwiftUI baby - I will, eventually, need to learn the old magic, but competence developing iOS apps using SwiftUI current methods is the MVP.&lt;/p&gt;
&lt;p&gt;With this understanding, and having finished lecture 4 from the cs193p series, I think a good project for today would be the simplest possible MVVM app with the correct separations and bindings.&lt;/p&gt;</description></item></channel></rss>