<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mohammed Imthathullah</title>
    <description>The latest articles on DEV Community by Mohammed Imthathullah (@imthath_m).</description>
    <link>https://dev.to/imthath_m</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F462070%2Fd3676645-daed-431c-b41d-acbe5dc8eb43.jpeg</url>
      <title>DEV Community: Mohammed Imthathullah</title>
      <link>https://dev.to/imthath_m</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/imthath_m"/>
    <language>en</language>
    <item>
      <title>Why Appreciation Matters?</title>
      <dc:creator>Mohammed Imthathullah</dc:creator>
      <pubDate>Sat, 12 Apr 2025 17:47:52 +0000</pubDate>
      <link>https://dev.to/imthath_m/why-appreciation-matters-5a0k</link>
      <guid>https://dev.to/imthath_m/why-appreciation-matters-5a0k</guid>
      <description>&lt;h4&gt;
  
  
  Especially when it comes from close quarters.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ep641umxua9qcdyko5s.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5ep641umxua9qcdyko5s.jpeg" width="800" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everyone appreciates being appreciated. We can even say most people long for it. But hardly a few people will people confess how much they like being appreciated.&lt;/p&gt;

&lt;p&gt;I’m not talking about false praise in the face. Like when a bad and corrupt politician for almost his entire life becomes President and suddenly everyone is saying how good he is and how he is the best. Seriously people? Get a life.&lt;/p&gt;

&lt;p&gt;The kind of appreciation you get from the people who are close to you and are part of your every day life for very simple things. Your family appreciating you for getting the groceries or doing the laundry. Your manager or colleagues appreciating you for doing what you get paid to do. Your friends in class appreciating you for explaining a simple concept to them.&lt;/p&gt;

&lt;p&gt;These are very small things and, in most cultures, nowadays they are taken for granted. You don’t expect your manager to appreciate you for doing what you are paid to do. And your manager feels no need for it, most likely does not even think about. Same inside the family or among the friends. Over time, you even stop expecting them to appreciate you for the petty things.&lt;/p&gt;

&lt;p&gt;So, the situation is, everyone likes it, no one does it and to top it all, no one even expects it.&lt;/p&gt;

&lt;p&gt;Where has this gone wrong? I think we lack gratitude. We will never appreciate things that we are not grateful for. We will not understand the value of such things while we take them for granted.&lt;/p&gt;

&lt;p&gt;We have to be grateful. Someone might ask “to who?”. That is for every single person to figure out. Someone might also ask “for what?”. I think there is no point in trying to convince such a person, who might think that luxuries of life are his/her birth right. They’ll understand when they lose some.&lt;/p&gt;

&lt;p&gt;But guess what, the other question is not so complicated. Who you should appreciate? The answer is simple. Everyone around you. Everyone you interact with often. What should you appreciate them for? For whatever good they do.&lt;/p&gt;

&lt;p&gt;Just let people know, that you appreciate what they do and maybe even how they do. I’m sure they’ll like it and do it better next time. But don’t make a big fuss out of it. If it is dramatic, it will not be real and won’t cause any good. Just casually let them know.&lt;/p&gt;

&lt;p&gt;To change the world for better, you can start with appreciating people. Whatever good they are doing, they’ll try to make it better.&lt;/p&gt;

</description>
      <category>appreciation</category>
      <category>lifelessons</category>
      <category>improvement</category>
    </item>
    <item>
      <title>A Sidebar in SwiftUI without NavigationView</title>
      <dc:creator>Mohammed Imthathullah</dc:creator>
      <pubDate>Mon, 02 Nov 2020 10:24:09 +0000</pubDate>
      <link>https://dev.to/imthath_m/a-sidebar-in-swiftui-without-navigationview-4h7j</link>
      <guid>https://dev.to/imthath_m/a-sidebar-in-swiftui-without-navigationview-4h7j</guid>
      <description>&lt;p&gt;SwiftUI is really easy and fast for prototyping UI. This opinion has been expressed by many developers in different wordings. Recently, SwiftLee expressed the same in Twitter.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1322862129649770499-772" src="https://platform.twitter.com/embed/Tweet.html?id=1322862129649770499"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1322862129649770499-772');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1322862129649770499&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;I've seen such comments about SwiftUI but this time I decided to add a response, because of the recent challenges (maybe call them limitations 🤔)  I've faced with implementing some not views in SwiftUI. &lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1322893159009906688-683" src="https://platform.twitter.com/embed/Tweet.html?id=1322893159009906688"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1322893159009906688-683');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1322893159009906688&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;So, how does SwiftUI fare against the complex requirements of a real world project? At present, it has been in production for only just over a year and we can't find many SwiftUI apps in the App Stores. &lt;/p&gt;

