<?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: Dev Jam</title>
    <description>The latest articles on DEV Community by Dev Jam (@dev-jam).</description>
    <link>https://dev.to/dev-jam</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%2Forganization%2Fprofile_image%2F2747%2F2e97e7cf-12d0-4e60-a07b-d4ccdefa558d.png</url>
      <title>DEV Community: Dev Jam</title>
      <link>https://dev.to/dev-jam</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dev-jam"/>
    <language>en</language>
    <item>
      <title>Snapshot Testing in Swift 📸</title>
      <dc:creator>Roberto Frontado</dc:creator>
      <pubDate>Wed, 07 Oct 2020 17:11:42 +0000</pubDate>
      <link>https://dev.to/dev-jam/snapshot-testing-in-swift-3e7k</link>
      <guid>https://dev.to/dev-jam/snapshot-testing-in-swift-3e7k</guid>
      <description>&lt;p&gt;Speed up your UI tests by doing Snapshot Tests in Swift, they are an easy way to ensure that the UI doesn’t change unexpectedly when you modify your code.&lt;/p&gt;

&lt;p&gt;Check out this article to learn how to start leveraging the benefit of Snapshot Testing in your project 👍&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/dev-jam/snapshot-testing-in-swift-9d52cbec075c" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--M1vK0QKO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/fit/c/96/96/1%2ASZPhmRPIXN4fDFoC3YJlWA.jpeg" alt="Roberto Frontado"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/dev-jam/snapshot-testing-in-swift-9d52cbec075c" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Snapshot Testing in Swift 📸. Snapshot tests are an easy way to… | by Roberto Frontado | Dev Jam | Sep, 2020 | Medium&lt;/h2&gt;
      &lt;h3&gt;Roberto Frontado ・ &lt;time&gt;Oct 7, 2020&lt;/time&gt; ・ 6 min read
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KBvj_QRD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/medium_icon-90d5232a5da2369849f285fa499c8005e750a788fdbf34f5844d5f2201aae736.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>swift</category>
      <category>xcode</category>
      <category>testing</category>
      <category>ios</category>
    </item>
    <item>
      <title>XcodeGen — Collaboration Made Easy</title>
      <dc:creator>Roberto Frontado</dc:creator>
      <pubDate>Mon, 20 Jul 2020 08:11:35 +0000</pubDate>
      <link>https://dev.to/dev-jam/xcodegen-collaboration-made-easy-1cj1</link>
      <guid>https://dev.to/dev-jam/xcodegen-collaboration-made-easy-1cj1</guid>
      <description>&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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2Amjtv3txAKlkUPB7643Ekuw.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%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2Amjtv3txAKlkUPB7643Ekuw.gif" alt="Illustration from [https://github.com/yonaskolb/XcodeGen](https://github.com/yonaskolb/XcodeGen)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have ever worked in a team, I’m sure that many times, you’ve encountered conflicts with the .xcodeproj file while merging your code.&lt;/p&gt;

&lt;p&gt;Solving this kind of conflict is not always easy, because the .xcodeproj file is not human — readable, especially if you are adding and removing lots of files, modifying your project configuration, or editing your schemes…&lt;/p&gt;

&lt;p&gt;In the past, I used a simple solution to this problem, adding this line to the .gitAttribute file.&lt;/p&gt;

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

\*.pbxproj merge=union


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

&lt;/div&gt;
&lt;p&gt;This solution merges both sides automatically, so you don’t get to see the conflict. It works most of the time if you are in a small team. However, it is definitely not bulletproof nor scalable.&lt;/p&gt;

&lt;p&gt;Wouldn’t it be better if you had a more reliable tool to solve this kind of problem? Here, XcodeGen comes to the rescue.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Is XcodeGen, and How Do You Use It?
&lt;/h2&gt;

&lt;p&gt;XcodeGen is a command-line tool written in Swift. It generates your Xcode project using your folder structure and a project spec, which contains all the information necessary to generate a project, such as targets, schemes, settings.&lt;/p&gt;

&lt;p&gt;First, you need to install XcodeGen. You can do this using &lt;strong&gt;homebrew:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

brew install xcodegen


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

&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;There are other ways of installing XcodeGen. You can check them out in the official documentation&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Next, you need to create a file called &lt;code&gt;project.yml&lt;/code&gt; in the project root folder. This file will contain the project configuration.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;XcodeGen supports YAML and JSON files, but in this article, we use YAML because it is considered to be more human-readable and is the standard format for configuration files.&lt;/p&gt;
&lt;/blockquote&gt;


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



&lt;p&gt;To generate the project, run the following command:&lt;/p&gt;

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

xcodegen


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

&lt;/div&gt;
&lt;p&gt;As simple as that, you have now generated an Xcode project!&lt;/p&gt;

&lt;p&gt;In projects, you also have a unit tests target. It can be added to the project.yml file as follows:&lt;/p&gt;


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



&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Next time you merge code, and it modifies the project configuration, you’ll need to generate your project again by running &lt;code&gt;xcodegen&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That’s not all, though. Let’s make things more interesting.&lt;/p&gt;

&lt;p&gt;Imagine you are building a modular application, with two 2 frameworks: one to handle the authentication and one to see your user profile. Your project.yml file will look like this:&lt;/p&gt;


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


&lt;p&gt;As you can see, this file starts to grow in size, making it harder to wrap our heads around it. Thankfully, XcodeGen allows us to split our configuration into multiple files, so it easier to manage. For example:&lt;/p&gt;


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



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



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


&lt;p&gt;Now generate the Xcode project again, and you will see that everything is working.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I have placed all frameworks in a folder called Subprojects, and their configuration files in another folder called Subspecs. You can organize them however you want.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can also add build scripts. This is how you can add a script to run SwiftLint:&lt;/p&gt;


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


&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; When working with git, &lt;strong&gt;remember&lt;/strong&gt; to add these lines to the .gitignore file because you don’t want to commit those files anymore:&lt;/p&gt;

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

\## Ignore project files as we generate them with xcodegen ([https://github.com/yonaskolb/XcodeGen](https://github.com/yonaskolb/XcodeGen))  
\*.xcodeproj  
\*.xcworkspace


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

&lt;/div&gt;
&lt;p&gt;You can find the source code used for this article here:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&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%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/robertofrontado" rel="noopener noreferrer"&gt;
        robertofrontado
      &lt;/a&gt; / &lt;a href="https://github.com/robertofrontado/xcodegen-sample" rel="noopener noreferrer"&gt;
        xcodegen-sample
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      XcodeGen sample project
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;Implementing a tool such asXcodeGen can seem overwhelming at first because it changes how you configure your project. However, I can assure you that you will reap its benefits from day one — especially if you work in a modular application and a large team.&lt;/p&gt;

&lt;p&gt;Moreover, another benefit is that since you need to specify the entire project configuration through code, you &lt;strong&gt;automatically&lt;/strong&gt; &lt;strong&gt;document&lt;/strong&gt; &lt;strong&gt;your project configuration&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;While XcodeGen is my preferred tool, here are some alternatives you can try and see which one suits you best:&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&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%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/tuist" rel="noopener noreferrer"&gt;
        tuist
      &lt;/a&gt; / &lt;a href="https://github.com/tuist/tuist" rel="noopener noreferrer"&gt;
        tuist
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Tuist's CLI
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&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%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/igor-makarov" rel="noopener noreferrer"&gt;
        igor-makarov
      &lt;/a&gt; / &lt;a href="https://github.com/igor-makarov/xcake" rel="noopener noreferrer"&gt;
        xcake
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      🍰 Describe Xcode projects in a human readable format and (re)generate one on demand.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&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%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/lyptt" rel="noopener noreferrer"&gt;
        lyptt
      &lt;/a&gt; / &lt;a href="https://github.com/lyptt/struct" rel="noopener noreferrer"&gt;
        struct
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


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