<?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: Ceri-anne</title>
    <description>The latest articles on DEV Community by Ceri-anne (@ceri_anne_dev).</description>
    <link>https://dev.to/ceri_anne_dev</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%2F46692%2Fc80238d6-92b1-499e-a9ab-94916e26b321.jpeg</url>
      <title>DEV Community: Ceri-anne</title>
      <link>https://dev.to/ceri_anne_dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ceri_anne_dev"/>
    <language>en</language>
    <item>
      <title>Second career dev - the scary bit</title>
      <dc:creator>Ceri-anne</dc:creator>
      <pubDate>Sun, 27 Aug 2023 15:24:46 +0000</pubDate>
      <link>https://dev.to/ceri_anne_dev/second-career-dev-the-scary-bit-2fkg</link>
      <guid>https://dev.to/ceri_anne_dev/second-career-dev-the-scary-bit-2fkg</guid>
      <description>&lt;p&gt;Learning to code and changing career was one of the best things I've ever done. I love being a developer and thoroughly enjoy my job. But, early on there were some lonely days, so I thought I'd write about my experience in case it helps anyone else going through it.&lt;/p&gt;

&lt;p&gt;When I changed career, I left a company and job I'd been doing for a loooong time. I left behind team mates I loved, where we had years of memories and in-jokes. I knew my job inside out, was a subject matter expert, and a line-manager.&lt;/p&gt;

&lt;p&gt;Starting in a new company as a junior developer was wonderful. It was a dream come true and I'd worked really hard to get there. It was also really freeing. I had no baggage or office politics to worry about, no line reports or responsibilities, and I had the space and support I needed to focus on learning and progressing as a developer.&lt;/p&gt;

&lt;p&gt;But at the same time it was scary, and lonely. I knew nothing! Ok...maybe not nothing, but that's how it felt. I felt exposed and vulnerable. Getting our of your comfort zone is scary but rewarding. Going from "go-to person" to "junior newbie" is a leap of faith.&lt;/p&gt;

&lt;p&gt;So what can you do to get through it?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Accept&lt;/strong&gt; it is going to be a bit scary! It means you're out of your comfort zone and that's where you'll grow and learn. &lt;/li&gt;
&lt;li&gt;Don't do it in your own. &lt;strong&gt;Reach out&lt;/strong&gt; to your line manager, your team, and your network. Be open and honest about how you feel. If you're too scared and worried you won't learn effectively.&lt;/li&gt;
&lt;li&gt;Don't have a &lt;strong&gt;network&lt;/strong&gt;? Find one or make one! Find friendly coding meet-ups, use social media/online forums, reach out to other new developers in your organisation. It really helps to talk to others at the same stage of their careers/coding journey.&lt;/li&gt;
&lt;li&gt;Try not to worry about making &lt;strong&gt;mistakes&lt;/strong&gt;. Everyone makes them, especially early on, and they'll make you a better developer in the long run. A good team will catch you and help you fix it.&lt;/li&gt;
&lt;li&gt;Don't forget about your &lt;strong&gt;transferable skills&lt;/strong&gt;. You may feel like a code newbie but you will bring a load of transferrable skills to your 2nd career. It's your super power! Software Development is much more than just writing code and you'll use those skills more and more as your new career develops.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document&lt;/strong&gt; what you learn - whether it's writing a blog or just keeping a note of what you've learned each day/week. It'll help consolidate your learning and you'll be amazed after a few months to look back and see how far you've come.&lt;/li&gt;
&lt;li&gt;Keep a note of any nice &lt;strong&gt;feedback&lt;/strong&gt; you get. When you're having a bad day (and there will be some!) you can read through the good stuff and give yourself a boost. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's been 7 years since I switched careers and I'm now a Senior Developer. I still feel scared somedays but then I guess that's how I know I'm still learning and growing! :D &lt;/p&gt;

</description>
      <category>career</category>
      <category>beginners</category>
    </item>
    <item>
      <title>iOS ScrollView - make it snappy!</title>
      <dc:creator>Ceri-anne</dc:creator>
      <pubDate>Sun, 27 Aug 2023 14:14:52 +0000</pubDate>
      <link>https://dev.to/ceri_anne_dev/ios-scrollview-make-it-snappy-49p5</link>
      <guid>https://dev.to/ceri_anne_dev/ios-scrollview-make-it-snappy-49p5</guid>
      <description>&lt;p&gt;In iOS17, Swift UI has some new modifiers which make it easier to implement snap behaviour in scrollviews.&lt;/p&gt;