&lt;p&gt;But if there is any good time to build and ship SwiftUI apps, it is right now!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Disclaimer: Continue only if your minimum target is iOS 13.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Even though most of the SwiftUI features which make it production ready have shipped only with iOS 14, you can build a decent app for iOS 13 which becomes exceptional when the user updates. &lt;/p&gt;

&lt;p&gt;Take the common requirement of a collection view in many apps. You can use the new lazy grids for iOS 14 and drop down to a combination of &lt;code&gt;VStack&lt;/code&gt; and &lt;code&gt;HStack&lt;/code&gt; as Paul explains in &lt;a href="https://www.hackingwithswift.com/quick-start/swiftui/how-to-position-views-in-a-grid-using-lazyvgrid-and-lazyhgrid" rel="noopener noreferrer"&gt;this article&lt;/a&gt; for iOS 13. Also if your requirement can just be fulfilled using a list, then go for it in iOS 13. &lt;/p&gt;

&lt;p&gt;But if your requirements are complex or you want to tweak the default behavior a little bit, you might find it difficult. Today we'll tackle one such scenario where I want some tweaks to the default behavior and over the coming weeks we'll see many more. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;SidebarListStyle&lt;/code&gt;  introduced this year, makes it so easy to get the default Sidebar behavior in your app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;struct&lt;/span&gt; &lt;span class="kt"&gt;SidebarList&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;@State&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;selected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;

    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;some&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;NavigationView&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;\&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="k"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;selection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;$selected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
                &lt;span class="kt"&gt;NavigationLink&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;destination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="s"&gt; is selected"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kt"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Select &lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)})&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;SidebarListStyle&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
            &lt;span class="kt"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Nothing is selected"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Just with that few lines, you get the default behavior of the Sidebar in a nice Master Detail layout. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnplxcmqv0stggxml48cm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnplxcmqv0stggxml48cm.png" alt="Default Sidebar" width="800" height="582"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You get a lot of things out of the box. A Sidebar with spaced out list items, no separators, a nice indication for the selection, a button to toggle the visibility of the Sidebar. If you use the new &lt;code&gt;Label&lt;/code&gt; for the list item, the images will be in the &lt;code&gt;accentColor&lt;/code&gt;. So cool, with just a few lines of code!&lt;br&gt;
Now my requirement is to have Sidebar and the detail view, but I don't want them to be inside a &lt;code&gt;NavigationView&lt;/code&gt;. Sounds simple right? Lets try.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kd"&gt;struct&lt;/span&gt; &lt;span class="kt"&gt;SplitView&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;@State&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;selected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;

    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;some&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;HStack&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;\&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="k"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;selection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;$selected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
                &lt;span class="kt"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Select &lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;SidebarListStyle&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
            &lt;span class="n"&gt;detailView&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;@ViewBuilder&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;detailView&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;some&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;selected&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Nothing is selected"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="n"&gt;selected&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="s"&gt; is selected"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2n37g2r4er2pplzqm4u4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2n37g2r4er2pplzqm4u4.png" alt="Default Stack View" width="800" height="577"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is not what I expected to see from the above code. But SwiftUI views react to the environment, you can say, SwiftUI views are dependent on the environment. We got the spaced out list items without separator, but no selection and hence no highlighting when tapped and we need to frame the views in required size. &lt;/p&gt;

