<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="https://blog.mazur.me/feed.xml" rel="self" type="application/atom+xml" /><link href="https://blog.mazur.me/" rel="alternate" type="text/html" /><updated>2019-05-12T01:58:21+00:00</updated><id>https://blog.mazur.me/feed.xml</id><title type="html">blog.mazur.me</title><subtitle>Karol S. Mazur's blog about iOS software development.</subtitle><author><name>Karol S. Mazur</name></author><entry><title type="html">How to get Playground Driven Development working with Carthage</title><link href="https://blog.mazur.me/playground-driven-development-and-carthage/" rel="alternate" type="text/html" title="How to get Playground Driven Development working with Carthage" /><published>2019-02-09T00:00:00+00:00</published><updated>2019-02-09T00:00:00+00:00</updated><id>https://blog.mazur.me/playground-driven-development-and-carthage</id><content type="html" xml:base="https://blog.mazur.me/playground-driven-development-and-carthage/">&lt;p&gt;I introduced &lt;a href=&quot;https://www.pointfree.co/episodes/ep21-playground-driven-development&quot;&gt;Playground Driven Development&lt;/a&gt; on the last project I worked on. It sped up my development and forced me to write view controllers in a decoupled way. But before I was able to reap the benefits of &lt;abbr title=&quot;Playground Driven Development&quot;&gt;PDD&lt;/abbr&gt; I hit a roadblock: Xcode Playgrounds kept throwing a &lt;code class=&quot;highlighter-rouge&quot;&gt;Couldn't look up symbols&lt;/code&gt; error, because it couldn’t see &lt;a href=&quot;https://www.github.com/Carthage/Carthage&quot;&gt;Carthage&lt;/a&gt;-built dependencies. Here’s how to fix this issue.&lt;/p&gt;

&lt;h2 id=&quot;identifying-the-problem&quot;&gt;Identifying the problem&lt;/h2&gt;

&lt;p&gt;Initially I wasn’t sure what the source of my Playgrounds problem was, so I made a &lt;a href=&quot;https://github.com/ksm/Habits&quot;&gt;sample &lt;abbr title=&quot;Playground Driven Development&quot;&gt;PDD&lt;/abbr&gt; project&lt;/a&gt; without Carthage. Next I installed Carthage and added a single dependency&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;. This reproduced the problem:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2019-02-09-playground-driven-development-and-carthage-001.png&quot; alt=&quot;Screenshot of Xcode Playgrounds with the couldn't lookup symbols error&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;fixing-the-couldnt-look-up-symbols-issue&quot;&gt;Fixing the &lt;em&gt;couldn’t look up symbols&lt;/em&gt; issue&lt;/h2&gt;

&lt;p&gt;I knew Playgrounds were missing some symbols, and I knew this was Carthage related. It became clear that Carthage supplied dependencies weren’t being seen by Playgrounds. What wasn’t so obvious to me is how to fix this issue in a way that wouldn’t require any kind of Xcode project restructuring.&lt;/p&gt;

&lt;p&gt;I reached out to the iOS community with the sample project that reproduced the problem, and it turned out that &lt;a href=&quot;https://github.com/loganmoseley&quot;&gt;Logan Moseley&lt;/a&gt; was having the same problem. Within a day Logan figured out the &lt;a href=&quot;/assets/2019-02-09-playground-driven-development-and-carthage-logan-fix.png&quot;&gt;simple fix&lt;/a&gt; I was searching for. Thank you Logan! Here are the steps:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Select Xcode → Project Settings → Targets → your main AppFramework target&lt;/li&gt;
  &lt;li&gt;Click on the Build Phases tab&lt;/li&gt;
  &lt;li&gt;Add a Copy Files phase&lt;/li&gt;
  &lt;li&gt;Select Products Directory as the Destination&lt;/li&gt;
  &lt;li&gt;Drag all Carthage-supplied frameworks in from the project navigator’s frameworks group&lt;/li&gt;
  &lt;li&gt;Clean and re-build the project, open the project playground and start playing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here’s how the new Copy Files phase should look:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2019-02-09-playground-driven-development-and-carthage-003.png&quot; alt=&quot;Screenshot of Xcode project target settings that fix the Carthage Playground Driven Development issue&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We’re done. Playground Driven Development with Xcode and Carthage should now work. 💫&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/2019-02-09-playground-driven-development-and-carthage-002.png&quot; alt=&quot;Screenshot of Xcode Playgrounds working with Carthage after applying the fix&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;footnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot;&gt;
      &lt;p&gt;The &lt;a href=&quot;https://github.com/ksm/Habits/tree/master&quot;&gt;master&lt;/a&gt; branch has a self-contained Xcode project with working &lt;abbr title=&quot;Playground Driven Development&quot;&gt;PDD&lt;/abbr&gt;. The &lt;a href=&quot;https://github.com/ksm/Habits/tree/carthage&quot;&gt;carthage&lt;/a&gt; branch installs Carthage and shows the problem (you still have to run &lt;code class=&quot;highlighter-rouge&quot;&gt;carthage bootstrap&lt;/code&gt;). The fix is on &lt;a href=&quot;https://github.com/ksm/Habits/tree/carthage-fix&quot;&gt;carthage-fix&lt;/a&gt;. &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;</content><author><name>Karol S. Mazur</name></author><summary type="html">I introduced Playground Driven Development on the last project I worked on. It sped up my development and forced me to write view controllers in a decoupled way. But before I was able to reap the benefits of PDD I hit a roadblock: Xcode Playgrounds kept throwing a Couldn't look up symbols error, because it couldn’t see Carthage-built dependencies. Here’s how to fix this issue.</summary></entry><entry><title type="html">Tracking dependencies with DEPENDENCIES.md</title><link href="https://blog.mazur.me/DEPENDENCIES.md/" rel="alternate" type="text/html" title="Tracking dependencies with DEPENDENCIES.md" /><published>2019-02-03T00:00:00+00:00</published><updated>2019-02-03T00:00:00+00:00</updated><id>https://blog.mazur.me/DEPENDENCIES.md</id><content type="html" xml:base="https://blog.mazur.me/DEPENDENCIES.md/">&lt;p&gt;A growing list of third-party libraries is something most development projects have to deal with it. On many projects it can be hard to figure out why a certain dependency was added, or whether it still makes sense to keep it. We can track dependencies through a &lt;code class=&quot;highlighter-rouge&quot;&gt;DEPENDENCIES.md&lt;/code&gt; document just like we track changes via a &lt;code class=&quot;highlighter-rouge&quot;&gt;CHANGELOG.md&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;writing-a-dependencies-document&quot;&gt;Writing a dependencies document&lt;/h2&gt;