&lt;h2&gt;
  
  
  ScrollView
&lt;/h2&gt;

&lt;p&gt;Let's make a simple scrollview:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;

&lt;span class="kd"&gt;import&lt;/span&gt; &lt;span class="kt"&gt;SwiftUI&lt;/span&gt;

&lt;span class="kd"&gt;struct&lt;/span&gt; &lt;span class="kt"&gt;ContentView&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;some&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;ScrollView&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;horizontal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;LazyHStack&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kt"&gt;ForEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;..&amp;lt;&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
                    &lt;span class="kt"&gt;TileView&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}}&lt;/span&gt;

&lt;span class="kd"&gt;struct&lt;/span&gt; &lt;span class="kt"&gt;TileView&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nv"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;some&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;foregroundStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;white&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;frame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;background&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;purple&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clipShape&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;cornerRadius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cp"&gt;#Preview {&lt;/span&gt;
    &lt;span class="kt"&gt;ContentView&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Reminder:&lt;/strong&gt; Using &lt;code&gt;LazyHStack&lt;/code&gt; instead of &lt;code&gt;HStack&lt;/code&gt; means the tiles are only loaded when needed and not upfront. &lt;/p&gt;

&lt;p&gt;This gives us a simple horizontal scrollview:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fgv24vqcky9ncwa1zedni.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fgv24vqcky9ncwa1zedni.gif" alt="Basic ScrollView"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The default behaviour is free scrolling, and the view stays wherever it finishes after scrolling:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fa6p17ug0kc7kee4u2s40.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fa6p17ug0kc7kee4u2s40.gif" alt="Default small scroll"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Paging Behaviour
&lt;/h2&gt;

&lt;p&gt;We can add the modifier &lt;code&gt;.scrollTargetBehavior(.paging)&lt;/code&gt; to our scrollview:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;

&lt;span class="kd"&gt;struct&lt;/span&gt; &lt;span class="kt"&gt;ContentView&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;some&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;ScrollView&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;horizontal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;LazyHStack&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kt"&gt;ForEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;..&amp;lt;&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
                    &lt;span class="kt"&gt;TileView&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scrollTargetBehavior&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;paging&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This means the scrollview will scroll one screen width at a time and snaps nicely to each page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fa49zozzmhvd23jj1ajsq.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fa49zozzmhvd23jj1ajsq.gif" alt="ScrollView with Paging modifier"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  View Aligned Behaviour
&lt;/h2&gt;

&lt;p&gt;Instead of using paging, we can use the modifier &lt;code&gt;.scrollTargetBehavior(.viewAligned)&lt;/code&gt; along with &lt;code&gt;.scrollTargetLayout()&lt;/code&gt; on the view we want to be used for settling.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;

&lt;span class="kd"&gt;struct&lt;/span&gt; &lt;span class="kt"&gt;ContentView&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;some&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;ScrollView&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;horizontal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;LazyHStack&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kt"&gt;ForEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;..&amp;lt;&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
                    &lt;span class="kt"&gt;TileView&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scrollTargetLayout&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scrollTargetBehavior&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;viewAligned&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This gives us the the following behaviour where the scrollview snaps to the individual views:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F9isdwln71an8tapdc4jp.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F9isdwln71an8tapdc4jp.gif" alt="Scroll View with View Aligned Modifier"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Notes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;This can all be applied to vertical scrollviews as well. I've just used horizontal ones here as examples.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;These modifiers are only available in iOS 17 / Xcode 15&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;More information and options to experiment with in Apple's docs &lt;a href="https://developer.apple.com/documentation/swiftui/scrolltargetbehavior" rel="noopener noreferrer"&gt;https://developer.apple.com/documentation/swiftui/scrolltargetbehavior&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>swift</category>
      <category>mobile</category>
      <category>swiftui</category>
      <category>ios</category>
    </item>
    <item>
      <title>iOS Simulator Screen Recording</title>
      <dc:creator>Ceri-anne</dc:creator>
      <pubDate>Sun, 27 Aug 2023 13:29:40 +0000</pubDate>
      <link>https://dev.to/ceri_anne_dev/ios-simulator-screen-recording-4gme</link>
      <guid>https://dev.to/ceri_anne_dev/ios-simulator-screen-recording-4gme</guid>
      <description>&lt;p&gt;Recording a video of the simulator used to be a bit clunky - either using the command line via &lt;code&gt;simctl&lt;/code&gt; or other software such as Quicktime. Thankfully it's now much easier!&lt;/p&gt;

