<?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: Samue Raimond-Artinian</title>
    <description>The latest articles on DEV Community by Samue Raimond-Artinian (@squads_244).</description>
    <link>https://dev.to/squads_244</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4137479%2Fbc02e046-f89d-4769-8458-150af8bc81de.jpeg</url>
      <title>DEV Community: Samue Raimond-Artinian</title>
      <link>https://dev.to/squads_244</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/squads_244"/>
    <language>en</language>
    <item>
      <title>What I Learned Building a Reusable Authentication Flow in SwiftUI</title>
      <dc:creator>Samue Raimond-Artinian</dc:creator>
      <pubDate>Tue, 22 Sep 2026 11:42:45 +0000</pubDate>
      <link>https://dev.to/squads_244/what-i-learned-building-a-reusable-authentication-flow-in-swiftui-23</link>
      <guid>https://dev.to/squads_244/what-i-learned-building-a-reusable-authentication-flow-in-swiftui-23</guid>
      <description>&lt;p&gt;Why I built it&lt;/p&gt;

&lt;p&gt;I've been learning SwiftUI by building different projects, and one thing I noticed is that authentication screens involve much more than just placing a few TextFields and Buttons on screen.&lt;/p&gt;

&lt;p&gt;You need validation, loading states, error handling, password rules, keyboard management, navigation between Sign In, Create Account and Forgot Password, and a structure that can eventually connect to a real backend.&lt;/p&gt;

&lt;p&gt;I wanted to understand how all of these pieces could work together, so I built a complete reusable authentication flow called ModernLogin.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Keeping validation separate&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One of the things I learned was that putting every validation rule directly inside the views quickly makes the UI harder to maintain.&lt;/p&gt;

&lt;p&gt;Instead, I centralized the validation logic so the views can focus mainly on displaying the interface and reacting to the result.&lt;/p&gt;

&lt;p&gt;This also makes rules such as email validation, password requirements and matching passwords easier to reuse across different screens.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Designing for different authentication states&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Authentication isn't just an idle form and a success screen.&lt;/p&gt;

&lt;p&gt;The UI also needs to represent states such as:&lt;/p&gt;

&lt;p&gt;Loading&lt;br&gt;
Success&lt;br&gt;
Validation errors&lt;br&gt;
Authentication errors&lt;/p&gt;

&lt;p&gt;Building these states taught me to think about the complete user flow instead of only how the initial screen looks.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Making the UI reusable&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I didn't want the project to be tied to one app or one visual style.&lt;/p&gt;

&lt;p&gt;I created AuthTheme and AuthConfig so parts of the authentication experience can be customized without rebuilding the entire interface.&lt;/p&gt;

&lt;p&gt;I also added Light and Dark Mode support from the beginning instead of treating Dark Mode as something to add at the end.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Keeping the backend separate&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;ModernLogin doesn't include a backend.&lt;/p&gt;

&lt;p&gt;Instead, authentication actions are exposed through async/throws callbacks. This keeps the UI independent from a specific authentication provider and lets developers connect their own API, Firebase, Supabase, or another service.&lt;/p&gt;

&lt;p&gt;This was an important lesson for me: a reusable UI component shouldn't force every project to use the same backend.&lt;/p&gt;

&lt;p&gt;What I learned&lt;/p&gt;

&lt;p&gt;The biggest thing I learned from this project is that making something reusable requires thinking differently from building a screen for one specific app.&lt;/p&gt;

&lt;p&gt;I had to think about validation, configuration, different UI states, customization and how another developer would actually integrate the code.&lt;/p&gt;

&lt;p&gt;I'm still learning Swift and SwiftUI, so I'd love to hear how more experienced iOS developers would structure something like this differently.&lt;/p&gt;

&lt;p&gt;The finished project&lt;/p&gt;

&lt;p&gt;I turned the project into a downloadable SwiftUI template called ModernLogin. It includes the complete editable Swift source code and documentation.&lt;/p&gt;

&lt;p&gt;It's available for $14.99 on Gumroad:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://raimond77.gumroad.com/l/modern-auth-swiftui" rel="noopener noreferrer"&gt;https://raimond77.gumroad.com/l/modern-auth-swiftui&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have any feedback on the architecture, UI, or what you'd expect from a reusable authentication template, I'd really appreciate it.&lt;/p&gt;

</description>
      <category>swift</category>
      <category>ios</category>
      <category>beginners</category>
      <category>mobile</category>
    </item>
  </channel>
</rss>
