<?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: Kyra</title>
    <description>The latest articles on DEV Community by Kyra (@simplykyra).</description>
    <link>https://dev.to/simplykyra</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%2F1408949%2Faddc208b-1b40-40f8-a5ac-29bed62b59f5.jpeg</url>
      <title>DEV Community: Kyra</title>
      <link>https://dev.to/simplykyra</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/simplykyra"/>
    <language>en</language>
    <item>
      <title>Simply Customize It! My First App</title>
      <dc:creator>Kyra</dc:creator>
      <pubDate>Thu, 13 Jun 2024 12:32:03 +0000</pubDate>
      <link>https://dev.to/simplykyra/simply-customize-it-my-first-app-560h</link>
      <guid>https://dev.to/simplykyra/simply-customize-it-my-first-app-560h</guid>
      <description>&lt;p&gt;My first Apple app was just approved for the App Store! And I had to share here in case you have a reMarkable, an e-paper device, and want to use it. That said, I’m also sharing as I’m planning on creating a post sharing what I learned with the App Store in case it helps someone else. Let me know if you have any questions and maybe I can help or someone else in the discussion can. &lt;/p&gt;

&lt;p&gt;Back when I first bought my reMarkable e-paper device I decided I needed to change out the custom templates and then I really wanted to switch out the sleep screen image. This led to me writing a couple how to posts, getting questions, and ultimately working on implementing an Apple app. It is now out on both macOS and iOS devices so you can also change out your templates and screens with a simple button press too!&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%2Fuploads%2Farticles%2F9aj67nuizfg09fnmfbfg.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%2Fuploads%2Farticles%2F9aj67nuizfg09fnmfbfg.png" alt="app logo surrounded by screenshots of the iOS and macOS store" width="663" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to check it out you can find it in the store here &lt;a href="https://apps.apple.com/us/app/simply-customize-it/id6443862161" rel="noopener noreferrer"&gt;https://apps.apple.com/us/app/simply-customize-it/id6443862161&lt;/a&gt; or learn more about it on my website here: &lt;a href="https://www.simplykyra.com/simply-customize-it/" rel="noopener noreferrer"&gt;https://www.simplykyra.com/simply-customize-it/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>swiftui</category>
      <category>apple</category>
      <category>appstore</category>
      <category>discuss</category>
    </item>
    <item>
      <title>SwiftUI and Navigation</title>
      <dc:creator>Kyra</dc:creator>
      <pubDate>Thu, 06 Jun 2024 16:36:39 +0000</pubDate>
      <link>https://dev.to/simplykyra/swiftui-and-navigation-1p2i</link>
      <guid>https://dev.to/simplykyra/swiftui-and-navigation-1p2i</guid>
      <description>&lt;p&gt;I’m currently developing a multiplatform app and am having issues with both the tab control and sidebar on the iPhone and iPad devices. Ideally I want the user to be able to switch between the two if they prefer one over the other... and the switching currently works great but I've noticed minor issues with both formats. &lt;/p&gt;

&lt;p&gt;Specifically my app can go up to four levels but in this sample I have three. The left sidebar or tabs has four choices, the middle has it's own choices, and the right has a text box showing what was clicked on. With the sidebar option I notice the right screen doesn't change when you click on the sidebar (though the center does). Also the sidebar clicks print out text (with the onChange modifier) but don't register in the view. &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%2Fuploads%2Farticles%2F2nrdkuynctfs7l6c5alv.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%2Fuploads%2Farticles%2F2nrdkuynctfs7l6c5alv.png" alt=" " width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was going to lock it down to just tab control for now so the app is easily useable but noticed if you click to the third level then switch tabs the back button on the phone changes (from saying back) to reflect the newly selected tab but the content shows the old view. &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%2Fuploads%2Farticles%2F5ycchxp68y4ogzbo0o95.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%2Fuploads%2Farticles%2F5ycchxp68y4ogzbo0o95.png" alt=" " width="750" height="1334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using tab control on the iPad the middle sidebar (now on the left side)updates when the tab is changed but again, like with the phone, the right pane shows the old content. &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%2Fuploads%2Farticles%2Fzus66t7s589ds4u5ljl1.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%2Fuploads%2Farticles%2Fzus66t7s589ds4u5ljl1.png" alt=" " width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just curious if anyone knows of a good multiplatform SwiftUI tutorial that would help me get this working. In my actual app the right view sometimes has two levels with a back button.&lt;/p&gt;

&lt;p&gt;Either way hope your day is going good!&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>swiftui</category>
      <category>swift</category>
      <category>ios</category>
    </item>
    <item>
      <title>Using Handlebars Code to Generate Ghost YAML</title>
      <dc:creator>Kyra</dc:creator>
      <pubDate>Thu, 30 May 2024 14:58:00 +0000</pubDate>
      <link>https://dev.to/simplykyra/using-handlebars-code-to-generate-ghost-yaml-503g</link>
      <guid>https://dev.to/simplykyra/using-handlebars-code-to-generate-ghost-yaml-503g</guid>
      <description>&lt;p&gt;A bit ago I realized I needed to generate redirect text for each of my current blog posts on my Casper themed Ghost website. This seemed to be an overwhelming task but after talking it through both my husband and I came up with two potential ideas. I shared both how to find the redirect section through &lt;a href="https://ghost.org" rel="noopener noreferrer"&gt;the Ghost&lt;/a&gt; interface along with his earlier idea that used the data file, jq, and visual filtering in both the prior posts in this series. Now let's see how I realized we could code this using handlebars in case it also helps you. That said, if you are looking for my original full post you can check it out at &lt;a href="https://www.simplykyra.com/blog/oh-no-i-need-to-create-redirect-text-for-all-my-posts/" rel="noopener noreferrer"&gt;Oh No, I Need to Create Redirect Text for All My Posts!&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Quick warning: As I used the previous method in this series to generate my redirect text I didn't need to fully implement this method yet I still wanted to see if it was valid so I quickly coded it up on localhost to confirm it generated what looked like the right output but I didn't work on it any further beyond that. That said if I was to redo this... this method would be what I used this time around.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Plan