&lt;h2&gt;
  
  
  Screen Recording in Xcode
&lt;/h2&gt;

&lt;p&gt;Above the simulator is a toolbar which includes a button to take a screenshot:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UOtqirHc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p98x4env7h36byqwpl4e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UOtqirHc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p98x4env7h36byqwpl4e.png" alt="Xcode Simulator Toolbar with screenshot button" width="800" height="96"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;File&lt;/code&gt; menu there is an option to &lt;code&gt;Record Screen&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R5EdZO2I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o23hs8alrmcml5nevtma.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R5EdZO2I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o23hs8alrmcml5nevtma.png" alt="Record screen option" width="348" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Selecting this option, or pressing &lt;code&gt;Command + R&lt;/code&gt;, starts recording the simulator. The screenshot button changes to a stop recording button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TnIlh6T0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ezgd88f2uhfmhedq2rnq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TnIlh6T0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ezgd88f2uhfmhedq2rnq.png" alt="Xcode Simulator Toolbar with screenshot button" width="800" height="95"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you've finished the task you want to record, simply tap the stop button. A preview will show on screen briefly and then the recording will be saved to your Desktop as an &lt;code&gt;mp4&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--amCOyU2d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s1351dyrb8fddli0w4ul.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--amCOyU2d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s1351dyrb8fddli0w4ul.png" alt="Screen Recording Preview" width="474" height="602"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional Options
&lt;/h2&gt;

&lt;p&gt;While the preview is on screen you can also right click and choose other options including &lt;code&gt;Save as Animated GIF&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nY2sN7Sv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lbir6rkwp5un6lnuj3o2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nY2sN7Sv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lbir6rkwp5un6lnuj3o2.png" alt="Screen Recording Preview Menu" width="574" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(&lt;strong&gt;TIP&lt;/strong&gt;: to play the GIF, locate in Finder and then press the spacebar).&lt;/p&gt;

</description>
      <category>ios</category>
      <category>xcode</category>
      <category>swift</category>
    </item>
    <item>
      <title>Navigation Link - Swift UI iOS 16</title>
      <dc:creator>Ceri-anne</dc:creator>
      <pubDate>Wed, 21 Jun 2023 19:01:02 +0000</pubDate>
      <link>https://dev.to/ceri_anne_dev/navigation-link-swift-ui-ios-16-2n5o</link>
      <guid>https://dev.to/ceri_anne_dev/navigation-link-swift-ui-ios-16-2n5o</guid>
      <description>&lt;p&gt;Ever been using NavigationLink inside a NavigationView and got this deprecation warning in Xcode?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fukb1q3zpi9nx7z1gdylb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fukb1q3zpi9nx7z1gdylb.png" alt="Xcode deprecation warning - 'init(destination:isActive:label:)' was deprecated in iOS 16.0: use NavigationLink(value🏷️) inside a NavigationStack or NavigationSplitView"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here's how to fix it!&lt;/p&gt;

&lt;h2&gt;
  
  
  Before
&lt;/h2&gt;

&lt;p&gt;Let's start with an iOS15 example of a &lt;code&gt;NavigationView&lt;/code&gt; with a &lt;code&gt;.stack&lt;/code&gt; NavigationViewStyle, and a NavigationLink which links to &lt;code&gt;SecondView&lt;/code&gt; when the button is pressed. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;

&lt;span class="kd"&gt;import&lt;/span&gt; &lt;span class="kt"&gt;SwiftUI&lt;/span&gt;