&lt;p&gt;There needs to be a good reason for why a dependency gets added to a project. That reason is what we need to write down.&lt;/p&gt;

&lt;p&gt;Here’s an example:&lt;/p&gt;

&lt;script src=&quot;https://gist.github.com/ksm/9b717002c16156b06a695f4d67ed2d7a.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;The above example shows how we can differentiate between different types of dependencies. As an added benefit we can have a a nice overview of what licenses our dependencies use.&lt;/p&gt;

&lt;p&gt;This is a technique I’ve used for a few years on a past project, and it saved a lot of my time when re-evaluating whether some dependencies should be removed.&lt;/p&gt;

&lt;h2 id=&quot;further-reading&quot;&gt;Further reading&lt;/h2&gt;

&lt;p&gt;The above pattern is a distant relative of Lightweight Architectural Decisions. What this boils down to is we want to track the reasoning behind our decisions, regardless of whether they affect the architecture or a dependency. This reasoning is also best kept by committing it to the project repository such that it sits right next to our code.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.thoughtworks.com/radar/techniques/lightweight-architecture-decision-records&quot;&gt;Lightweight Architecture Decision Records&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions&quot;&gt;Documenting Architecture Decisions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Feb 7, 2019 update&lt;/strong&gt;: Artsy has their dependency process documented and out in the open. It’s a great read. Of note is how the team at Artsy decides whether a dependency should go through the Artsy RFC process. Thank you to &lt;a href=&quot;https://twitter.com/orta&quot;&gt;Orta Therox&lt;/a&gt; for bringing this to my attention.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/artsy/README/blob/master/playbooks/dependencies.md&quot;&gt;Adding a Dependency Playbook&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Feb 12, 2019 update&lt;/strong&gt;: This post got &lt;a href=&quot;https://twitter.com/iOSDevWeekly/status/1095397358433640453&quot;&gt;featured&lt;/a&gt; in a &lt;a href=&quot;https://twitter.com/seanallen_dev/status/1095002921253593088&quot;&gt;few&lt;/a&gt; &lt;a href=&quot;https://twitter.com/swiftdevmnts/status/1096490331934216192&quot;&gt;places&lt;/a&gt;. Thank you!&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://iosdevweekly.com/issues/390#1O9CXcY&quot;&gt;iOS Dev Weekly #390&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://youtu.be/g99P3baA1s0&quot;&gt;Swift News #45&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://andybargh.com/swiftdevelopments-170/&quot;&gt;Swift Developments #170&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Karol S. Mazur</name></author><summary type="html">A growing list of third-party libraries is something most development projects have to deal with it. On many projects it can be hard to figure out why a certain dependency was added, or whether it still makes sense to keep it. We can track dependencies through a DEPENDENCIES.md document just like we track changes via a CHANGELOG.md.</summary></entry><entry><title type="html">Hello, World!</title><link href="https://blog.mazur.me/hello-world/" rel="alternate" type="text/html" title="Hello, World!" /><published>2019-01-05T00:00:00+00:00</published><updated>2019-01-05T00:00:00+00:00</updated><id>https://blog.mazur.me/hello-world</id><content type="html" xml:base="https://blog.mazur.me/hello-world/">&lt;p&gt;I’ve always put off creating a blog, but no more. Hello, World! I imagine this blog will mostly be about software development (for the iOS platform especially, so Swift, Xcode, UIKit, and so on). Then again, who knows - I’m not putting any constraints on this blog, so lets see where this journey takes me.&lt;/p&gt;</content><author><name>Karol S. Mazur</name></author><summary type="html">I’ve always put off creating a blog, but no more. Hello, World! I imagine this blog will mostly be about software development (for the iOS platform especially, so Swift, Xcode, UIKit, and so on). Then again, who knows - I’m not putting any constraints on this blog, so lets see where this journey takes me.</summary></entry></feed>