&lt;/h2&gt;

&lt;p&gt;My localhost is about a year behind in content from my current website so if I wanted to use the output of this I would've needed to, temporarily, have this run on my main website. My original plan, after confirming this worked locally, was to create a hidden non-linked page, connect it to the handlebar code, push to website, confirm the resulting text looked good, copy the results to my redirect file, upload, confirm a couple redirects worked, and then undo my code and page changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Warning
&lt;/h2&gt;

&lt;p&gt;As I haven't tested this in my redirect file and your website is probably set up differently please confirm it's right before using it yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Code
&lt;/h2&gt;

&lt;p&gt;I first wrote this up after using the redirect text generated in the first method that used pattern matching. Thus my first bit of code looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{#get "posts" limit="all"}}
    {{#foreach posts}}
         {"from":"^/({{slug}})/$","to":"/blog/$1","permanent":true},&amp;lt;br&amp;gt;
    {{/foreach}}
{{/get}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After looking at my earlier redirect text from when I first moved my website from Wordpress to Ghost I updated the text within the &lt;code&gt;get&lt;/code&gt; and the &lt;code&gt;foreach&lt;/code&gt; loops to not use pattern matching and instead used the &lt;code&gt;slug&lt;/code&gt; itself in both the &lt;code&gt;from&lt;/code&gt; and &lt;code&gt;to&lt;/code&gt; sections. This resulted in the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{{#get "posts" limit="all"}}
    {{#foreach posts}}
        {"from":"/{{slug}}/","to":"/blog/{{slug}}/","permanent":true},&amp;lt;br&amp;gt;
    {{/foreach}}
{{/get}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With either code segment you get, hopefully, working redirect text that you can quickly copy, paste into the file, look over, and upload.&lt;/p&gt;

&lt;p&gt;In all the journey was a bit longer to get this than shown as I started with a simple get and foreach loop showing the &lt;code&gt;title&lt;/code&gt; only before adding the &lt;code&gt;limit="all"&lt;/code&gt;, &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt;, and then fixed the output to use the &lt;code&gt;slug&lt;/code&gt; along with the entire redirect text I wanted.&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%2Fuploads%2Farticles%2Fv862pi5xcuhw91dec5f3.jpg" 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%2Fv862pi5xcuhw91dec5f3.jpg" alt="Images showing the process in a collage." width="750" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And with that hopefully it worked! Just don't forget to remove the code from your website when done. And I hope you're having a great day. &lt;/p&gt;

</description>
      <category>ghost</category>
      <category>yaml</category>
      <category>json</category>
    </item>
    <item>
      <title>Redirect YAML From Ghost Data Using JQ</title>
      <dc:creator>Kyra</dc:creator>
      <pubDate>Thu, 23 May 2024 14:57:00 +0000</pubDate>
      <link>https://dev.to/simplykyra/redirect-yaml-from-ghost-data-using-jq-3dki</link>
      <guid>https://dev.to/simplykyra/redirect-yaml-from-ghost-data-using-jq-3dki</guid>
      <description>&lt;p&gt;A bit ago I realized I needed to generate redirect text for each of my current blog posts on my Casper themed Ghost website. This seemed to be an overwhelming task but after talking it through both my husband and I came up with two potential ideas. Here is his idea that uses the data file, jq, and visual filtering that I implemented, while tired, and shared in case it helps you. &lt;/p&gt;

&lt;p&gt;Quick aside: To go over how to find the redirect section through &lt;a href="https://ghost.org" rel="noopener noreferrer"&gt;the Ghost&lt;/a&gt; interface you can check out my earlier post in this series &lt;code&gt;How to Find the Redirect Section on Your Ghost Account&lt;/code&gt;. After this one I'll share an alternative way to do this. If you are looking for my original full post you can check out &lt;a href="https://www.simplykyra.com/blog/oh-no-i-need-to-create-redirect-text-for-all-my-posts/" rel="noopener noreferrer"&gt;Oh No, I Need to Create Redirect Text for All My Posts!&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Word of warning I was tired when doing this, it was all new to me, wasn't working, and I easily got frustrated. As such it's a bit of a journey but I figured I'd share my process in case something in it I may have otherwise omitted helps you out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get the Data
&lt;/h2&gt;

&lt;p&gt;To use this method you will need to start with your website data that I got by exporting it from my website through the migration portion of my settings page. I found it by entering my domain and then typing in &lt;code&gt;/ghost/#/settings/migration&lt;/code&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%2Fuploads%2Farticles%2Fgi496wjsfo3ze8uavvem.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%2Fuploads%2Farticles%2Fgi496wjsfo3ze8uavvem.png" alt="The current data can be exported by going into the settings' migration section at /ghost/#/settings/migration. This view is from Ghost running version 5.82.3+moya." width="750" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Parse the Data
&lt;/h2&gt;

&lt;p&gt;Once I had my data I needed to extract each of my posts' slugs. We decided to use &lt;a href="https://jqlang.github.io/jq/?ref=simplykyra.com" rel="noopener noreferrer"&gt;&lt;code&gt;jq&lt;/code&gt;, a lightweight and flexible command-line JSON processor,&lt;/a&gt; to get that information but before we did that we first needed to figure out what the command itself, used to parse out that information, should be. To figure it out we opened the data and used &lt;code&gt;ctrl+f&lt;/code&gt; to look for a slug and then worked my way back up resulting in the following structure. This is the &lt;code&gt;json&lt;/code&gt; code from the Migration Export part of the Settings with only the information needed extracted:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "db": [
    {
      "data": {
    "offers": [],
        "posts": [
          {
          "slug": “foo”,
    }
]}}]}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the json structure found we next turned to &lt;a href="https://chat.openai.com/?ref=simplykyra.com" rel="noopener noreferrer"&gt;ChatGPT&lt;/a&gt; and asked it to create the &lt;code&gt;jq&lt;/code&gt; query I needed which gave me the command: &lt;code&gt;jq '.db[].data.posts[].slug' data.json&lt;/code&gt;. I used that to test out the results and further iterated through versions while hoping I was getting closer to what I wanted.&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%2Fuploads%2Farticles%2Fy9ewxryfu0sdp5iigica.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%2Fuploads%2Farticles%2Fy9ewxryfu0sdp5iigica.png" alt="Early on the questions and answers were simple." width="750" height="844"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Downhill
&lt;/h2&gt;

&lt;p&gt;The resulting &lt;code&gt;yaml&lt;/code&gt; from the command worked when uploaded to localhost but didn't work once uploaded to my main website as I had way too many redirects for the website page to load there. I next went back and forth with ChatGPT constantly trying to fix the &lt;code&gt;yaml&lt;/code&gt; resulting in, at times, decreasing the number of redirects and a 404 error. In the process I got frustrated and switched over to &lt;code&gt;json&lt;/code&gt; so I could use the pattern matching mentioned in &lt;a href="https://ghost.org/tutorials/implementing-redirects//?ref=simplykyra.com#using-regular-expressions" rel="noopener noreferrer"&gt;Ghost's Implementing redirects&lt;/a&gt; and thus switched over to wanting the &lt;code&gt;json&lt;/code&gt; output to look something more like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{"from":"^\/(slug)\/$","to":"/blog/$1","permanent":true},
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A Command
&lt;/h2&gt;

&lt;p&gt;During this process I was getting frustrated but looking back, at some point, I was using this command where each section's results were piped &lt;code&gt;|&lt;/code&gt; as input into the next section.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat simply-kyra.ghost.date.json | jq '.db[0].data.posts[] | {"from":"^/(.+)/$","to":"/blog/(.slug)","permanent":true}' | pbcopy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explained below is each section:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cat simply-kyra.ghost.date.json&lt;/code&gt;: Displays the contents of the downloaded file from Ghost.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;jq '.db[0].data.posts[]&lt;/code&gt;: Takes the file's contents and parses out the slugs for each post.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;{"from":"^/(.+)/$","to":"/blog/(.slug)","permanent":true}'&lt;/code&gt;: Converts the list of slugs to the content &lt;code&gt;string&lt;/code&gt; I want consisting of this text.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pbcopy&lt;/code&gt;: and then sends the output to my clipboard so I can paste it into my actual redirects file and upload back up to my website. Just a heads up this is only a Mac command you'll need to adjust it to something else if you're using a different computer.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Got It
&lt;/h2&gt;

&lt;p&gt;I kept having trouble with mismatched brackets and the like so I decided to simplify the automated part of this process by switching out the complicated special &lt;code&gt;string&lt;/code&gt; I wanted outputted and instead padded each slug with several dashes on the left and lots of zeros on the right. I had the idea that I could simply do a find all and replace on the results without worrying about the brackets themselves. With this change the new ChatGPT reply went something 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%2Fuploads%2Farticles%2F2xr44c09fxa3oysfnmwq.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%2Fuploads%2Farticles%2F2xr44c09fxa3oysfnmwq.png" alt="Altering my command to eliminate the frustrating bracket-related errors." width="750" height="1016"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Which resulted in the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat simply-kyra.ghost.date.json | jq -r '.db[].data.posts[] | " ---(.slug)000000"' | pbcopy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command extracts the &lt;code&gt;slug&lt;/code&gt; field from each post and appends &lt;code&gt;000000&lt;/code&gt; after it while also prefixing it with a triple dash. For example, if the input JSON contains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "db": [
    {
      "data": {
        "offers": [],
        "posts": [
          {
            "slug": "foo"
          },
          {
            "slug": "bar"
          }
        ]
      }
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command would output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---foo000000
---bar000000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then I'd do two find and replace all commands so the &lt;code&gt;000000&lt;/code&gt; is replaced with &lt;code&gt;)\/$","to":"/blog/$1","permanent":true},&lt;/code&gt; and the triple dashes are replaced with &lt;code&gt;{"from":"^\/(&lt;/code&gt; leading to these results:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{"from":"^\/(foo)\/$","to":"/blog/$1","permanent":true},
{"from":"^\/(bar)\/$","to":"/blog/$1","permanent":true},
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Warning
&lt;/h2&gt;

&lt;p&gt;During the find and replace portion I happened to notice a page title and realized the posts' section in my data file didn't just include posts but also included all of my pages thus meaning I needed to further mine my file to remove all of the page-related lines that didn't need to be redirected. Luckily I didn't have too many pages but after uploading the new file I realized I missed my about page and it was now redirecting to a location that didn't exist. That said, I'm happy it was just the one page and I was able to fix it by simply renaming the page url (and then fixing the linked menu button) and now it's all good to go... that said, while writing this I realized any previous links to my about post no longer work but at least the menu offers a simple correction for this one.&lt;/p&gt;

</description>
      <category>ghost</category>
      <category>yaml</category>
      <category>json</category>
      <category>jq</category>
    </item>
    <item>
      <title>How to Find the Redirect Section on Your Ghost Account</title>
      <dc:creator>Kyra</dc:creator>
      <pubDate>Thu, 16 May 2024 12:23:20 +0000</pubDate>
      <link>https://dev.to/simplykyra/how-to-find-the-redirect-section-on-your-ghost-account-67</link>
      <guid>https://dev.to/simplykyra/how-to-find-the-redirect-section-on-your-ghost-account-67</guid>
      <description>&lt;p&gt;A bit ago I realized I needed to generate redirect text for each of my current blog posts. Before posting about that; however, I wanted to go over redirects briefly... that said, if you are looking for the full solution &lt;em&gt;now&lt;/em&gt; you can find the original post on my website at &lt;a href="https://www.simplykyra.com/blog/oh-no-i-need-to-create-redirect-text-for-all-my-posts/" rel="noopener noreferrer"&gt;Oh No, I Need to Create Redirect Text for All My Posts!&lt;/a&gt;. Both there and below will be talk about the redirect file through &lt;a href="https://ghost.org" rel="noopener noreferrer"&gt;the Ghost&lt;/a&gt; interface.&lt;/p&gt;

&lt;p&gt;A redirect is when you want to send someone to a different URL than the one they just typed in. For me I wanted to do this back when I first migrated from Wordpress to Ghost and again when I changed all of my posts' urls to better organize my site. This meant that all of my currently set links no longer worked as they now pointed to the old location with a &lt;code&gt;404 Page not found&lt;/code&gt; error and I needed to redirect them to the new location.&lt;/p&gt;

&lt;p&gt;To do this redirect, through &lt;a href="https://ghost.org" rel="noopener noreferrer"&gt;Ghost&lt;/a&gt;, you need to find the redirect file by going to your domain and then typing in &lt;code&gt;/ghost/#/settings/labs&lt;/code&gt; immediately afterwards. In my current website, running &lt;a href="https://github.com/TryGhost/Ghost/releases/tag/v5.82.3?ref=simplykyra.com" rel="noopener noreferrer"&gt;version 5.82.3+moya&lt;/a&gt; this looks like:&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%2Fuploads%2Farticles%2Ftgrvv1h8u10rcqmjksgh.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%2Fuploads%2Farticles%2Ftgrvv1h8u10rcqmjksgh.png" alt="The settings, running version 5.82.3+moya, shows the Labs section with the beta features including Redirects below it. Here, beside Redirects, is a bolded button to upload the file and below, in green, you can download the current version." width="750" height="945"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While my localhost instance, which is still running &lt;a href="https://github.com/TryGhost/Ghost/releases/tag/v5.39.0?ref=simplykyra.com" rel="noopener noreferrer"&gt;version 5.39.0&lt;/a&gt;, it instead is a two step process that starts with the labs, in the lower right corner:&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%2Fuploads%2Farticles%2F57hvccf5uo39ms07b7ai.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%2Fuploads%2Farticles%2F57hvccf5uo39ms07b7ai.png" alt="In the older version, 5.39.0, you need to go to advanced and press Labs before you see the same thing." width="750" height="544"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And then shows the sub-options here: &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%2Fuploads%2Farticles%2Fa4lg5hp4apgq0101pejd.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%2Fuploads%2Farticles%2Fa4lg5hp4apgq0101pejd.png" alt="Though once you're in Labs it looks pretty similar to the new way." width="750" height="522"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The redirect file itself is essentially just an array &lt;code&gt;[]&lt;/code&gt; where each object is a single redirect consisting of the from, to, and whether it's permanent or not. So, in my case, if my old blog posts' urls were &lt;code&gt;domain/2017/10/16/halloween-costume-chuggington-onesie/&lt;/code&gt; and &lt;code&gt;domain/2017/11/25/make-your-own-playdough/&lt;/code&gt; the their new ones would now be &lt;code&gt;domain/halloween-costume-chuggington-onesie/&lt;/code&gt; and &lt;code&gt;domain/make-your-own-playdough/&lt;/code&gt; In this example the array would look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[{"from":"/2017/10/16/halloween-costume-chuggington-onesie/","to":"/halloween-costume-chuggington-onesie/","permanent":true},
{another redirect objects},
...
{another redirect},
{"from":"/2017/11/25/make-your-own-playdough/","to":"/make-your-own-playdough/","permanent":true}]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you download and edit the file you can upload it back to your website through the same page. If there's an error it will tell you immediately and, worse case, you can use an online &lt;code&gt;json&lt;/code&gt; editor to help find your issue. Once it's uploaded properly you can then type in the old link and you'll be redirected to the new one rather than get the old pesky &lt;code&gt;404 Page not found&lt;/code&gt; error again. &lt;/p&gt;

&lt;p&gt;Word of warning: Just be sure this file was entered correctly. You don't want to redirect a working page url to a non-working one. I did that with my about page by mistake and ended up just editing its url for a quick solution rather than figuring how to &lt;em&gt;undo&lt;/em&gt; the redirect. &lt;/p&gt;

&lt;p&gt;And with that I'll leave you with some links in case your want more information about &lt;a href="https://ghost.org/help/redirects/?ref=simplykyra.com" rel="noopener noreferrer"&gt;Ghost's documentation on redirects&lt;/a&gt; or &lt;a href="https://ghost.org/tutorials/implementing-redirects/?ref=simplykyra.com" rel="noopener noreferrer"&gt;their tutorial about Implementing redirects&lt;/a&gt;. Hope you're having a great day!&lt;/p&gt;

</description>
      <category>ghost</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Quickly Create App Icons by Resizing Your Main Image With a Bash Script</title>
      <dc:creator>Kyra</dc:creator>
      <pubDate>Thu, 09 May 2024 12:53:00 +0000</pubDate>
      <link>https://dev.to/simplykyra/quickly-create-app-icons-by-resizing-your-main-image-with-a-bash-script-3fif</link>
      <guid>https://dev.to/simplykyra/quickly-create-app-icons-by-resizing-your-main-image-with-a-bash-script-3fif</guid>
      <description>&lt;p&gt;&lt;em&gt;I just wanted to start out by saying that this is an abridged version of my &lt;a href="https://www.simplykyra.com/quickly-create-app-icons-by-resizing-your-main-image-with-a-bash-script/" rel="noopener noreferrer"&gt;original published version from June 4, 2023 that you can find on my website here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;When I first get excited about a new app idea I like to create a new project and I enjoy creating a new app icon so I'm excited seeing it on my phone and developing the idea. That said, I hate going through and resizing the image multiple times to generate all the differently sized images that Apple requires. This is made even worse if there's a minor design detail that needs to be corrected or even if I want to justify updating the icon as I have to go through the entire process all over again. &lt;/p&gt;

&lt;p&gt;Thus I needed to come up with a way to make, at least, the image resizing quicker and this script solves it! I've saved &lt;a href="https://gist.github.com/SimplyKyra/a1aaa5925a24892acc35383d2654adf2" rel="noopener noreferrer"&gt;my script in its entirety to a Github Gist which you can find here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;This script works by taking in your image file, confirming it's a square, and then resizing it to seven unique dimensions each with its filename showing its particular size as it's appended to the beginning of its name. As each dimension is dictated by it's own line (so for example the 1024 by 1024 size is created with: &lt;code&gt;magick "$1" -resize 1024x1024 "1024 - $1"&lt;/code&gt;) you can easily update the script to include new ones or remove obsolete ones. Currently the script outputs the resized image at the following seven dimensions: 1024x1024, 512x512, 256x256, 128x128, 64x64, 32x32, and 16x16.&lt;/p&gt;

&lt;p&gt;When making my app icon I try to make an app icon at least as large as the largest size I'd need so in my case the minimum would be 1024 by 1024. Once the icon is made I call my script and pass in the app icon image's filename &lt;code&gt;createAppIcons.sh myImg.jpeg&lt;/code&gt; and, once executed, all the newly resized images are in the directory with my original one. &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%2Fuploads%2Farticles%2Fd268hr0s16fxy0jitljh.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%2Fuploads%2Farticles%2Fd268hr0s16fxy0jitljh.png" alt="Image shows three windows including the terminal, finder window, and preview with all the newly created images opened in it." width="750" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With the images made I move the finder window over to Xcode and drag each individual image over to its corresponding spot in the assets app icon window.&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%2Fuploads%2Farticles%2F6vpxfpin1zk5u8d233b1.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%2Fuploads%2Farticles%2F6vpxfpin1zk5u8d233b1.png" alt="Image shows the finder window overlapping with Xcode so I can easily drag and drop each one." width="750" height="369"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And with that the app icon is ready to go... and the script is ready to speed up the process the next time I need to switch it out.&lt;/p&gt;

&lt;p&gt;Hope this helps you out and you're having a great day!&lt;/p&gt;

&lt;p&gt;That said, if you want more details about this script or even have it broken down and explained better than the &lt;a href="https://gist.github.com/SimplyKyra/a1aaa5925a24892acc35383d2654adf2" rel="noopener noreferrer"&gt;Github Gist above&lt;/a&gt; then you can check out &lt;a href="https://www.simplykyra.com/quickly-create-app-icons-by-resizing-your-main-image-with-a-bash-script/" rel="noopener noreferrer"&gt;my original and longer version of this post from June 4, 2023&lt;/a&gt; where explain it all in more detail including it's background, requirements, and all the in depth information you'd need!&lt;/p&gt;

</description>
      <category>bashscript</category>
      <category>bash</category>
      <category>xcode</category>
      <category>appicon</category>
    </item>
    <item>
      <title>Question About Large Language Models and SwiftUI</title>
      <dc:creator>Kyra</dc:creator>
      <pubDate>Thu, 02 May 2024 03:37:16 +0000</pubDate>
      <link>https://dev.to/simplykyra/question-about-large-language-models-and-swiftui-1ig8</link>
      <guid>https://dev.to/simplykyra/question-about-large-language-models-and-swiftui-1ig8</guid>
      <description>&lt;p&gt;I’m at the vague research and idea stage of an idea and figured I’d create a discussion question in case it helps anyone else. &lt;/p&gt;

&lt;p&gt;Specifically I’m wondering if anyone has looked into integrating a large language model (llm) into their Swift iOS app before? Is there a best way? Are there any awesome tutorials to do this?&lt;/p&gt;

&lt;p&gt;I’ve heard of &lt;a href="https://huggingface.co/models" rel="noopener noreferrer"&gt;Hugging Face&lt;/a&gt; and &lt;a href="https://llama.meta.com/llama3/" rel="noopener noreferrer"&gt;Meta’s Llama 3&lt;/a&gt; {&lt;a href="https://github.com/meta-llama/" rel="noopener noreferrer"&gt;github repo&lt;/a&gt;}. &lt;a href="https://youtu.be/tkZ-ajarTks?si=nEjJNUsXlc7s9gyA" rel="noopener noreferrer"&gt;I’ve also heard that Apple recently dropped corenet and openElm&lt;/a&gt; but I’m assuming there’s not a lot of information about it until WWDC in June… hopefully. That said I haven’t researched large language models before so before I delve into it too far I wanted to check if there's a &lt;em&gt;proper&lt;/em&gt; path and/or any tips and tricks that would be good to know. &lt;/p&gt;

&lt;p&gt;Thanks everyone!&lt;/p&gt;

</description>
      <category>llm</category>
      <category>swift</category>
      <category>discuss</category>
    </item>
    <item>
      <title>SwiftData: Solving Filtering by an Entity in the Predicate</title>
      <dc:creator>Kyra</dc:creator>
      <pubDate>Fri, 26 Apr 2024 04:33:54 +0000</pubDate>
      <link>https://dev.to/simplykyra/swiftdata-solving-filtering-by-an-entity-in-the-predicate-3l5h</link>
      <guid>https://dev.to/simplykyra/swiftdata-solving-filtering-by-an-entity-in-the-predicate-3l5h</guid>
      <description>&lt;p&gt;I just wanted to start out by saying that this is an abridged version of my &lt;a href="https://www.simplykyra.com/swiftdata-problems-with-filtering-by-entity-in-the-predicate/" rel="noopener noreferrer"&gt;original published version from December 15, 2023 that you can find on my website here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;When moving my apps over from &lt;code&gt;CoreData&lt;/code&gt; to &lt;code&gt;SwiftData&lt;/code&gt; I came across a problem where I wasn't able to filter my query by another entity within its predicate. Whenever I did and tried to build the project it kept compiling and compiling and would eventually fail so the time wasted waiting while trying to solve the issue was another aggravation on top of it all. &lt;/p&gt;

&lt;p&gt;To demonstrate the problem I took the &lt;a href="https://github.com/twostraws/iTour?ref=simplykyra.com" rel="noopener noreferrer"&gt;iTour&lt;/a&gt; example project from &lt;a href="https://www.hackingwithswift.com" rel="noopener noreferrer"&gt;Hacking with Swift&lt;/a&gt; and altered it a bit to showcase my problem and, eventually, the solution. &lt;/p&gt;

&lt;p&gt;In his app there are two main data models. You have destinations you can visit and each one has a list of sights you can see at that destination. So for example if you were to visit Alberta (the destination) you could visit many sights while there like: &lt;a href="https://www.banfflakelouise.com" rel="noopener noreferrer"&gt;Banff, Lake Louise&lt;/a&gt;, &lt;a href="https://tyrrellmuseum.com" rel="noopener noreferrer"&gt;Royal Tyrrell Museum&lt;/a&gt;,  and &lt;a href="https://www.wem.ca" rel="noopener noreferrer"&gt;West Edmonton Mall&lt;/a&gt;. While a &lt;code&gt;Destination&lt;/code&gt; can include multiple &lt;code&gt;Sight&lt;/code&gt;s each &lt;code&gt;Sight&lt;/code&gt; can only belong to one &lt;code&gt;Destination&lt;/code&gt;. His example didn't show my issue but I altered it to include a list of &lt;code&gt;Sight&lt;/code&gt;s that needed to be filtered by the &lt;code&gt;id&lt;/code&gt; of a &lt;code&gt;Destination&lt;/code&gt; thus recreating my problem. &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%2Fuploads%2Farticles%2Fxqlivdsd267qpk9o8e7h.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%2Fuploads%2Farticles%2Fxqlivdsd267qpk9o8e7h.png" alt="Image showing one of the errors" width="750" height="555"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The problem, once solved, was very simple. I was filtering the &lt;code&gt;Sight&lt;/code&gt; data thus I could only filter by the data model &lt;code&gt;Sight&lt;/code&gt; and no other ones. My problem came when I introduced the &lt;code&gt;Destination&lt;/code&gt;. To get around this I took the &lt;code&gt;persistentModelID&lt;/code&gt; from the &lt;code&gt;Destination&lt;/code&gt; before entering into the &lt;code&gt;Predicate&lt;/code&gt; to filter by. That worked!&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%2Fuploads%2Farticles%2F8f9msqrbbvr505avl81z.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%2Fuploads%2Farticles%2F8f9msqrbbvr505avl81z.png" alt="Image shows the filtered data in two ways." width="750" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The working code, in case you want to use it towards your solution, is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;init(sort: [SortDescriptor&amp;lt;Sight&amp;gt;], searchString: String, destination: Destination?) {
  // Make a point of grabbing 
  if let thisID = destination?.persistentModelID {
    _sights = Query(filter: #Predicate&amp;lt;Sight&amp;gt; {
      if searchString.isEmpty {
        return $0.destination?.persistentModelID == thisID
      } else {
        return $0.destination?.persistentModelID == thisID &amp;amp;&amp;amp; $0.name.localizedStandardContains(searchString)
      }
    }, sort: sort)
  } else {
    // if id is nil than I don't want ANYTHING that said you could instead return $0.name.localizedStandardContains(searchString)
    _sights = Query(filter: #Predicate&amp;lt;Sight&amp;gt; { currSight in
      return false
    }, sort: sort)
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And with that the issue was solved! If you want more information about the problem, the example, the building issues, or the solution itself you can check out my SimplyKyra website where I &lt;a href="https://www.simplykyra.com/swiftdata-problems-with-filtering-by-entity-in-the-predicate/" rel="noopener noreferrer"&gt;published the longer and original version of this post back in December of 2023&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Hope you have a great day!&lt;/p&gt;

</description>
      <category>swiftdata</category>
      <category>swift</category>
      <category>swiftui</category>
      <category>filtering</category>
    </item>
    <item>
      <title>How to Run a Bash Script From Anywhere on Your Apple Computer</title>
      <dc:creator>Kyra</dc:creator>
      <pubDate>Fri, 19 Apr 2024 12:44:59 +0000</pubDate>
      <link>https://dev.to/simplykyra/how-to-run-a-bash-script-from-anywhere-on-your-apple-computer-bak</link>
      <guid>https://dev.to/simplykyra/how-to-run-a-bash-script-from-anywhere-on-your-apple-computer-bak</guid>
      <description>&lt;p&gt;I just wanted to start out by saying that this is an abridged version of my &lt;a href="https://www.simplykyra.com/how-to-run-a-bash-script-from-anywhere-on-your-apple-computer/" rel="noopener noreferrer"&gt;original published version from February 19, 2023 that you can find on my website here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;When you run a command in your terminal the computer looks through a list of directories where the file might reside and, if found, executes it. This special list of directories is stored in the &lt;code&gt;PATH&lt;/code&gt; environment variable on your computer. If your shell goes through all of these paths, in order, and can’t find the file it then lets you know that it can’t be found before exiting. If there are two matching files it will run whichever one it comes across first.&lt;/p&gt;

&lt;p&gt;To be able to run a script from anywhere on your computer the file holding the script needs to be in one of those directories stored in the &lt;code&gt;PATH&lt;/code&gt; environment variable on your computer. So simply move your script to one of those directories! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But how do I know where that is?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To find out which directories are included in the &lt;code&gt;PATH&lt;/code&gt; environment variable simply go to a terminal and type out &lt;code&gt;echo $PATH&lt;/code&gt;. On my computer this looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❯ echo $PATH
/Users/kyra/bin /usr/local/bin 
/System/Cryptexes/App/usr/bin /usr/bin /bin 
/usr/sbin /sbin /Library/Apple/usr/bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And from that I've chosen to put all of my  scripts that I want to run from anywhere on my computer within the &lt;code&gt;/Users/kyra/bin&lt;/code&gt; directory. Then I can call it from anywhere!&lt;/p&gt;

&lt;p&gt;In my original post, that this is based on, I go into more information on the hows and whys this works including what to do if you want your script to live outside of the &lt;code&gt;PATH&lt;/code&gt; environment variable or if you want to add a new directory to it's list. You can &lt;a href="https://www.simplykyra.com/how-to-run-a-bash-script-from-anywhere-on-your-apple-computer/" rel="noopener noreferrer"&gt;check this all out here&lt;/a&gt;.  &lt;/p&gt;

&lt;p&gt;I hope you're having a great day!&lt;/p&gt;

</description>
      <category>bash</category>
      <category>bashscript</category>
      <category>terminal</category>
      <category>path</category>
    </item>
    <item>
      <title>Update to "My Custom Picker With Multi-Selection in SwiftUI" - Now With Images!</title>
      <dc:creator>Kyra</dc:creator>
      <pubDate>Fri, 12 Apr 2024 16:19:09 +0000</pubDate>
      <link>https://dev.to/simplykyra/update-to-my-custom-picker-with-multi-selection-in-swiftui-now-with-images-5d5k</link>
      <guid>https://dev.to/simplykyra/update-to-my-custom-picker-with-multi-selection-in-swiftui-now-with-images-5d5k</guid>
      <description>&lt;p&gt;I just wanted to start out by saying that this is an abridged version of my &lt;a href="https://www.simplykyra.com/update-to-my-custom-picker-with-multi-selection-in-swiftui-now-with-images/" rel="noopener noreferrer"&gt;originally published post from August 31, 2022 that you can find on my website here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It is also a continuation (part two) of &lt;a href="https://dev.to/simplykyra/how-to-make-a-custom-picker-with-multi-selection-in-swiftui-1b17"&gt;my original post&lt;/a&gt; which is also an abridged from my &lt;a href="https://www.simplykyra.com/how-to-make-a-custom-picker-with-multi-selection-in-swiftui/" rel="noopener noreferrer"&gt;originally published version from February 23, 2022 here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;After I posted my custom multipicker code someone reached out to me about having the selected items include images. I absolutely loved that idea and got to work switching the &lt;code&gt;String&lt;/code&gt; array containing the items to a &lt;code&gt;Struct&lt;/code&gt; array that could hold any possible thing you may want selectable. In this updated example I still store a &lt;code&gt;String&lt;/code&gt; in the &lt;code&gt;Struct&lt;/code&gt;, in this case holding the SF symbol name, but I could see this also including other types like &lt;code&gt;Data&lt;/code&gt; or &lt;code&gt;Image&lt;/code&gt; too.&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%2Fuploads%2Farticles%2Fvkhybe0u2gmjnhis8dvd.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%2Fuploads%2Farticles%2Fvkhybe0u2gmjnhis8dvd.png" alt=" " width="750" height="663"&gt;&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%2Fuploads%2Farticles%2Fgg26kl7ord2pb9zalspd.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%2Fuploads%2Farticles%2Fgg26kl7ord2pb9zalspd.png" alt=" " width="750" height="644"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re interested in using this updated custom control in your code I saved it, in its entirety, to &lt;a href="https://github.com/SimplyKyra/SimplyKyraBlog" rel="noopener noreferrer"&gt;my public SimplyKyraBlog GitHub repository&lt;/a&gt; and, if you want a direct link, &lt;a href="https://github.com/SimplyKyra/SimplyKyraBlog/blob/main/SwiftExamples/CustomMultiSelectionExampleWithImages" rel="noopener noreferrer"&gt;the file &lt;code&gt;CustomMultiSelectionExampleWithImages.swift&lt;/code&gt; can be found here&lt;/a&gt;. The code is also shared as &lt;a href="https://gist.githubusercontent.com/SimplyKyra/5cf6ec5da50cb937854facc572a95b82/raw/d792eab4ea4bef30846268aae77becc38f5e4583/CustomMultiSelectionExampleWithImages.swift" rel="noopener noreferrer"&gt;a Github Gist&lt;/a&gt; at the bottom of &lt;a href="https://www.simplykyra.com/update-to-my-custom-picker-with-multi-selection-in-swiftui-now-with-images/" rel="noopener noreferrer"&gt;my post from August 31, 2022&lt;/a&gt; that also includes the backstory, specific updates to the original code, and the fix to the previous issue I mentioned. &lt;/p&gt;

&lt;p&gt;Hope this helps your code and you're having a great day!&lt;/p&gt;

</description>
      <category>swift</category>
      <category>swiftui</category>
      <category>multiplatform</category>
      <category>xcode</category>
    </item>
    <item>
      <title>How I Easily Used My Custom Color in My SwiftUI Project</title>
      <dc:creator>Kyra</dc:creator>
      <pubDate>Fri, 12 Apr 2024 01:37:24 +0000</pubDate>
      <link>https://dev.to/simplykyra/how-i-easily-used-my-custom-color-in-my-swiftui-project-3k6c</link>
      <guid>https://dev.to/simplykyra/how-i-easily-used-my-custom-color-in-my-swiftui-project-3k6c</guid>
      <description>&lt;p&gt;&lt;em&gt;I just wanted to start out by saying that this is an abridged version of my &lt;a href="https://www.simplykyra.com/how-i-easily-used-my-custom-color-in-my-swiftui-project/" rel="noopener noreferrer"&gt;original published version from February 9, 2022 that you can find on my website here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;A while back I decided to procrastinate a coding conundrum by finally figuring out how to bring one of my favorite colors to my &lt;code&gt;SwiftUI&lt;/code&gt; project using &lt;a href="https://developer.apple.com/documentation/swiftui/color" rel="noopener noreferrer"&gt;the &lt;code&gt;SwiftUI.Color&lt;/code&gt; struct&lt;/a&gt;. It was so simple to do!&lt;/p&gt;

&lt;p&gt;I started out by seeing what information I'd need about the color by typing in &lt;code&gt;Color(&lt;/code&gt; and looking through the auto-complete recommendations within the resulting popup. From here I knew I needed the decimal number version of each RGB value. &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%2Fuploads%2Farticles%2F4evo5ht99mqnyt0s52is.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%2Fuploads%2Farticles%2F4evo5ht99mqnyt0s52is.png" alt="Image shows the dropdown showing how to complete the text " width="750" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With that known I next went to the &lt;a href="https://www.color-hex.com/color/60364f" rel="noopener noreferrer"&gt;Color Hex&lt;/a&gt; website and looked up my color. I then scrolled down to find the percentage used of red, green, and blue to create this color. &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%2Fuploads%2Farticles%2Fmbeufmqj4c9bz76tuqq3.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%2Fuploads%2Farticles%2Fmbeufmqj4c9bz76tuqq3.png" alt="Screenshot of the Color Hex page for #60364f" width="750" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above example the color &lt;code&gt;#60364f&lt;/code&gt; is shown in the bottom left grid to be made of 41.92% red, 23.58% green, and 34.50% blue. Once you convert the percentages into decimal and insert them into the above &lt;code&gt;Color&lt;/code&gt; struct it becomes &lt;code&gt;Color(red: 0.4192, green: 0.2358, blue: 0.3450)&lt;/code&gt;. In the following example I used both the purple color and another custom color, following the same steps, in the background modifier for two different controls.&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%2Fuploads%2Farticles%2Foxtquepiyw6o9hl42aqj.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%2Fuploads%2Farticles%2Foxtquepiyw6o9hl42aqj.png" alt="Image shows the example and source code for " width="750" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I later turned my custom color into a shared variable that lives in one spot in my code. This way if I ever rebrand I can easily change one line and I'm good to go in every spot it's used. &lt;/p&gt;

&lt;p&gt;I hope this post helps you out and if you want more information about it &lt;a href="https://www.simplykyra.com/how-i-easily-used-my-custom-color-in-my-swiftui-project/" rel="noopener noreferrer"&gt;the full version from February 9, 2022 can be found here&lt;/a&gt;. Hope you're having a great day!&lt;/p&gt;

&lt;p&gt;Have a great day!&lt;/p&gt;

</description>
      <category>swift</category>
      <category>color</category>
      <category>swiftui</category>
      <category>hexcolor</category>
    </item>
    <item>
      <title>SwiftData: Solving Fatal Errors and EXC_BAD_ACCESS While Handling Entities on Different Threads</title>
      <dc:creator>Kyra</dc:creator>
      <pubDate>Thu, 11 Apr 2024 12:26:28 +0000</pubDate>
      <link>https://dev.to/simplykyra/swiftdata-solving-fatal-errors-and-excbadaccess-while-handling-entities-on-different-threads-1dnj</link>
      <guid>https://dev.to/simplykyra/swiftdata-solving-fatal-errors-and-excbadaccess-while-handling-entities-on-different-threads-1dnj</guid>
      <description>&lt;p&gt;&lt;em&gt;I just wanted to start out by saying that this is an abridged version of my &lt;a href="https://www.simplykyra.com/swiftdata-solving-fatal-errors-and-exc_bad_access-while-handling-entities-on-different-threads/" rel="noopener noreferrer"&gt;original published version from December 22, 2023 that you can find on my website here&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Part of the back end code of one of my apps is composed of asynchronous functions that I call and then await their returned results. When moving my apps over from &lt;code&gt;CoreData&lt;/code&gt; to &lt;code&gt;SwiftData&lt;/code&gt; the data context that used to be passed into each function was dropped and I noticed it didn't act consistently anymore. The main problems were:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EXC_BAD_ACCESS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first error I had was a generalized &lt;code&gt;EXC_BAD_ACCESS (code=1, address=...)&lt;/code&gt; that showed up mainly in my entry App &lt;a class="mentioned-user" href="https://dev.to/main"&gt;@main&lt;/a&gt; struct but also popped up at various entity relationships spots all under various thread count numbers.&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%2Fuploads%2Farticles%2Ftn5fgh87c17eixeb5fkz.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%2Fuploads%2Farticles%2Ftn5fgh87c17eixeb5fkz.png" alt="Image shows the EXC_BAD_ACCESS error on a relationship" width="750" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fatal Error: Duplicate Keys&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At some point in all of this when I couldn't figure out how to fix the issue I decided to at least help mitigate it by manually saving the data context after each related entity was done being created. I figured this way if the program crashed at least the data that had been created before that point would be saved and the user wouldn't have to start back at the beginning each time. This didn't help as once I added saving, at any of the points, I got fatal errors on my entities complaining about duplicate keys.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Fatal error: Duplicate keys of type 'EntityName' were found in a Dictionary.
This usually means either that the type violates Hashable's requirements, or that members of such a dictionary were mutated after insertion.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The Solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To solve this I realized I needed to stop passing in the main data entity and instead pass in it's &lt;code&gt;PersistentIdentifier&lt;/code&gt; along with it's &lt;code&gt;ModelContext&lt;/code&gt; so it can be recreated in the asynchronous and/or problematic functions. This worked! &lt;/p&gt;

&lt;p&gt;So, for example, if I used pass in the entity directly to a function like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;private func doSomething(entity: EntityName, ...) async {
   // ... doing whatever happened to the entity
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I'd now call the new method with &lt;code&gt;doSomething(in: entity.modelContext!.container, entityID: entity.persistentModelID, ...)&lt;/code&gt; instead and the function itself would look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;private func doSomething(in container: ModelContainer, entityID: PersistentIdentifier, ...) async {
   // First recreate the main entity in it's own ModelContext
   let modelContext = ModelContext(container)
   modelContext.autosaveEnabled = false
   let entity = modelContext.model(for: entityID) as? EntityName
   if entity == nil {
      // Can't continue without entity
      // TODO: Handle any error handling and...
      return
   }

   // ... doing whatever happened to the entity

   do {
      try modelContext.save()
   } catch {
      // It can't be saved
      // TODO: Handle any error handling and...
      return
   }
   // Success!
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the different data context used in my problematic asynchronous methods both my fatal and bad access errors are gone!&lt;/p&gt;

&lt;p&gt;If you want more information about how I solved this along with a quick stop in concurrency check out &lt;a href="https://www.simplykyra.com/swiftdata-solving-fatal-errors-and-exc_bad_access-while-handling-entities-on-different-threads/" rel="noopener noreferrer"&gt;my original version published in December 22, 2023&lt;/a&gt; on my main website.&lt;/p&gt;

&lt;p&gt;Have a great day!&lt;/p&gt;

</description>
      <category>swift</category>
      <category>swiftdata</category>
      <category>concurrency</category>
    </item>
  </channel>
</rss>