&lt;span class="kd"&gt;struct&lt;/span&gt; &lt;span class="kt"&gt;ContentView&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;@State&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;showSecondView&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Bool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;some&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;NavigationView&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;VStack&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kt"&gt;Button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;showSecondView&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="kt"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Show Second View"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="kt"&gt;NavigationLink&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="nv"&gt;destination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;SecondView&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                    &lt;span class="nv"&gt;isActive&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;$showSecondView&lt;/span&gt;
                &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="kt"&gt;EmptyView&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;navigationViewStyle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;struct&lt;/span&gt; &lt;span class="kt"&gt;SecondView&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;some&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;VStack&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello! I'm the second View"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  After
&lt;/h2&gt;

&lt;p&gt;To update for iOS 16 and remove the deprecation warning we can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Change &lt;code&gt;NavigationView&lt;/code&gt; to &lt;code&gt;NavigationStack&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Change &lt;code&gt;NavigationLink&lt;/code&gt; to &lt;code&gt;navigationDestination&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Remove &lt;code&gt;.navigationViewStyle(.stack)&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;

&lt;span class="kd"&gt;struct&lt;/span&gt; &lt;span class="kt"&gt;ContentView&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;@State&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;showSecondView&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;Bool&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="nv"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;some&lt;/span&gt; &lt;span class="kt"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;NavigationStack&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;VStack&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kt"&gt;Button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;showSecondView&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="kt"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Show Second View"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;navigationDestination&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                 &lt;span class="nv"&gt;isPresented&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;$showSecondView&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                     &lt;span class="kt"&gt;SecondView&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                 &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Hope that helps anyone else who has hit the same warning!&lt;/p&gt;

</description>
      <category>swift</category>
      <category>ios</category>
      <category>xcode</category>
      <category>swiftui</category>
    </item>
    <item>
      <title>Nevertheless, Ceri-anne Coded</title>
      <dc:creator>Ceri-anne</dc:creator>
      <pubDate>Thu, 07 Mar 2019 19:12:48 +0000</pubDate>
      <link>https://dev.to/ceri_anne_dev/nevertheless-ceri-anne-coded--238n</link>
      <guid>https://dev.to/ceri_anne_dev/nevertheless-ceri-anne-coded--238n</guid>
      <description>&lt;h2&gt;
  
  
  I began to code because...
&lt;/h2&gt;

&lt;p&gt;I wanted to change career and I love maths, problem solving and tech. I started learning to code in January 2016 teaching myself Ruby and then did a 14 week evening course learning HTML, CSS, JavaScript, PHP and SQL. I began my first role as a junior developer in November 2016 and now code in Swift/iOS.&lt;/p&gt;

&lt;h2&gt;
  
  
  I’m excited about..
&lt;/h2&gt;

&lt;p&gt;Contributing to the Dev.to app. I was nervous about contributing to open source for the first time but have loved getting involved!&lt;/p&gt;

&lt;h2&gt;
  
  
  I want to brag about...
&lt;/h2&gt;

&lt;p&gt;Successfully changing career at 37 years old and learning a whole load of new things when I had thought I was too old. It was scary starting again but it was totally worth it!&lt;/p&gt;

&lt;p&gt;My advice for allies to support women who code is...&lt;/p&gt;

&lt;p&gt;Listen to them, mentor them and sponsor them! :)&lt;/p&gt;

</description>
      <category>wecoded</category>
      <category>career</category>
      <category>womenintech</category>
    </item>
    <item>
      <title>How to make a command line tool in Xcode</title>
      <dc:creator>Ceri-anne</dc:creator>
      <pubDate>Sat, 01 Sep 2018 18:37:14 +0000</pubDate>
      <link>https://dev.to/ceri_anne_dev/how-to-make-a-command-line-tool-in-xcode-2f81</link>
      <guid>https://dev.to/ceri_anne_dev/how-to-make-a-command-line-tool-in-xcode-2f81</guid>
      <description>&lt;p&gt;MacOS command line tools can be handy for automating tasks and they're also a great way to have more fun with Swift, so here's how to set one up:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating the project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1) Create a new Xcode project, select MacOS and command line&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FPicture1-300x216.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FPicture1-300x216.png" alt="Create an Xcode project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) Give your app a name, and make sure Swift is selected as the Language&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-15.59.05-300x216.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-15.59.05-300x216.png" alt="Name the app"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3) Click Next and choose where to save your project.&lt;/p&gt;