&lt;p&gt;I have no clue why removing the &lt;code&gt;NavigationLink&lt;/code&gt; stops the &lt;code&gt;List&lt;/code&gt; selection from working. You can get it to work by adding an &lt;code&gt;onTapGesture&lt;/code&gt; to the &lt;code&gt;Text&lt;/code&gt;. The &lt;code&gt;selection&lt;/code&gt; parameter in the list in no longer required. You can fix the Sidebar width by using the &lt;code&gt;frame&lt;/code&gt; modifier.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;\&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="k"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;selection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;$selected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
    &lt;span class="kt"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Select &lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="n"&gt;number&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;onTapGesture&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;selected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flsm4c8u7p2k6fud1yone.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flsm4c8u7p2k6fud1yone.png" alt="A sidebar in the middle" width="800" height="586"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Again, this is not what I expected but SwiftUI did its job perfectly. We can fix this easily by adding a &lt;code&gt;Spacer()&lt;/code&gt; before and after &lt;code&gt;detailView&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;The functionality is working properly, so you can tap any item to select it. But there is not visual indication of which item is currently selected. To highlight the selection, add a &lt;code&gt;background&lt;/code&gt; with `accentCol&lt;/p&gt;

&lt;p&gt;Here's the final output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fltz79zljsbytz93mm5ak.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fltz79zljsbytz93mm5ak.png" alt="The desired custom Sidebar" width="800" height="577"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And, below is the code to get that output. Here's the [gist].(&lt;a href="https://gist.github.com/mimthath4/4f37773f1f471bdf767ae151685414d3" rel="noopener noreferrer"&gt;https://gist.github.com/mimthath4/4f37773f1f471bdf767ae151685414d3&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;We've used a &lt;code&gt;HStack&lt;/code&gt; and &lt;code&gt;contentShape&lt;/code&gt; modifier so that tapping anywhere on the list item enables selection. &lt;/p&gt;

&lt;p&gt;This is not the perfect solution, but this works. It took me some mental preparation to share working solutions publicly rather than waiting for the perfect solution all the time.&lt;/p&gt;

&lt;p&gt;If you want to see this solution in Production, checkout &lt;a href="https://apps.apple.com/app/id1525226399?platform=ipad" rel="noopener noreferrer"&gt;Swimbols&lt;/a&gt; on the App Store.&lt;/p&gt;

&lt;p&gt;Follow me &lt;a href="https://twitter.com/intent/follow?screen_name=imthath_m" rel="noopener noreferrer"&gt;on Twitter&lt;/a&gt;, so that I'll let you when I write more. Feel free to DM if you want to ask/share something.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



</description>
      <category>swift</category>
      <category>swiftui</category>
      <category>ipad</category>
      <category>sidebar</category>
    </item>
    <item>
      <title>Understanding SwiftUI Modifiers</title>
      <dc:creator>Mohammed Imthathullah</dc:creator>
      <pubDate>Thu, 29 Oct 2020 17:27:59 +0000</pubDate>
      <link>https://dev.to/imthath_m/understanding-swiftui-modifiers-1jab</link>
      <guid>https://dev.to/imthath_m/understanding-swiftui-modifiers-1jab</guid>
      <description>&lt;p&gt;A major paradigm shift is in progress in the Apple development world. For years, we were used to the imperative programming style of UIKit and AppKit. Even though there were many attempts by third parties with different styles, this imperative style of UI frameworks remained the same and most developers liked it.&lt;/p&gt;

&lt;p&gt;When Apple introduced SwiftUI in 2019, the future looked distinctly different. It’s all declarative now. Not everyone was ready to jump in from the onset, but for those who dove into SwiftUI, it is a fun if occasionally frustrating journey. With &lt;a href="https://www.hackingwithswift.com/articles/221/whats-new-in-swiftui-for-ios-14" rel="noopener noreferrer"&gt;the improvements SwiftUI got in 2020&lt;/a&gt;, more developers are set to begin their journey with a declarative UI framework.&lt;/p&gt;

&lt;p&gt;Let’s try to explore the workings of one of the most important parts of SwiftUI: modifiers.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;View&lt;/code&gt; can have any number of modifiers. They can be added to the view just like you would chain multiple function calls. Each modifier returns a &lt;code&gt;View&lt;/code&gt; that the succeeding modifier will act on. Hence, when working with modifiers, the order in which you add them is really important. Let’s look at that with an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Image(systemName: "camera.fill")
    .padding(EdgeInsets(top: 10.0, leading: 10.0, bottom: 10.0, trailing: 10.0))
    .background(Color.green)
    .cornerRadius(10.0)
    .padding(EdgeInsets(top: 10.0, leading: 10.0, bottom: 10.0, trailing: 10.0))
    .background(Color.red)
    .rotationEffect(Angle(degrees: 15.0))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkea3qknbdt5c5zjgdj9c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkea3qknbdt5c5zjgdj9c.png" alt="Fully rotated view" width="800" height="726"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see from the code and preview above, &lt;code&gt;cornerRadius&lt;/code&gt; is applied to the inner rectangle and the whole view is rotated, as the &lt;code&gt;rotationEffect&lt;/code&gt; modifier is the last. Now let’s change the order of the modifiers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Image(systemName: "camera.fill")
    .padding(EdgeInsets(top: 10.0, leading: 10.0, bottom: 10.0, trailing: 10.0))
    .background(Color.green)
    .rotationEffect(Angle(degrees: 15.0))
    .padding(EdgeInsets(top: 10.0, leading: 10.0, bottom: 10.0, trailing: 10.0))
    .background(Color.red)
    .cornerRadius(10.0)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmhj9pfu45tn6vj6u6ejs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmhj9pfu45tn6vj6u6ejs.png" alt="Rounded image" width="800" height="739"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We’ve now interchanged the positions of &lt;code&gt;rotationEffect&lt;/code&gt; and &lt;code&gt;cornerRadius&lt;/code&gt;. You can observe the difference in the resulting view. The inner rectangle is now rotated and the outer rectangle is rounded.&lt;/p&gt;

&lt;p&gt;In these two examples, we’ve applied &lt;code&gt;background&lt;/code&gt; and &lt;code&gt;padding&lt;/code&gt; modifiers more than once. Each time, they modified the view. Now let’s explore another set of modifiers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx400ph5tcgft2qvdf02y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx400ph5tcgft2qvdf02y.png" alt="Applying same modifer multiple times" width="800" height="389"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Can you tell how these modifiers are different from what we have seen above?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In some cases, when you apply the same modifier twice, SwiftUI only takes the first one. This is clearly demonstrated by the &lt;code&gt;foregroundColor&lt;/code&gt; modifier in the example above. This behavior is exactly opposite to how normal functions (and most of the SwiftUI modifiers) behave.&lt;/p&gt;

&lt;p&gt;My understanding of this behavior is that when a modifier cannot have more than one effect on a view (e.g. any view can have only one foreground color), the one closest to the view is applied.&lt;/p&gt;

&lt;p&gt;I was not able to find any documentation on why this is the case and which modifiers behave like this, but I’ve come to this understanding by working with SwiftUI for more than a year now.&lt;/p&gt;

&lt;p&gt;How great would it be if Xcode provided us with a warning when adding such redundant modifiers more than once? Well, for that to happen, Xcode will need a SwiftUI compiler in addition to the existing Swift and Objective-C compilers.&lt;/p&gt;

&lt;p&gt;But we can surely achieve these when we build apps that work with SwiftUI modifiers. When I first thought of &lt;a href="https://dev.to/imthath_m/re-imagining-sf-symbols-into-xcode-2ol5"&gt;solving the problems I had when working with SF Symbols&lt;/a&gt;, I envisioned a tool that does a better than job than the combined workflow of SF Symbols Mac app and Xcode.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://apps.apple.com/app/id1525226399?platform=ipad" rel="noopener noreferrer"&gt;Swimbols&lt;/a&gt; lets you add modifiers instantly, edit or reorder modifiers to suit your needs and switch symbols with just a click after applying modifiers. All with real-time preview and you can copy the code when you are done.&lt;/p&gt;

&lt;p&gt;When it doesn’t make sense for the modifier to be added more than once, Swimbols doesn’t show them in the list. And you can add as many of the other type of modifiers we discussed earlier in the post.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F65xl0f96l302t720peae.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F65xl0f96l302t720peae.png" alt="Swimbols in action" width="800" height="599"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Swimbols in action - Add and edit modifiers, change symbols and preview instantly.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can play around with &lt;a href="https://apps.apple.com/app/id1525226399?platform=ipad" rel="noopener noreferrer"&gt;Swimbols&lt;/a&gt; and visually reorder the modifiers to see how they affect the view instantly.&lt;/p&gt;

&lt;p&gt;As SwiftUI improves, it is good to have a strong understanding of the basic building blocks. I hope it is now clear how the order of modifiers affects the view and why it doesn’t make sense for some modifiers to be used more than once.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>swift</category>
      <category>swiftui</category>
      <category>ios</category>
    </item>
    <item>
      <title>Re-Imagining SF Symbols Into Xcode</title>
      <dc:creator>Mohammed Imthathullah</dc:creator>
      <pubDate>Thu, 29 Oct 2020 17:23:24 +0000</pubDate>
      <link>https://dev.to/imthath_m/re-imagining-sf-symbols-into-xcode-2ol5</link>
      <guid>https://dev.to/imthath_m/re-imagining-sf-symbols-into-xcode-2ol5</guid>
      <description>&lt;p&gt;Ever since Apple introduced, SF Symbols life has been so easy for developers. Particularly, for those who do not a have a design team to back them up.&lt;/p&gt;

&lt;p&gt;The pros of using SF Symbols has been documented well over the last year. There is no need to manage assets and the app size remains same irrespective of the number of symbols used. Seems like an all rosy path.&lt;/p&gt;

&lt;p&gt;But we have one good old problem. It can even be attributed to muscle memory. To copy the symbol's name to Xcode, we end up pressing &lt;em&gt;Cmd + C&lt;/em&gt;, most of the time. And Xcode stops compiling when our code looks like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fq4d7n3ox42e2du62gq4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fq4d7n3ox42e2du62gq4z.png" alt="Copying symbol instead of its name" width="556" height="102"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Its quite hard to rewire ourselves, only when working with SF Symbols app.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After successfully copying the symbol's name, we modify the symbol to make is more suited for our app. Every time we add modifiers, we hope Xcode helps us with auto completion or we remember the modifiers exactly and type them correctly, so that the live preview remains live.&lt;/p&gt;

&lt;p&gt;Then there will be times, when we might want to play around with multiple symbols, after applying your desired modifiers. So, we go the SF Symbols app, search or browse for the symbol, copy the symbol's name, paste it into Xcode and again, hope that we did nothing to break the live preview.&lt;/p&gt;

&lt;p&gt;Don't you think this entire workflow needs some improvement? Here comes &lt;a href="https://apps.apple.com/app/id1525226399#?platform=ipad" rel="noopener noreferrer"&gt;Swimbols&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5w4px7ku0q1cn64x68z2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5w4px7ku0q1cn64x68z2.png" alt="Swimbols in action" width="800" height="462"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Swimbols - A swifty way to add SF Symbols into Xcode.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Swimbols helps you overcome the pain points explained above and improve your workflow, there by giving you a productivity boost.&lt;/p&gt;

&lt;p&gt;Here's how your workflow will look like with Swimbols.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Browse through the categories or search for a symbol, select one and start applying modifiers. The preview is live. Just swipe left to delete any modifier. Tap the edit button to re-order modifiers. Whenever you want to change the symbol, just select it. All your modifiers are applied and you can see changes without any delay&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Does it sound better than the workflow you experience everyday? &lt;a href="https://apps.apple.com/app/id1525226399#?platform=ipad" rel="noopener noreferrer"&gt;Check it out&lt;/a&gt; for yourselves and let us know what you think. Swimbols for Mac is coming alongside macOS 11.&lt;/p&gt;

&lt;p&gt;The roadmap for Swimbols is &lt;a href="https://github.com/imthath-m/Swimbols/issues" rel="noopener noreferrer"&gt;here&lt;/a&gt; and you can suggest features or post issues. &lt;a href="https://twitter.com/intent/follow?screen_name=skydevz" rel="noopener noreferrer"&gt;Follow us&lt;/a&gt; on Twitter for updates about Swimbols and other exciting apps.&lt;/p&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;

</description>
      <category>swiftui</category>
      <category>swift</category>
      <category>ios</category>
      <category>sfsymbols</category>
    </item>
  </channel>
</rss>
