<?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 Artem Mykhelson on Medium]]></title>
        <description><![CDATA[Stories by Artem Mykhelson on Medium]]></description>
        <link>https://medium.com/@artemcodes?source=rss-e78133cca3b3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*xRtGtVlKLtOmwnRbcNTLYg.png</url>
            <title>Stories by Artem Mykhelson on Medium</title>
            <link>https://medium.com/@artemcodes?source=rss-e78133cca3b3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 23:09:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@artemcodes/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[How to Create an Expanding Rings Loader in SwiftUI]]></title>
            <link>https://artemcodes.medium.com/how-to-create-an-expanding-rings-loader-in-swiftui-32b8085df6ee?source=rss-e78133cca3b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/32b8085df6ee</guid>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Artem Mykhelson]]></dc:creator>
            <pubDate>Fri, 14 Mar 2025 15:27:32 GMT</pubDate>
            <atom:updated>2025-03-14T15:35:34.891Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FlOsmboLIy-s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DlOsmboLIy-s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FlOsmboLIy-s%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/7548e75d4093a3ab3fa41d40125fd783/href">https://medium.com/media/7548e75d4093a3ab3fa41d40125fd783/href</a></iframe><p>Loaders are an essential part of any modern app, providing users with visual feedback while content loads. In this tutorial, we’ll build a simple <strong>Expanding Rings Loader</strong> using SwiftUI’s animation system. This loader creates a subtle yet elegant effect, making it a great addition to any app.</p><p><strong>🛠 What We’ll Build</strong></p><p>We’ll create a <strong>circular loader</strong> that expands and fades continuously, giving the appearance of a pulsing ring. Here’s what it will look like:</p><p>🔵 Expanding ring animation that smoothly scales outward while fading.</p><p><strong>📌 The Code</strong></p><p>Below is the full SwiftUI implementation of our expanding rings loader:</p><pre>import SwiftUI<br><br>struct ExpandingRingsLoader: View {<br>    @State private var isAnimating = false<br>        <br>    var body: some View {<br>        ZStack {<br>            Circle()<br>                .stroke(Color.blue.opacity(isAnimating ? 0.1 : 0.8), lineWidth: 3)<br>                .frame(width: isAnimating ? 60 : 20, height: isAnimating ? 60 : 20)<br>                .scaleEffect(isAnimating ? 1.5 : 1)<br>                .animation(Animation.easeOut(duration: 1).repeatForever(autoreverses: false), value: isAnimating)<br>        }<br>        .onAppear {<br>            isAnimating = true<br>        }<br>    }<br>}<br><br>#Preview {<br>    ExpandingRingsLoader()<br>}</pre><p>Now, let’s break it down step by step.</p><p><strong>🏗 Breaking Down the Code</strong></p><p><strong>1️⃣ Using @State for Animation</strong></p><pre>@State private var isAnimating = false</pre><p>We define a @State property isAnimating, which will control the animation. When isAnimating changes, SwiftUI automatically updates the view with the new state.</p><p><strong>2️⃣ Creating the Expanding Ring</strong></p><pre>Circle()<br>    .stroke(Color.blue.opacity(isAnimating ? 0.1 : 0.8), lineWidth: 3)</pre><p>• We use a <strong>Circle</strong> with a stroke to create an outline rather than a filled shape.</p><p>• The opacity decreases (0.8 to 0.1) as the animation progresses, creating a fading effect.</p><p><strong>3️⃣ Adding Size and Scale Animation</strong></p><pre>.frame(width: isAnimating ? 60 : 20, height: isAnimating ? 60 : 20)<br>.scaleEffect(isAnimating ? 1.5 : 1)</pre><p>• Initially, the ring is <strong>small (20x20)</strong> and scales up to <strong>larger size (60x60)</strong> when animated.</p><p>• The scaleEffect increases the size further, giving the illusion of expansion.</p><p><strong>4️⃣ Applying the Animation</strong></p><pre>.animation(Animation.easeOut(duration: 1).repeatForever(autoreverses: false), value: isAnimating)</pre><p>• We use .easeOut(duration: 1), making the animation start quickly and then slow down.</p><p>• .repeatForever(autoreverses: false) ensures the animation runs continuously.</p><p><strong>5️⃣ Triggering the Animation</strong></p><pre>.onAppear {<br>    isAnimating = true<br>}</pre><p>• As soon as the view appears, isAnimating is set to true, which triggers SwiftUI to apply the animations.</p><p><strong>🎨 Customization Ideas</strong></p><p>Want to make it your own? Try these modifications:</p><p>✅ <strong>Change Colors</strong>: Swap Color.blue with any other color.</p><p>✅ <strong>Vary the Animation Speed</strong>: Adjust .easeOut(duration: 1) to a different value.</p><p>✅ <strong>Modify Ring Size</strong>: Experiment with different frame sizes for a unique look.</p><p><strong>📲 Adding It to Your App</strong></p><p>To use this loader in your app, simply include ExpandingRingsLoader() anywhere in your SwiftUI views. For example:</p><pre>VStack {<br>    Text(&quot;Loading...&quot;)<br>    ExpandingRingsLoader()<br>}</pre><p><strong>🚀 Wrapping Up</strong></p><p>In this tutorial, we created a beautiful <strong>Expanding Rings Loader</strong> using SwiftUI. By leveraging simple animations, we achieved a sleek and modern loading effect that can easily be integrated into any app.</p><p>Want more SwiftUI tutorials? Follow for more! 🚀</p><p>Would you like to extend this animation with multiple rings for a more complex effect? Let me know in the comments! 🎨🔥</p><p>Feel free to reach out in the comments if you encounter any other issues or need further clarification!</p><p><strong>If you found this article helpful, don’t forget to clap 👏 and share it with your fellow developers!</strong></p><p>☕ <strong>Enjoying this content? Support me!</strong></p><p>Creating quality content takes time and effort, and your support helps keep it going! If you found this article helpful, consider <strong>buying me a coffee</strong> — it’s a small gesture that makes a big difference.</p><p>👉 <a href="https://buymeacoffee.com/artemcodes"><strong>Buy Me a Coffee</strong></a></p><p>Thanks for your support! 💛</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32b8085df6ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Common Xcode Cloud Setup Issues and How to Fix Them]]></title>
            <link>https://artemcodes.medium.com/common-xcode-cloud-setup-issues-and-how-to-fix-them-94f9422f8084?source=rss-e78133cca3b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/94f9422f8084</guid>
            <category><![CDATA[ci-cd-integration]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[xcode-cloud]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios-development]]></category>
            <dc:creator><![CDATA[Artem Mykhelson]]></dc:creator>
            <pubDate>Tue, 25 Feb 2025 11:53:10 GMT</pubDate>
            <atom:updated>2025-02-25T11:53:10.662Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vigQACcsRKM3hk1MMAw4Ug.png" /></figure><p>Setting up Xcode Cloud can be a game-changer for your CI/CD pipeline, but it’s not always smooth sailing. During my setup process, I encountered a few common issues that can easily trip up developers. Here’s how to fix them and get your Xcode Cloud up and running seamlessly.</p><p><strong>1. Misconfigured .gitignore File</strong></p><p><strong>Problem:</strong></p><p>• .xcworkspace was ignored.</p><p>• The Pods/ directory was excluded entirely, whereas the correct approach is to exclude Pods/* except for the Pods/Target\ Support\ Files/ directory.</p><p>• The common .gitignore for iOS projects excludes Package.resolved, but it should be included to ensure consistent package versions across builds.</p><p><strong>Solution:</strong></p><p>Here’s how to fix your .gitignore file to work smoothly with Xcode Cloud:</p><pre># Ignore all Pods except Target Support Files<br>Pods/*<br>!Pods/Target\ Support\ Files/</pre><pre># Include Package.resolved to maintain consistent Swift Package versions<br>!Package.resolved</pre><pre># Don’t ignore the workspace<br>!.xcworkspace</pre><p><strong>Why It Works:</strong></p><p>• .xcworkspace is required for Xcode to locate your project structure.</p><p>• Excluding Pods/ entirely can lead to missing dependencies during build. Keeping the Target Support Files ensures correct linking.</p><p>• Including Package.resolved guarantees that the same Swift Package versions are used across all builds.</p><p><strong>2. CocoaPods Synchronization Issue</strong></p><p><strong>Problem:</strong></p><p>You might encounter this error during Xcode Cloud builds:</p><pre>The sandbox is not in sync with the Podfile.lock. Run &#39;pod install&#39; or update your CocoaPods installation.</pre><p><strong>Solution:</strong></p><p>Create a ci_post_clone.sh script to install CocoaPods and update dependencies automatically.</p><p><strong>Script Content:</strong></p><pre>#!/bin/sh<br>echo &quot;Installing CocoaPods...&quot;<br>sudo gem install cocoapods --pre<br>pod install</pre><p><strong>Important Note:</strong></p><p>Xcode Cloud looks for this script in the ci_scripts/ directory. Make sure to place it there instead of the project root.</p><p><strong>Directory Structure:</strong></p><pre>YourProject/<br>│<br>├── ci_scripts/<br>│   └── ci_post_clone.sh<br>│<br>└── YourProject.xcodeproj</pre><p><strong>Why It Works:</strong></p><p>• The script ensures the latest version of CocoaPods is installed on the CI environment.</p><p>• It runs pod install, syncing the sandbox with the Podfile.lock.</p><p><strong>3. Why These Fixes are Necessary for Xcode Cloud</strong></p><p>Xcode Cloud relies on a consistent and predictable environment. If your .gitignore is misconfigured, or your dependencies aren’t properly synced, you’ll face build failures. Following these guidelines ensures:</p><p>• Proper workspace recognition.</p><p>• Consistent dependency management.</p><p>• Avoidance of common CocoaPods sync errors.</p><p><strong>Conclusion</strong></p><p>Setting up Xcode Cloud can be challenging, especially when dealing with misconfigured .gitignore files and CocoaPods issues. By making the above adjustments, you can ensure a smoother and more reliable CI/CD pipeline for your iOS projects.</p><p><strong>Further Reading</strong></p><p>For a comprehensive overview of Xcode Cloud and its capabilities, check out <a href="https://artemcodes.medium.com/what-is-xcode-cloud-a-complete-guide-for-app-developers-8ac1b2132d27">What is Xcode Cloud? A Complete Guide for App Developers</a>.</p><p>Feel free to reach out in the comments if you encounter any other issues or need further clarification!</p><p><strong>If you found this article helpful, don’t forget to clap 👏 and share it with your fellow developers!</strong></p><p>☕ <strong>Enjoying this content? Support me!</strong></p><p>Creating quality content takes time and effort, and your support helps keep it going! If you found this article helpful, consider <strong>buying me a coffee</strong> — it’s a small gesture that makes a big difference.</p><p>👉 <a href="https://buymeacoffee.com/artemcodes"><strong>Buy Me a Coffee</strong></a></p><p>Thanks for your support! 💛</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94f9422f8084" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Xcode Cloud? A Complete Guide for App Developers]]></title>
            <link>https://artemcodes.medium.com/what-is-xcode-cloud-a-complete-guide-for-app-developers-8ac1b2132d27?source=rss-e78133cca3b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ac1b2132d27</guid>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[xcode-cloud]]></category>
            <category><![CDATA[ci-cd-tools]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[app-development]]></category>
            <dc:creator><![CDATA[Artem Mykhelson]]></dc:creator>
            <pubDate>Tue, 25 Feb 2025 11:31:26 GMT</pubDate>
            <atom:updated>2025-02-25T11:31:26.992Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m34pBr0H1jSQ2RR3TCW6nQ.png" /></figure><p>In the ever-evolving world of app development, productivity and efficiency are key. Apple recognized this need and introduced <strong>Xcode Cloud</strong> — a powerful, cloud-based continuous integration and delivery (CI/CD) service tailored for developers using Xcode.</p><p>But what exactly is Xcode Cloud? And how can it revolutionize your development workflow? Let’s dive in!</p><p><strong>What is Xcode Cloud?</strong></p><p>Xcode Cloud is a <strong>continuous integration and delivery (CI/CD) service</strong> built right into Xcode. It empowers developers to build, test, and distribute apps seamlessly — all in the cloud.</p><p>Announced at <strong>WWDC 2021</strong>, Xcode Cloud is designed to streamline the development process, enabling teams to collaborate more efficiently and deliver high-quality apps faster. Unlike traditional CI/CD tools that require complicated setups, Xcode Cloud is natively integrated with Xcode, providing a smooth, consistent experience for iOS, macOS, watchOS, and tvOS developers.</p><p><strong>Why Should You Care About Xcode Cloud?</strong></p><p>Imagine this: You’re working on a feature, but your local machine is bogged down with long build times. With Xcode Cloud, you can offload builds and tests to the cloud, freeing up your local resources for other tasks. This means faster iterations, quicker feedback, and ultimately — happier developers.</p><p>But that’s just the start. Here’s why Xcode Cloud is a game-changer:</p><p><strong>Key Features of Xcode Cloud</strong></p><p><strong>1. Automated Builds</strong></p><p>Xcode Cloud automates app builds in the cloud, allowing you to:</p><p>• <strong>Save time</strong> by running multiple builds simultaneously.</p><p>• <strong>Offload resource-intensive tasks</strong> from your local machine.</p><p><strong>2. Continuous Testing</strong></p><p>Ensure high-quality apps by running tests in parallel across multiple devices and OS versions. This helps:</p><p>• Catch bugs early in the development cycle.</p><p>• Maintain consistent app behavior across different environments.</p><p><strong>3. Seamless Team Collaboration</strong></p><p>Xcode Cloud integrates effortlessly with popular source control platforms like:</p><p>• <strong>GitHub</strong></p><p>• <strong>Bitbucket</strong></p><p>• <strong>GitLab</strong></p><p>This allows your team to:</p><p>• Automatically trigger builds on code changes.</p><p>• Collaborate more efficiently without manual intervention.</p><p><strong>4. Effortless Distribution</strong></p><p>Distribute beta versions to testers via <strong>TestFlight</strong> with just a few clicks. Plus, you can easily:</p><p>• Automate the app release process using <strong>App Store Connect</strong>.</p><p>• Get feedback faster to iterate and improve your app.</p><p><strong>5. Deep Integration with Xcode</strong></p><p>Since Xcode Cloud is built directly into Xcode, you get a consistent and familiar development experience without the hassle of managing external CI/CD tools.</p><p><strong>How to Get Started with Xcode Cloud</strong></p><p>Ready to dive in? Here’s how to get started:</p><p><strong>1. Enable Xcode Cloud</strong></p><p>• Go to <strong>App Store Connect</strong> and navigate to your app’s page.</p><p>• Enable Xcode Cloud under the “Xcode Cloud” section.</p><p><strong>2. Connect Your Source Code Repository</strong></p><p>Link your project with <strong>GitHub</strong>, <strong>Bitbucket</strong>, or <strong>GitLab</strong>. Xcode Cloud will automatically fetch your code for building and testing.</p><p><strong>3. Configure Workflows</strong></p><p>Create custom workflows to automate builds, tests, and distribution. You can trigger workflows on:</p><p>• Commits</p><p>• Pull requests</p><p>• Manual starts</p><p><strong>4. Run and Monitor Builds</strong></p><p>Monitor build progress and view results directly within Xcode. If something goes wrong, you’ll have detailed logs to help debug issues faster.</p><p><strong>Pricing: How Much Does Xcode Cloud Cost?</strong></p><p>Xcode Cloud is available as a subscription service, with various plans based on usage hours. Apple offers a free tier, so you can explore the features before committing to a paid plan.</p><p><strong>Why Choose Xcode Cloud?</strong></p><p>Xcode Cloud is a powerful CI/CD solution designed specifically for the Apple ecosystem. It helps developers:</p><p>• <strong>Save time and resources</strong> by offloading builds to the cloud.</p><p>• <strong>Collaborate seamlessly</strong> with integrated source control support.</p><p>• <strong>Deliver high-quality apps</strong> faster with continuous testing and distribution.</p><p>Whether you’re a solo developer or part of a large team, Xcode Cloud provides the tools you need to <strong>accelerate your development workflow</strong>.</p><p><strong>Final Thoughts: A Game-Changer for Apple Developers</strong></p><p>Xcode Cloud is more than just another CI/CD tool — it’s an all-in-one solution designed to optimize your entire app development lifecycle. By automating repetitive tasks, enhancing team collaboration, and providing powerful testing and distribution capabilities, Xcode Cloud is poised to become an indispensable asset for developers in the Apple ecosystem.</p><p>Are you ready to take your app development to the next level? <strong>Xcode Cloud</strong> is here to help you build the future, one cloud build at a time.</p><p><strong>Ready to Try Xcode Cloud?</strong></p><p>Xcode Cloud is revolutionizing the way developers build, test, and distribute apps. Why wait? Give it a try today and see how it can transform your development workflow.</p><p><strong>Let’s Discuss!</strong></p><p>Have you tried Xcode Cloud yet? What’s your experience been like? Drop a comment below — I’d love to hear your thoughts!</p><p><strong>If you found this article helpful, don’t forget to clap 👏 and share it with your fellow developers!</strong></p><p>☕ <strong>Enjoying this content? Support me!</strong></p><p>Creating quality content takes time and effort, and your support helps keep it going! If you found this article helpful, consider <strong>buying me a coffee</strong> — it’s a small gesture that makes a big difference.</p><p>👉 <a href="https://buymeacoffee.com/artemcodes"><strong>Buy Me a Coffee</strong></a></p><p>Thanks for your support! 💛</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ac1b2132d27" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build a Password Strength Meter in SwiftUI]]></title>
            <link>https://artemcodes.medium.com/how-to-build-a-password-strength-meter-in-swiftui-59e98df5c073?source=rss-e78133cca3b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/59e98df5c073</guid>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[passwords]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Artem Mykhelson]]></dc:creator>
            <pubDate>Fri, 07 Feb 2025 10:18:12 GMT</pubDate>
            <atom:updated>2025-02-07T10:18:12.646Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a9qkJZ9fQlbm6Ujnw_9J3Q.png" /></figure><p>In today’s digital age, ensuring strong passwords is essential for safeguarding user data. A visual strength meter not only guides users towards creating robust passwords but also enhances the user experience. In this tutorial, we’ll walk through creating a simple yet effective password strength meter using SwiftUI.</p><h3>What We’ll Build</h3><p>We’ll create a password strength meter that evaluates the strength of a password based on certain criteria (length, inclusion of numbers, uppercase letters, and special characters). The strength will be displayed both textually and visually using a colored bar.</p><h3>Step 1: Setting Up the Project</h3><p>Start by creating a new SwiftUI project in Xcode. Once set up, we’ll dive into building our password strength view.</p><h3>Step 2: Defining the Password Strength Enum</h3><p>We need an enumeration to represent the different levels of password strength. Each level will have an associated color to visually represent the strength.</p><pre>enum PasswordStrength: String {<br>    case weak = &quot;Weak&quot;<br>    case medium = &quot;Medium&quot;<br>    case strong = &quot;Strong&quot;<br>    <br>    var color: Color {<br>        switch self {<br>        case .weak:<br>            return .red<br>        case .medium:<br>            return .orange<br>        case .strong:<br>            return .green<br>        }<br>    }<br>}</pre><p>Here, we have three cases: weak, medium, and strong, each with a corresponding color.</p><h3>Step 3: Creating the Strength Bar</h3><p>Next, we’ll build a visual component, StrengthBar, that changes its appearance based on the password strength.</p><pre>struct StrengthBar: View {<br>    var strength: PasswordStrength<br>    <br>    var body: some View {<br>        GeometryReader { geometry in<br>            switch strength {<br>            case .weak:<br>                HStack {<br>                    StrenghtBarSegment(color: strength.color, maxWidth: geometry.size.width/3)<br>                    ForEach(0..&lt;2) { _ in<br>                        StrenghtBarSegment(color: .secondary, maxWidth: geometry.size.width/3)<br>                    }<br>                }.frame(maxHeight: 8)<br>            case .medium:<br>                HStack {<br>                    ForEach(0..&lt;2) { _ in<br>                        StrenghtBarSegment(color: strength.color, maxWidth: geometry.size.width/3)<br>                    }<br>                    StrenghtBarSegment(color: .secondary, maxWidth: geometry.size.width/3)<br>                }.frame(maxHeight: 8)<br>            case .strong:<br>                HStack {<br>                    ForEach(0..&lt;3) { _ in<br>                        StrenghtBarSegment(color: strength.color, maxWidth: geometry.size.width/3)<br>                    }<br>                }.frame(maxHeight: 8)<br>            }<br>        }.frame(maxHeight: 8)<br>    }<br>}<br><br>struct StrenghtBarSegment: View {<br>    var color: Color<br>    var maxWidth: CGFloat<br>    <br>    var body: some View {<br>        RoundedRectangle(cornerRadius: 4)<br>            .fill(color)<br>            .frame(height: 8)<br>            .frame(maxWidth: maxWidth)<br>    }<br>}</pre><p>This component uses a GeometryReader to ensure the bars adjust to the available width. Depending on the password strength, it fills different portions of the bar.</p><h3>Step 4: Building the Password Strength View</h3><p>Now, let’s bring everything together in the main PasswordStrengthView.</p><pre>struct PasswordStrengthView: View {<br>    @Binding var password: String<br>    @State private var strength: PasswordStrength = .weak<br>    var body: some View {<br>        HStack {<br>            StrengthBar(strength: strength)<br>            Text(strength.rawValue)<br>                .foregroundColor(strength.color)<br>                .font(.system(size: 16, weight: .semibold))<br>        }<br>        .animation(.easeInOut, value: strength)<br>        .onAppear {<br>            strength = evaluatePasswordStrength(password)<br>        }<br>        .onChange(of: password) { _, newValue in<br>            strength = evaluatePasswordStrength(newValue)<br>        }<br>    }<br>    <br>    func evaluatePasswordStrength(_ password: String) -&gt; PasswordStrength {<br>        if password.isEmpty {<br>            return .weak<br>        }<br>        <br>        let lengthCriteria = password.count &gt;= 8<br>        let numberCriteria = password.rangeOfCharacter(from: .decimalDigits) != nil<br>        let uppercaseCriteria = password.rangeOfCharacter(from: .uppercaseLetters) != nil<br>        let specialCharacterCriteria = password.rangeOfCharacter(from: CharacterSet.punctuationCharacters) != nil<br>        <br>        let score = [lengthCriteria, numberCriteria, uppercaseCriteria, specialCharacterCriteria].filter { $0 }.count<br>        <br>        switch score {<br>        case 0...1:<br>            return .weak<br>        case 2...3:<br>            return .medium<br>        default:<br>            return .strong<br>        }<br>    }<br>}</pre><h3>Explanation:</h3><ul><li><strong>Binding Password</strong>: The @Binding var password: String allows this view to react to changes in the password from a parent view.</li><li><strong>Password Evaluation</strong>: The evaluatePasswordStrength function checks four criteria:</li></ul><ol><li>Password length (at least 8 characters)</li><li>Inclusion of numbers</li><li>Presence of uppercase letters</li><li>Special characters</li></ol><p>Based on these checks, it assigns a strength level.</p><ul><li><strong>Animation &amp; Updates</strong>: The onChange modifier updates the strength as the user types.</li></ul><h3>Step 5: Previewing the Component</h3><p>To see the strength meter in action, let’s add a preview.</p><pre>struct PasswordStrengthView_Previews: PreviewProvider {<br>    static var previews: some View {<br>        PasswordStrengthView(password: .constant(&quot;Password123!&quot;))<br>            .padding()<br>            .previewLayout(.sizeThatFits)<br>    }<br>}</pre><p>This preview provides a quick look at how the meter responds to a strong password.</p><h3>Conclusion</h3><p>You’ve now built a functional password strength meter using SwiftUI! This component can be easily integrated into any sign-up or password reset form to guide users in creating secure passwords.</p><p>Feel free to expand upon this by adding more complex criteria, such as checking for dictionary words or implementing a more nuanced scoring system. Happy coding!</p><p>☕ <strong>Enjoying this content? Support me!</strong></p><p>Creating quality content takes time and effort, and your support helps keep it going! If you found this article helpful, consider <strong>buying me a coffee</strong> — it’s a small gesture that makes a big difference.</p><p>👉 <a href="https://buymeacoffee.com/artemcodes"><strong>Buy Me a Coffee</strong></a></p><p>Thanks for your support! 💛</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59e98df5c073" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create a DNA Helix Loader Animation in SwiftUI]]></title>
            <link>https://artemcodes.medium.com/how-to-create-a-dna-helix-loader-animation-in-swiftui-509b9ef20333?source=rss-e78133cca3b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/509b9ef20333</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[dnaloader]]></category>
            <category><![CDATA[loading-indicator]]></category>
            <category><![CDATA[swiftui-animation]]></category>
            <category><![CDATA[ios-development]]></category>
            <dc:creator><![CDATA[Artem Mykhelson]]></dc:creator>
            <pubDate>Mon, 03 Feb 2025 10:45:55 GMT</pubDate>
            <atom:updated>2025-02-03T13:58:53.586Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FhFBVOXuNvCE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhFBVOXuNvCE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FhFBVOXuNvCE%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/bafb6932ea6440722c4510d643068e53/href">https://medium.com/media/bafb6932ea6440722c4510d643068e53/href</a></iframe><p>Loading indicators are essential UI elements that provide feedback to users while a process is running. In this guide, we’ll create a visually appealing DNA Helix loader animation using SwiftUI.</p><h3>Overview</h3><p>Our DNAHelixLoader consists of six circles that oscillate up and down in a wave-like motion, resembling the helical structure of DNA. Each circle moves with a slight delay to create a dynamic animation effect.</p><h3>Code Implementation</h3><p>Below is the SwiftUI code to create the DNA Helix loader:</p><pre>import SwiftUI<br><br>struct DNAHelixLoader: View {<br>    @State private var move = false<br><br>    var body: some View {<br>        HStack(spacing: 6) {<br>            ForEach(0..&lt;6) { index in<br>                Circle()<br>                    .fill(Color.purple)<br>                    .frame(width: 12, height: 12)<br>                    .offset(y: move ? -10 : 10)<br>                    .animation(<br>                        Animation.easeInOut(duration: 0.8)<br>                            .repeatForever()<br>                            .delay(0.1 * Double(index)),<br>                        value: move<br>                    )<br>            }<br>        }<br>        .rotationEffect(.degrees(45))<br>        .onAppear {<br>            move.toggle()<br>        }<br>    }<br>}</pre><h3>Explanation</h3><h3>1. Using HStack for Horizontal Alignment</h3><ul><li>We use HStack with a spacing of 6 to align the six circles horizontally.</li></ul><h3>2. Creating the Animated Circles</h3><ul><li>The ForEach(0..&lt;6) loop generates six circles.</li><li>Each circle is a Circle() shape with a fill(Color.purple) and a frame of 12x12.</li><li>The offset(y:) modifier moves the circle up and down between -10 and 10 points.</li></ul><h3>3. Animating the Movement</h3><ul><li>We use easeInOut(duration: 0.8) for a smooth up-and-down motion.</li><li>.repeatForever() ensures the animation runs indefinitely.</li><li>.delay(0.1 * Double(index)) staggers the movement, creating a wave effect.</li></ul><h3>4. Applying Rotation</h3><ul><li>.rotationEffect(.degrees(45)) tilts the loader, enhancing the DNA helix effect.</li></ul><h3>5. Triggering the Animation</h3><ul><li>.onAppear { move.toggle() } starts the animation when the view appears.</li></ul><h3>Usage</h3><p>To use the DNAHelixLoader in your SwiftUI app, simply embed it in a view:</p><pre>struct ContentView: View {<br>    var body: some View {<br>        DNAHelixLoader()<br>    }<br>}</pre><h3>Customization</h3><p>You can easily modify the loader to suit your design needs:</p><ul><li>Change Color.purple to any color.</li><li>Adjust frame(width: height:) for different circle sizes.</li><li>Modify offset(y:) values for a more dramatic effect.</li><li>Alter the duration and delay in the animation for different speeds.</li></ul><h3>Conclusion</h3><p>The DNAHelixLoader is a simple yet effective SwiftUI animation that enhances user experience. By leveraging ForEach, offset, and animation modifiers, you can create a dynamic and eye-catching loading indicator with minimal code.</p><p>☕ <strong>Enjoying this content? Support me!</strong></p><p>Creating quality content takes time and effort, and your support helps keep it going! If you found this article helpful, consider <strong>buying me a coffee</strong> — it’s a small gesture that makes a big difference.</p><p>👉 <a href="https://buymeacoffee.com/artemcodes"><strong>Buy Me a Coffee</strong></a></p><p>Thanks for your support! 💛</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=509b9ef20333" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Canva + ChatGPT: A Goldmine? Yes, But Only If You Work For It]]></title>
            <link>https://artemcodes.medium.com/canva-chatgpt-a-goldmine-yes-but-only-if-you-work-for-it-af459bd0bad1?source=rss-e78133cca3b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/af459bd0bad1</guid>
            <category><![CDATA[passive-income]]></category>
            <category><![CDATA[goldmine]]></category>
            <category><![CDATA[goldminds]]></category>
            <category><![CDATA[canvas]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Artem Mykhelson]]></dc:creator>
            <pubDate>Thu, 23 Jan 2025 09:15:55 GMT</pubDate>
            <atom:updated>2025-01-23T09:15:55.927Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*ERtfp_8UcZWDztLCyDkHyg.png" /></figure><p>If you’ve spent any time on social media recently, you’ve probably seen posts claiming that Canva and ChatGPT are the ultimate goldmine for making passive income. The idea sounds incredibly tempting: use ChatGPT to generate content, design eye-catching templates in Canva, and watch the money roll in. But is it really that simple?</p><p>The truth is that while Canva and ChatGPT provide powerful tools for content creation, success doesn’t come overnight. Making money using these platforms requires creativity, strategy, and consistent effort. In this post, I’ll break down why Canva and ChatGPT can indeed be lucrative — but only if you’re willing to put in the work.</p><h3>The Hype vs. The Reality</h3><p>Many online influencers make it seem like you can generate an AI-written eBook, slap a Canva-designed cover on it, and start making thousands of dollars instantly. While that might sound appealing, the reality is that competition is fierce. The internet is flooded with AI-generated content, and simply creating something generic won’t cut it.</p><p>To stand out, you need to add a human touch. That means refining AI-generated content, ensuring originality, and putting real thought into your designs. Canva and ChatGPT are just tools — the success comes from how well you use them.</p><h3>The Right Way to Use ChatGPT and Canva for Profit</h3><p>If you want to turn Canva and ChatGPT into a true goldmine, here are a few strategies that actually work:</p><p><strong>Selling Canva Templates on Etsy</strong></p><ul><li>Canva templates are in high demand, but generic ones won’t get you far. You need to research what’s trending, understand your audience’s needs, and create high-quality, niche-specific designs.</li><li>Instead of flooding the market with basic templates, focus on unique, highly customizable designs that provide real value to buyers.</li></ul><p><strong>Creating and Selling Digital Products</strong></p><ul><li>ChatGPT can help generate ideas and content for digital planners, social media templates, workbooks, and even niche guides.</li><li>However, AI-generated content needs thorough editing. Make it engaging, well-structured, and visually appealing before putting it on the market.</li></ul><p><strong>Starting a Blog or Social Media Business</strong></p><ul><li>ChatGPT can help draft blog posts, but your success depends on how well you optimize content for SEO, add personal insights, and create visually compelling graphics using Canva.</li><li>Social media thrives on originality. Use Canva to design unique branding and marketing materials to make your content stand out.</li></ul><h3>The Hard Work Behind the Goldmine</h3><p>Making money with Canva and ChatGPT isn’t a get-rich-quick scheme. It requires:</p><ul><li><strong>Consistent Effort:</strong> Posting a few templates or eBooks and expecting instant sales is unrealistic. You need to market your products, engage with potential buyers, and continuously refine your offerings.</li><li><strong>Market Research:</strong> Understanding trends, customer needs, and pricing strategies is crucial. Successful sellers invest time in learning and improving their strategies.</li><li><strong>Creativity and Uniqueness:</strong> AI can provide a foundation, but originality is what sells. The more effort you put into personalizing your work, the more valuable it becomes.</li></ul><h3>Conclusion: A Goldmine? Yes, But Not an Easy One</h3><p>Canva and ChatGPT are incredible tools that can help you create and monetize digital content. However, they are not magic money-making machines. To truly profit from them, you must treat them as part of a larger business strategy, invest time into learning and improving, and stay committed to delivering high-quality, valuable content.</p><p>So, is Canva + ChatGPT a goldmine? Absolutely — but only for those willing to dig deep and put in the work. If you’re ready to commit, the potential is limitless.</p><p>☕ <strong>Enjoying this content? Support me!</strong></p><p>Creating quality content takes time and effort, and your support helps keep it going! If you found this article helpful, consider <strong>buying me a coffee</strong> — it’s a small gesture that makes a big difference.</p><p>👉 <a href="https://buymeacoffee.com/artemcodes"><strong>Buy Me a Coffee</strong></a></p><p>Thanks for your support! 💛</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af459bd0bad1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Logi MX Master 3S vs. Keychron M6: A Detailed Comparison]]></title>
            <link>https://artemcodes.medium.com/logi-mx-master-3s-vs-keychron-m6-a-detailed-comparison-87cfd3d0ad3a?source=rss-e78133cca3b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/87cfd3d0ad3a</guid>
            <category><![CDATA[ergonomic-mouse]]></category>
            <category><![CDATA[tech-reviews]]></category>
            <category><![CDATA[logitech-mouse]]></category>
            <category><![CDATA[keychron]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Artem Mykhelson]]></dc:creator>
            <pubDate>Fri, 17 Jan 2025 18:21:50 GMT</pubDate>
            <atom:updated>2025-01-17T18:21:50.860Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*FWDkd6bEzqXQiNFonUsJBg.png" /></figure><p>Hi there!</p><p>Today I want to share my opinion and comparison between two mice — <strong>Logi MX Master 3S</strong> and <strong>Keychron M6</strong>.</p><p>I don’t think it is quite necessary to introduce <strong>Logi</strong>. This one is really famous among <strong>ergonomic mice</strong>.</p><p>I am a huge fan of <strong>Keychron mechanical keyboards</strong>. What a surprise it was when I heard that <strong>Keychron has mice</strong>!</p><p>The <strong>M6 immediately caught my attention</strong> with its <strong>familiar design</strong> — yes, it <strong>does look quite similar to the MX Master series</strong>. But that’s not necessarily a bad thing, as this form factor has <strong>proven itself comfortable</strong> for many users over the years.</p><p><strong>Features &amp; Specs Breakdown</strong></p><p>Let’s break down what makes each of these mice special.</p><p>The <strong>MX Master 3S</strong> is Logitech’s <strong>latest iteration</strong> of their flagship mouse, featuring their <strong>new quiet clicks</strong> and an <strong>insane 8000 DPI sensor</strong>.</p><p>On the other hand, the <strong>Keychron M6</strong> comes in as a <strong>newer player</strong>, offering <strong>similar ergonomics at a more competitive price</strong>.</p><p>What really interested me was how <strong>Keychron approached this design</strong>. While they’re known for their <strong>fantastic keyboards</strong> (I’m typing this on a <strong>Q1 right now!</strong>), creating a <strong>comfortable ergonomic mouse</strong> is a whole different challenge.</p><p>The <strong>M6 features a 19000 DPI sensor</strong> — technically <strong>superior</strong> to the MX Master 3S — but as we all know, <strong>specs aren’t everything</strong>.</p><p><strong>Ergonomics &amp; Build Quality</strong></p><p>After using both mice for <strong>several weeks</strong>, switching between them for <strong>both work and occasional gaming</strong>, I’ve noticed some interesting <strong>differences in their day-to-day use</strong>.</p><p>The <strong>biggest immediate difference</strong> is the <strong>signature thumb button</strong> on the <strong>MX Master 3S</strong>. That <strong>horizontally placed button is practically magical</strong> for <strong>gesture controls</strong> — I use it constantly for <strong>switching between desktops on my Mac</strong> by holding it and moving the mouse.</p><p>The <strong>M6, unfortunately, doesn’t have this feature</strong>, which is quite a <strong>miss</strong> if you’re used to <strong>Logitech’s workflow</strong>.</p><p><strong>Customization &amp; Software Experience</strong></p><p>Speaking of <strong>software</strong>, <strong>Logi Options+ is miles ahead</strong> of Keychron’s offering.</p><p>While <strong>Keychron does provide basic configuration options</strong>, <strong>Logi’s software feels more polished</strong> and offers <strong>deeper customization</strong>.</p><p>You can:</p><p>✅ <strong>Set up app-specific profiles</strong></p><p>✅ <strong>Create complex macros</strong></p><p>✅ <strong>Enable Flow between different computers</strong></p><p>The <strong>M6’s software</strong> feels more… well, let’s say <strong>utilitarian</strong> in comparison.</p><p><strong>Clicks &amp; Scroll Wheel Differences</strong></p><p>However, the <strong>M6 does have some advantages</strong>.</p><p>• The <strong>main clicks feel more crisp and tactile</strong> compared to the <strong>deliberately quiet clicks</strong> of the <strong>MX Master 3S</strong>.</p><p>• If you’re <strong>coming from gaming mice</strong>, you might <strong>prefer the M6’s more decisive feedback</strong>.</p><p>• The <strong>side buttons on the M6</strong> are also slightly <strong>larger and easier to distinguish by touch</strong>.</p><p>The <strong>scroll wheel implementation is quite different too</strong>.</p><p>While <strong>both mice offer horizontal scrolling</strong>, the <strong>MX Master 3S’s MagSpeed wheel</strong> with its <strong>switchable ratchet/free-spin modes</strong> is simply <strong>unbeatable</strong>.</p><p>The <strong>M6’s scroll wheel is good</strong>, don’t get me wrong, but it’s <strong>more traditional</strong> and <strong>doesn’t offer that free-spinning capability</strong> that’s become a <strong>Logitech trademark</strong>.</p><p><strong>Battery Life Comparison</strong></p><p>Battery life is another <strong>interesting point of comparison</strong>.</p><p>• The <strong>MX Master 3S can go for about 70 days</strong> on a single charge.</p><p>• The <strong>M6 needs charging more frequently, lasting about 40–45 days</strong>.</p><p>• <strong>Both use USB-C</strong> for charging, which is <strong>convenient</strong>.</p><p>• But <strong>Logitech’s longer battery life</strong> is definitely <strong>noticeable in long-term use</strong>.</p><p><strong>DPI &amp; Tracking Performance</strong></p><p>When it comes to <strong>real-world DPI performance</strong>, the numbers can be <strong>misleading</strong>.</p><p>• <strong>M6 boasts 19000 DPI</strong> vs. <strong>MX Master 3S’s 8000 DPI</strong>.</p><p>• <strong>However, I rarely found myself using anything above 3000 DPI</strong> for daily work.</p><p>• <strong>MX Master 3S has a slight edge</strong> with its <strong>Darkfield technology</strong>, which lets it <strong>work even on glass surfaces</strong>.</p><p><strong>Final Verdict: Which One Should You Buy?</strong></p><p>After using <strong>both mice extensively</strong>, here’s my bottom line:</p><p><strong>Go for the MX Master 3S if:</strong></p><p>✅ You <strong>heavily rely on gesture controls</strong></p><p>✅ You <strong>work across multiple devices</strong></p><p>✅ The <strong>MagSpeed scroll wheel’s free-spinning mode</strong> would benefit your workflow</p><p>✅ You need <strong>that extra battery life</strong> and <strong>premium software features</strong></p><p>✅ You’re <strong>willing to pay more for a polished experience</strong></p><p><strong>Go for the Keychron M6 if:</strong></p><p>✅ You’re <strong>coming from a gaming mouse background</strong> and prefer <strong>more tactile feedback</strong></p><p>✅ You want a <strong>solid ergonomic mouse</strong> without the <strong>premium price tag</strong></p><p>✅ You <strong>don’t need advanced gesture controls or complex customization</strong></p><p>✅ You appreciate a <strong>lighter weight mouse</strong></p><p>✅ You’re <strong>already invested in the Keychron ecosystem</strong></p><p><strong>Final Thoughts</strong></p><p>In my <strong>personal opinion</strong>, if <strong>budget isn’t a major concern</strong>, the <strong>MX Master 3S is still the way to go</strong>.</p><p>The <strong>thumb button alone</strong> has become such an <strong>integral part of my workflow</strong> that I’d find it <strong>hard to switch to anything else</strong>.</p><p>However, <strong>Keychron deserves major kudos</strong> for creating such a <strong>compelling alternative</strong> at a <strong>lower price point</strong>.</p><p>The <strong>M6 proves that Keychron isn’t just a keyboard brand</strong> — they can <strong>make a damn good mouse too</strong>.</p><p>For those <strong>on the fence</strong>, consider this:</p><p>💰 The extra <strong>$30–40 for the MX Master 3S</strong> might seem steep, but <strong>spread across the years</strong> you’ll likely use this mouse, it’s a <strong>small price to pay</strong> for a tool that could <strong>significantly improve your daily workflow</strong>.</p><p>That said, if you’re <strong>more interested in a straightforward, comfortable mouse</strong> without all the <strong>extra features</strong>, the <strong>M6 won’t disappoint</strong>.</p><p>Whatever you choose, <strong>both options represent a major upgrade</strong> from standard office mice, and <strong>either one will serve you well</strong> in your <strong>productivity journey</strong>. 🚀</p><p>Which one do you prefer? Let me know in the comments! 😊</p><p>☕ <strong>Enjoying this content? Support me!</strong></p><p>Creating quality content takes time and effort, and your support helps keep it going! If you found this article helpful, consider <strong>buying me a coffee</strong> — it’s a small gesture that makes a big difference.</p><p>👉 <a href="https://buymeacoffee.com/artemcodes"><strong>Buy Me a Coffee</strong></a></p><p>Thanks for your support! 💛</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87cfd3d0ad3a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI. Fix custom buttons inside List item called one by one]]></title>
            <link>https://artemcodes.medium.com/swiftui-fix-custom-buttons-inside-list-item-called-one-by-one-a71722b04e8f?source=rss-e78133cca3b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/a71722b04e8f</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Artem Mykhelson]]></dc:creator>
            <pubDate>Fri, 09 Aug 2024 07:35:07 GMT</pubDate>
            <atom:updated>2025-02-03T10:38:03.364Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JAghbHGt8RF1tuOO" /><figcaption>Photo by <a href="https://unsplash.com/@afgprogrammer?utm_source=medium&amp;utm_medium=referral">Mohammad Rahmani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hi everyone.</p><p>The issue I faced today made me write this short how-to. Not only for those who potentially could face the same issue, but for myself as well in order just not to forget.</p><p>So here is a brief of what I have faced or, let it be more precise, what I have discovered.</p><p>When you put custom buttons inside a List item view, for some reason all button actions are getting called, even if you tap only one button.</p><p>Now details.</p><p>We have a list with items which is HStack with two buttons. Like this:</p><pre>struct ContentView: View {<br>    var body: some View {<br>        List {<br>            ForEach(0..&lt;10) { index in<br>                HStack {<br>                    Button(action: {<br>                        print(&quot;Button 1 tapped&quot;)<br>                        openView1()<br>                    }) {<br>                        Text(&quot;Button 1&quot;)<br>                    }<br>                    <br>                    Spacer()<br>                    <br>                    Button(action: {<br>                        print(&quot;Button 2 tapped&quot;)<br>                        openView2()<br>                    }) {<br>                        Text(&quot;Button 2&quot;)<br>                    }<br>                }<br>                .padding()<br>            }<br>        }<br>    }<br>    <br>    func openView1() {<br>        // Navigate to view1<br>        print(&quot;Opening View 1&quot;)<br>    }<br>    <br>    func openView2() {<br>        // Navigate to view2<br>        print(&quot;Opening View 2&quot;)<br>    }<br>}</pre><p>Now if you run this code and tap on Button 1, you will see the output in logs like this:</p><pre>1. Opening View 1<br>2. Opening View 2</pre><p>It ain’t obvious since we tap a Button 1 and action for the button 1 should be called.</p><p>If you wrap ForEach with VStack, everything should work as expected. Moreover, it will work as expected.</p><p>The fact that the buttons work correctly when wrapped in a VStack but not in a List suggests that the issue is likely related to how List manages its rows and interaction handling in SwiftUI.</p><p><strong>Possible Reasons:</strong></p><p>1. <strong>Row Selection Interference:</strong></p><p>• In a List, each row may have some default selection behavior, even if it’s not visibly selectable. This could interfere with the individual button actions.</p><p>2. <strong>Row Recycling:</strong></p><p>• List in SwiftUI reuses views for performance reasons, which can sometimes cause issues with event handling, especially if the views inside the List are complex.</p><p>3. <strong>Gesture Conflicts:</strong></p><ul><li>The List might be intercepting taps or gestures, causing both button actions to trigger.</li></ul><p>The third reason isn’t our case since we do not have any custom gestures defined on a List.</p><p>Second reason could be potential one, but issue is much simpler. And we smoothly come to a reason number 1.</p><blockquote>In a List, each row may have some default selection behavior, even if it’s not visibly selectable. This could interfere with the individual button actions.</blockquote><p>So what should we do next? The answer lies inside the reason. The default selection behaviour which somehow should be changed.</p><p>There is a modifier in SwiftUI called <strong>.buttonStyle</strong></p><p>The definition in source code is the following:</p><pre>@available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, *)<br>extension View {<br><br>    /// Sets the style for buttons within this view to a button style with a<br>    /// custom appearance and custom interaction behavior.<br>    ///<br>    /// Use this modifier to set a specific style for button instances<br>    /// within a view:<br>    ///<br>    ///     HStack {<br>    ///         Button(&quot;Sign In&quot;, action: signIn)<br>    ///         Button(&quot;Register&quot;, action: register)<br>    ///     }<br>    ///     .buttonStyle(.bordered)<br>    ///<br>    public func buttonStyle&lt;S&gt;(_ style: S) -&gt; some View where S : PrimitiveButtonStyle<br><br>}</pre><p>So that’s what we are looking for. The <strong>.buttonStyle </strong>sets the style for the buttons with a custom appearance and custom interaction behaviour. And that is exactly what we are looking for.</p><p>Finally, after we change button style to a <strong>PlainButtonStyle()</strong>, the button handlers works as expected.</p><p>The final code looks as this:</p><pre>struct ContentView: View {<br>    var body: some View {<br>        List {<br>            ForEach(0..&lt;10) { index in<br>                HStack {<br>                    Button(action: {<br>                        print(&quot;Button 1 tapped&quot;)<br>                        openView1()<br>                    }) {<br>                        Text(&quot;Button 1&quot;)<br>                    }<br>                    .buttonStyle(PlainButtonStyle())<br>                    <br>                    Spacer()<br>                    <br>                    Button(action: {<br>                        print(&quot;Button 2 tapped&quot;)<br>                        openView2()<br>                    }) {<br>                        Text(&quot;Button 2&quot;)<br>                    }<br>                    .buttonStyle(PlainButtonStyle())<br>                }<br>                .padding()<br>            }<br>        }<br>    }<br>    <br>    func openView1() {<br>        // Navigate to view1<br>        print(&quot;Opening View 1&quot;)<br>    }<br>    <br>    func openView2() {<br>        // Navigate to view2<br>        print(&quot;Opening View 2&quot;)<br>    }<br>}</pre><p>Hope this helps anyone who struggled with the same issue and gives a little better understanding on what happens inside.</p><p>Happy coding!</p><p>☕ <strong>Enjoying this content? Support me!</strong></p><p>Creating quality content takes time and effort, and your support helps keep it going! If you found this article helpful, consider <strong>buying me a coffee</strong> — it’s a small gesture that makes a big difference.</p><p>👉 <a href="https://buymeacoffee.com/artemcodes"><strong>Buy Me a Coffee</strong></a></p><p>Thanks for your support! 💛</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a71722b04e8f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI. How to create a rectangle with cutout circle in a top of it]]></title>
            <link>https://artemcodes.medium.com/swiftui-how-to-create-a-rectangle-with-cutout-circle-in-a-top-of-it-cb4a394a4093?source=rss-e78133cca3b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb4a394a4093</guid>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Artem Mykhelson]]></dc:creator>
            <pubDate>Thu, 27 Jun 2024 10:32:58 GMT</pubDate>
            <atom:updated>2024-06-27T10:32:58.182Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4PL82tCWhRUzi9Q0" /><figcaption>Photo by <a href="https://unsplash.com/@ikukevk?utm_source=medium&amp;utm_medium=referral">Kevin Ku</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hi there.</p><p>It’s been a long time since I posted something here.</p><p>Recently I have faced an interesting task to build using SwiftUI.</p><p>I have go the following design to follow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*ZH6ypSI3T3gr024viJoF1A.png" /></figure><p>Basically there are 3 layers here:</p><ol><li>Background full screen layer</li><li>Phone mockup image</li><li>(The most challenging one) White layer with the curved top part.</li></ol><p>If there is no middle layer with the phone mockup image, which is covered by the top white one, the task is easy. Just add a rectangle and double wide circle in top and mask them.</p><p>However here we have much complicated view. We need to have a rectangle with cutout circle in the top of that rectangle. The challenging part for me was to make that circle transparent and bottom part fill with color.</p><p>For me it seemed there are a few possible solutions for this task but I have decided to stick to the following plan:</p><ol><li>Make a custom background view with cutout circle but only a top part. It looks like this:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*XorYZjpHCxHiX6iIvQzboQ.png" /></figure><p>2. Add all the necessary content and fill the rest of the bottom part of the view with background color that matches the above view.</p><p>So here is the code example for the view I have to achieve:</p><pre>import SwiftUI<br><br>struct BackgroundView: View {<br>    let fillColor: Color<br>    <br>    var body: some View {<br>        GeometryReader { geometry in<br>            let screenWidth = geometry.size.width<br>            let circleDiameter = screenWidth * 2<br>            <br>            Rectangle()<br>                .fill(fillColor)<br>                .frame(width: geometry.size.width, height: geometry.size.height, alignment: .trailing)<br>                .mask(<br>                    HoleShapeMask(in: CGRect(x: 0, y: -geometry.size.height/2, width: geometry.size.width*2, height: geometry.size.height)).fill(style: FillStyle(eoFill: true))<br>                        .frame(width: circleDiameter, height: circleDiameter)<br>                )<br>        }<br>    }<br>}<br>    <br>func HoleShapeMask(in rect: CGRect) -&gt; Path {<br>    var shape = Rectangle().path(in: rect)<br>    shape.addPath(Circle().path(in: rect))<br>    return shape<br>}<br><br>#Preview {<br>    BackgroundView(fillColor: .brown)<br>}</pre><p>Hope this will help anyone struggling with the same issue as I had.</p><p>Cheers and happy coding to all of you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb4a394a4093" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Memories] War memories. Pt2]]></title>
            <link>https://artemcodes.medium.com/memories-war-memories-pt2-ad67b2e62b4f?source=rss-e78133cca3b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad67b2e62b4f</guid>
            <category><![CDATA[ukraine]]></category>
            <category><![CDATA[war-in-ukraine]]></category>
            <category><![CDATA[war]]></category>
            <dc:creator><![CDATA[Artem Mykhelson]]></dc:creator>
            <pubDate>Fri, 01 Apr 2022 12:14:47 GMT</pubDate>
            <atom:updated>2022-04-01T12:14:47.176Z</atom:updated>
            <content:encoded><![CDATA[<p>Today is April’s fools day, the day when all of us are usually joke and laugh. But not this year, the year when Ukraine sacrifice herself to protect the freedom, protect the world.</p><p>So, as I wrote in a Pt1, the year 2022 stopped for me and my family on 24th of February. Starting from 24th of February we all started counting each day Ukraine started suffering from russian aggression. Personally for me this war can be separated to 3 periods:</p><p>1. The beginning of the war, the time I remember almost everything that happened.<br>2. The period of time when time squashed and our life consisted of constant repeatings of “Siren → Bomb shelter → Siren all clear → Make some food and eat if possible or WC if possible”<br>3. The time we had to leave my parents, home, Chernihiv and go to Kyiv.</p><p>The first days of war were fed up. I remember the time when my father tried to join the Territory forces to protect our nearest district. At that point of time a lot of men were already in the queue and that queue was already overwhelmed. Only some time after my father got succeed at joining forces and got the weapon.</p><p>Almost immediately russian forces tried to use diverse groups to mark civil houses all over the city for the russian aircrafts and bombers so they know where to attack. I recall how myself and other guys were sicking for the marks on my building roof and in parallel watching how our forces use Grads in 100 meters of us. I will never forget what I felt that time — pride trust and faint in our forces.</p><p>And no fear.</p><p>Because fear is what russia, russian horde and putin himself pulpiteer. This is what they want Ukrainians feel, the whole world feel. And they failed. That time when the whole world felt fear about russia came to the end. No one is afraid of the “second army” of the world anymore. No one is afraid of the dyrov-kadyrov army — the only place they are “warriors” is a tiktok. And the most thing I am proud of is that Ukrainians beat and send them to hell without even sticks in their hands. No fear is a russian’s death.</p><p>During the first days we were running in and out of bomb shelter for about 4 times a day. We were sleeping there, as much as it was possible to do this there. Because the only one who could sleep there was my son — we built something that looked like a bed for him (potato sacks and a mattress on top). Few days later we found a bed frame abandoned by one of the neighbors and took it to use it as a bed for adults.</p><p>That continued for 5 days. Why? Because on 5th day of war my father was bitten by the rat while asleep. After this happened, we stopped sleeping in a bomb shelter because it was dangerous there. Actually there was a question — where is more dangerous in a shelter or in an apartment. We decided that we’d rather be alive without a plague in an apartment than with plague but in shelter. But that was a decision regarding the night. We decided to go to the bomb shelter any way, but not to fall asleep there.</p><p>On 7th of March I got a trauma. One of the days when we were going to the shelter I slipped and twisted my leg. I could not step on to my leg for about 3 days and my family decided to be with me at home when siren turns on. We just found a place according to the “2 walls” rule — this was a corridor between my and neighbours apartments. And starting from that day we always went to that corridor when siren turned on. Until the day we lost the electricity and internet connection.</p><p>To be continued…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad67b2e62b4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>