&lt;p&gt;You now have an Xcode command line project! The &lt;code&gt;main.swift&lt;/code&gt; file is         where Xcode will look to run your code, similar to the main function in Java or C# or the AppDelegate in iOS. There will be a &lt;code&gt;“Hello World”&lt;/code&gt; print statement there already.&lt;/p&gt;

&lt;p&gt;Under Products there is an executable file called &lt;code&gt;CommandLineTool&lt;/code&gt; which is red. This is the executable file created when we build the project. from the command line. It’s red because we haven’t built it yet&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.00.10-300x159.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.00.10-300x159.png" alt="Folder in Finder"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4) Build and run the project. Th&lt;span&gt;e CommandLineTool product will now change to black and the following output should display in the output window&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FPicture3-300x97.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FPicture3-300x97.png" alt="Output window"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Running from the Command Line&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1) In File Inspector (⌥⌘1), check where the CommandLineTool Product is being saved. It will be a long location ending in &lt;code&gt;/Build/Products/Debug/CommandLineTool&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2) Navigate to this &lt;code&gt;Debug&lt;/code&gt; folder and run theCommandLineTool by typing in &lt;code&gt;./CommandLineTool&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;./CommandLineTool
Hello, World!


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;3) Try going into Xcode and changing the program slightly, for example:&lt;/p&gt;


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



&lt;p&gt;4) Build in Xcode (don’t miss this step out otherwise the executable won't update). There’s no need to run in Xcode - just build ( ⌘ B ).&lt;/p&gt;

&lt;p&gt;5) Go back to terminal and re-run to see if it works:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;./CommandLineTool
Hello, World! This is my &lt;span class="nb"&gt;command &lt;/span&gt;line tool


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;This location isn't very convenient to to run our tool from so we can move it to somewhere better. &lt;/p&gt;

&lt;p&gt;6) In either Finder or Terminal, navigate to the CommandLineTool folder and create a folder called bin. Your CommandLineTool folder should now look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.04.47-300x101.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.04.47-300x101.png" alt="Folder"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;7) In Xcode, go to the CommandLineTool target and Build Phase and add a new Run Script Phase&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.06.00-300x82.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.06.00-300x82.png" alt="Run Script Phase"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;8) Add the following script &lt;code&gt;cp ${BUILT_PRODUCTS_DIR}/CommandLineTool ${PROJECT_DIR}/bin&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.06.56-300x91.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.06.56-300x91.png" alt="Script Code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will copy the executable when we build our project and paste it in our bin folder.&lt;/p&gt;

&lt;p&gt;9) Build the project and you should see the executable in your bin directory&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.07.33-300x121.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.07.33-300x121.png" alt="Executable in bin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;10) Navigate to the project folder in terminal and you can run your CommandLineTool by typing in bin/CommandLineTool&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;bin/CommandLineTool
Hello, World!


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Adding arguments&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command Line&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1) We can pass arguments in to our program when we run it from the command line. We just need to add a space and then the arguments. Let's pass in a name:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;bin/CommandLineTool Ceri
Hello, World! This is my &lt;span class="nb"&gt;command &lt;/span&gt;line tool


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;We're not doing anything with this argument so nothing different happens.&lt;/p&gt;

&lt;p&gt;2) Update &lt;code&gt;main.swift&lt;/code&gt; to print out any arguments we pass in:&lt;/p&gt;


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



&lt;p&gt;3) Build and run from the command line, passing in arguments separated by spaces&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;


&lt;span class="nv"&gt;$ &lt;/span&gt;bin/CommandLineTool Hello 23
&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"bin/CommandLineTool"&lt;/span&gt;, &lt;span class="s2"&gt;"Hello"&lt;/span&gt;, &lt;span class="s2"&gt;"23"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
Hello, World! This is my &lt;span class="nb"&gt;command &lt;/span&gt;line tool


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Note that the first argument is the program name, and the arguments we passed in are 2nd and 3rd. Also, all arguments are strings.&lt;/p&gt;

&lt;p&gt;4) Amend the code to this:&lt;/p&gt;


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



&lt;p&gt;5) Run again and you'll see each argument printed out&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;bin/CommandLineTool Hello 23
Hello
23
Hello, World! This is my &lt;span class="nb"&gt;command &lt;/span&gt;line tool


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Xcode&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1) To add an argument in Xcode, click on Edit Scheme&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-15.35.22-300x171.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-15.35.22-300x171.png" alt="Edit Scheme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) In Run/Arguments add an argument to &lt;code&gt;Arguments Passed On Launch&lt;/code&gt; and click &lt;code&gt;Close&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.14.39-300x168.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.14.39-300x168.png" alt="Arguments"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3) Now when you run the project in Xcode you'll see the arguments printed out in the Output window&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.15.21-300x143.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/http%3A%2F%2Fceri-anne.co.uk%2Fwp-content%2Fuploads%2F2018%2F08%2FScreen-Shot-2018-08-31-at-16.15.21-300x143.png" alt="Output window"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it! Now you can develop as much Swift code as you like as normal. Just kick it all off in main.swift. Happy Swifting :)&lt;/p&gt;

&lt;p&gt;The code for this project is on Github: &lt;a href="https://github.com/Ceri-anne/CommandLineTool" rel="noopener noreferrer"&gt;https://github.com/Ceri-anne/CommandLineTool&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was first published on my blog here:&lt;/em&gt; &lt;br&gt;
&lt;a href="https://ceri-anne.co.uk/how-to-make-a-command-line-macos-tool-in-xcode" rel="noopener noreferrer"&gt;https://ceri-anne.co.uk/how-to-make-a-command-line-macos-tool-in-xcode&lt;/a&gt;&lt;/p&gt;

</description>
      <category>swift</category>
      <category>xcode</category>
      <category>macos</category>
    </item>
    <item>
      <title>How to Fork and contribute to a Github repo</title>
      <dc:creator>Ceri-anne</dc:creator>
      <pubDate>Fri, 31 Aug 2018 10:25:59 +0000</pubDate>
      <link>https://dev.to/ceri_anne_dev/how-to-fork-and-contribute-to-a-github-repo-5bfp</link>
      <guid>https://dev.to/ceri_anne_dev/how-to-fork-and-contribute-to-a-github-repo-5bfp</guid>
      <description>&lt;p&gt;Found a cool project on Github you would like to contribute to? Here’s how to fork the repo, keep it up to date and make a pull request.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FORK THE REPO&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Click 'Fork' in the original repo&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvlfy5pq38pnfle4q0xq2.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvlfy5pq38pnfle4q0xq2.png" alt="Fork" width="768" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will create a forked version in your own Github account so you have your own copy of the repo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CLONE THE FORKED REPO&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1) In your forked repo, click the Clone or download button&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%2Fur9hg17zwm18czdl6xpw.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%2Fur9hg17zwm18czdl6xpw.png" alt="Clone or Download button" width="288" height="69"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) Copy the git address&lt;/p&gt;

&lt;p&gt;3) In terminal, navigate to a folder you want to save the repo then enter git clone followed by the copied git address and hit enter&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
$ git clone &amp;lt;your-repo-address&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You now have a local version of your forked repo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;KEEP YOUR FORK UP TO DATE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can work on your forked version of the project completely separately from the original, but if you want to keep your version up to date then you need to link yours to the original by adding it as an &lt;code&gt;upstream&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Set up (only need to do once):&lt;/p&gt;

&lt;p&gt;1) In the original repo, click on Clone or download and copy the original repo address&lt;/p&gt;

&lt;p&gt;2) In terminal, cd into your project folder&lt;/p&gt;

&lt;p&gt;3) Type &lt;code&gt;git remote add upstream&lt;/code&gt;, paste in the original repo address and hit Enter&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git remote add upstream &amp;lt;original-repo-address&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update:&lt;/p&gt;

&lt;p&gt;1) To update the upstream branches:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git fetch upstream

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This fetches all the changes made in the original repo.&lt;/p&gt;

&lt;p&gt;2) Update your local master:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git pull upstream master

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This pulls the upstream changes into your local master branch.&lt;/p&gt;

&lt;p&gt;3) Then git push to your remote repo&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git push

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This updates your forked remote repo with the changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SUBMIT A PULL REQUEST&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once you have made changes to your fork, you can request for those changes to be merged into the original project.&lt;/p&gt;

&lt;p&gt;1) Click on New pull request&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%2F0xmw6sxwuqp4p70bd175.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%2F0xmw6sxwuqp4p70bd175.png" alt="New pull request" width="490" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) On the compare changes page, check the base fork is the original repo and the head fork is your repo with the correct branch selected&lt;/p&gt;

&lt;p&gt;3) Add a title and description&lt;/p&gt;

&lt;p&gt;4) Allow edits from maintainers will be checked. If you're not happy with this then de-select&lt;/p&gt;

&lt;p&gt;5) Click Create pull request&lt;/p&gt;

&lt;p&gt;Then it's up to the maintainers of the original repo to ask questions, request changes or merge it in! 🤞🏼&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article was first published on my blog here:&lt;/em&gt; &lt;br&gt;
&lt;a href="https://ceri-anne.co.uk/working-with-a-forked-git-repo" rel="noopener noreferrer"&gt;https://ceri-anne.co.uk/working-with-a-forked-git-repo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
    </item>
    <item>
      <title>Dynamically adding CSS to webviews in Swift </title>
      <dc:creator>Ceri-anne</dc:creator>
      <pubDate>Sun, 26 Nov 2017 15:25:33 +0000</pubDate>
      <link>https://dev.to/ceri_anneblog/dynamically-adding-css-to-webviews-in-swift-223</link>
      <guid>https://dev.to/ceri_anneblog/dynamically-adding-css-to-webviews-in-swift-223</guid>
      <description>

&lt;p&gt;&lt;em&gt;This article was first published here &lt;a href="https://www.ceri-anne.co.uk/dynamically-add-css-to-webviews-in-swift"&gt;https://www.ceri-anne.co.uk/dynamically-add-css-to-webviews-in-swift&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This week, I needed to figure out how to dynamically add css to a webView in iOS and it was much easier than I thought it would be.&lt;/p&gt;

&lt;p&gt;All you need to do is make use of the webViewdidFinish function in the WKNavigationDelegate and evaluateJavaScript&lt;/p&gt;


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

&lt;p&gt;This code will change the background colour of the webpage you are displaying to red.&lt;/p&gt;

&lt;p&gt;To show how this works, I created a simple sample app with a series of buttons with colour choices on:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pMnWJjCE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://ceri-anne.co.uk/wp-content/uploads/2017/11/view-169x300.png" class="article-body-image-wrapper"&gt;&lt;img class="size-medium wp-image-166 aligncenter" src="https://res.cloudinary.com/practicaldev/image/fetch/s--pMnWJjCE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://ceri-anne.co.uk/wp-content/uploads/2017/11/view-169x300.png" alt="" width="169" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clicking on any of the buttons takes you to a webView which displays &lt;a href="http://www.google.co.uk"&gt;www.google.co.uk&lt;/a&gt; but the background colour of the webpage changes depending on the button chosen. So if you click on green you're taken to this page:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FM0E-3Vh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://ceri-anne.co.uk/wp-content/uploads/2017/11/webView-169x300.png" class="article-body-image-wrapper"&gt;&lt;img class="size-medium wp-image-165 aligncenter" src="https://res.cloudinary.com/practicaldev/image/fetch/s--FM0E-3Vh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://ceri-anne.co.uk/wp-content/uploads/2017/11/webView-169x300.png" alt="" width="169" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To do this, in the ViewController I added an IBAction which performs the segue when a button is tapped. The button text is then passed through to the WebViewController:&lt;/p&gt;


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

&lt;p&gt;In the WebViewController there is a function getHexColour which determines the hex code colour based on the colour set in the segue.&lt;/p&gt;

&lt;p&gt;Then in webViewDidFinish I created the css and JavaScript and applied that to the webView using the evaluateJavascript function:&lt;/p&gt;


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

&lt;p&gt;Here's a link to the sample project code: &lt;a href="https://github.com/Ceri-anne/WebViewCss"&gt;&lt;/a&gt;&lt;a href="https://github.com/Ceri-anne/WebViewCss"&gt;https://github.com/Ceri-anne/WebViewCss&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;


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