<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Me and Mark Publishing</title>
    <link>https://www.meandmark.com/</link>
    <description>Recent content on Me and Mark Publishing</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 05 Jan 2026 18:26:18 -0500</lastBuildDate>
    <atom:link href="https://www.meandmark.com/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Jujutsu Version Control: Show Bookmark Changes</title>
      <link>https://www.meandmark.com/posts/jj-show-bookmark-changes/</link>
      <pubDate>Mon, 05 Jan 2026 18:26:18 -0500</pubDate>
      <guid>https://www.meandmark.com/posts/jj-show-bookmark-changes/</guid>
      <description>&lt;p&gt;To see a list of the changes that are part of a bookmark&amp;rsquo;s change, run the &lt;code&gt;jj log&lt;/code&gt; command with the following options:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;code&gt;-r&lt;/code&gt; flag&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;ancestors&lt;/code&gt; function, supplying the name of the bookmark in parentheses&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The following command shows the changes for a bookmark named &lt;code&gt;trunk&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj log -r ancestors(trunk)&#xA;&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    <item>
      <title>Jujutsu Version Control: Using Github</title>
      <link>https://www.meandmark.com/posts/jj-github/</link>
      <pubDate>Wed, 06 Aug 2025 13:26:48 -0400</pubDate>
      <guid>https://www.meandmark.com/posts/jj-github/</guid>
      <description>&lt;p&gt;When working with version control you usually have your project in a remote repository using a service like GitHub, GitLab, or Bitbucket. This article shows how to put your Jujutsu repo on GitHub and push changes to GitHub. Most of the material in this article also applies to services like GitLab and Bitbucket.&lt;/p&gt;&#xA;&lt;h2 id=&#34;create-a-github-repository&#34; class=&#34;relative group&#34;&gt;Create a GitHub Repository &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-a-github-repository&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;If you have not created a repository for your project on GitHub, you must do so. Sign into GitHub and create a new repo.&lt;/p&gt;&#xA;&lt;h2 id=&#34;putting-your-jujutsu-repository-on-github&#34; class=&#34;relative group&#34;&gt;Putting Your Jujutsu Repository on GitHub &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#putting-your-jujutsu-repository-on-github&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;You must perform the following steps to put your Jujutsu repository on GitHub:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Add a remote branch for the GitHub repo.&lt;/li&gt;&#xA;&lt;li&gt;Set a bookmark for the Jujutsu repo.&lt;/li&gt;&#xA;&lt;li&gt;Push the Jujutsu repo&amp;rsquo;s changes to GitHub.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;add-a-remote-branch&#34; class=&#34;relative group&#34;&gt;Add a Remote Branch &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-a-remote-branch&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Run the &lt;code&gt;jj git remote add&lt;/code&gt; command to add a remote branch. Supply the name of the remote branch and the URL of the GitHub repo.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj git remote add origin https://github.com/GitHubAccount/RepoName.git&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Replace &lt;code&gt;GitHubAccount&lt;/code&gt; with your GitHub username. Replace &lt;code&gt;RepoName&lt;/code&gt; with the name of your GitHub repo.&lt;/p&gt;&#xA;&lt;h3 id=&#34;set-a-bookmark-for-the-jujutsu-repo&#34; class=&#34;relative group&#34;&gt;Set a Bookmark for the Jujutsu repo &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#set-a-bookmark-for-the-jujutsu-repo&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To put your Jujutsu repo on GitHub, you must create a bookmark and point it to a change in your repo. A Jujutsu bookmark is similar to a git branch. Run the &lt;code&gt;jj bookmark set&lt;/code&gt; command to set a bookmark. Supply the name you want for the bookmark, add the &lt;code&gt;--allow-backwards&lt;/code&gt; and &lt;code&gt;-r&lt;/code&gt; options, and supply a change ID.&lt;/p&gt;&#xA;&lt;p&gt;In most cases you should point the bookmark to the most recent change you made. Run the &lt;code&gt;jj status&lt;/code&gt; command to check if the working copy is empty. The following output indicates an empty working copy:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;The working copy has no changes.&#xA;Working copy  (@) : tuovlrqq bca1068a (empty) (no description set)&#xA;Parent commit (@-): mqyvuonk e42670a9 Add section on creating a GitHub repo.&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If the working copy is not empty, point the bookmark to the working copy by passing &lt;code&gt;@&lt;/code&gt; as the change ID. If the working copy is empty, point the bookmark to the working copy&amp;rsquo;s parent commit by passing &lt;code&gt;@-&lt;/code&gt; as the change ID.&lt;/p&gt;&#xA;&lt;p&gt;The following command sets a &lt;code&gt;trunk&lt;/code&gt; bookmark for an empty working copy:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj bookmark set trunk --allow-backwards -r @-&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After setting the bookmark the first time, you can omit the &lt;code&gt;--allow-backwards&lt;/code&gt; option when setting that bookmark in the future.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj bookmark set trunk -r @-&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;push-changes-to-github&#34; class=&#34;relative group&#34;&gt;Push Changes to GitHub &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#push-changes-to-github&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Run the &lt;code&gt;jj git push&lt;/code&gt; command to push the changes from your Jujutsu repo to GitHub. Supply the &lt;code&gt;--allow-new&lt;/code&gt; and &lt;code&gt;-b&lt;/code&gt; options along with the name of the bookmark. The &lt;code&gt;--allow-new&lt;/code&gt; option allows creating new bookmarks, which you need to do the first time you push.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj git push --allow-new -b trunk&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you don&amp;rsquo;t supply the &lt;code&gt;-b&lt;/code&gt; argument, Jujutsu issues a warning about the working copy commit becoming immutable.&lt;/p&gt;&#xA;&lt;p&gt;After pushing a bookmark the first time, you can run the &lt;code&gt;jj git push&lt;/code&gt; command without any options.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj git push&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Unfortunately you have to set the bookmark every time you push. If you run the &lt;code&gt;jj git push&lt;/code&gt; command to push to the &lt;code&gt;trunk&lt;/code&gt; bookmark without resetting the bookmark, Jujutsu tells you the bookmark matches and there are no changes to push.&lt;/p&gt;&#xA;&lt;h2 id=&#34;looking-for-a-jujutsu-gui-client&#34; class=&#34;relative group&#34;&gt;Looking for a Jujutsu GUI Client? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#looking-for-a-jujutsu-gui-client&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;If so, I&amp;rsquo;m developing &lt;a href=&#34;https://checksimsoftware.com/jjewel&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Jjewel&lt;/a&gt;, a native Mac app that provides a GUI for Jujutsu. Use Jjewel to perform the most common version control tasks and spend less time entering Terminal commands.&lt;/p&gt;&#xA;&lt;p&gt;Go to the &lt;a href=&#34;https://checksimsoftware.com/jjewel&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Jjewel site&lt;/a&gt; to learn more about the app and download it.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Jujutsu Version Control: Change Basics</title>
      <link>https://www.meandmark.com/posts/jj-changes/</link>
      <pubDate>Tue, 05 Aug 2025 13:26:37 -0400</pubDate>
      <guid>https://www.meandmark.com/posts/jj-changes/</guid>
      <description>&lt;p&gt;When using Jujutsu you spend a lot of time working with changes. A change in a Jujutsu repository involves the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a new change.&lt;/li&gt;&#xA;&lt;li&gt;Make changes to your project.&lt;/li&gt;&#xA;&lt;li&gt;Describe the change.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;creating-a-change&#34; class=&#34;relative group&#34;&gt;Creating a Change &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#creating-a-change&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Run the &lt;code&gt;jj new&lt;/code&gt; command to create a change.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj new&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After creating a change, you can make changes in your project, such as adding, editing, and removing code.&lt;/p&gt;&#xA;&lt;h2 id=&#34;describing-a-change&#34; class=&#34;relative group&#34;&gt;Describing a Change &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#describing-a-change&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Run the &lt;code&gt;jj describe&lt;/code&gt; command to describe the change you&amp;rsquo;re making. The fastest way to describe a change is to use the &lt;code&gt;-m&lt;/code&gt; option and enter the description.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj describe -m &amp;#34;Change description&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you omit the &lt;code&gt;-m&lt;/code&gt; option,&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj describe&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;A text editor opens for you to describe the change. Using a text editor is a better option for longer descriptions that span multiple paragraphs. The &lt;a href=&#34;https://www.meandmark.com/posts/jj-setup&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;article on setting up Jujutsu&lt;/a&gt; has a section on setting the text editor to use for describing changes. The Jujutsu documentation also &lt;a href=&#34;https://jj-vcs.github.io/jj/latest/config/#editor&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;has instructions on setting the text editor&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;ending-a-change&#34; class=&#34;relative group&#34;&gt;Ending a Change &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#ending-a-change&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;End a change by running the &lt;code&gt;jj new&lt;/code&gt; command to create a new change.&lt;/p&gt;&#xA;&lt;h2 id=&#34;seeing-what-changed&#34; class=&#34;relative group&#34;&gt;Seeing What Changed &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#seeing-what-changed&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;To see what changed in a given change, run the &lt;code&gt;jj show&lt;/code&gt; command and supply a change ID. The following command shows what has changed in the working copy:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj show @&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The output from the &lt;code&gt;jj show&lt;/code&gt; command looks similar to the following:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Commit ID: 7c99cf278a679aacf6444c5e251fea341fa8f440&#xA;Change ID: zxxkyukrxnuskrpvspwxxxtkwuuqltuy&#xA;Author   : Mark &amp;lt;mark@example.com&amp;gt; (2025-07-07 19:04:31)&#xA;Committer: Mark &amp;lt;mark@example.com&amp;gt; (2025-07-07 19:04:31)&#xA;&#xA;    Use a split view for the repo view. &#xA;    The sidebar has a list of changes. &#xA;    Selecting a change shows its details.&#xA;&#xA;Modified regular file RepoView.swift:&#xA;    ...&#xA;   9    9: &#xA;  10   10: struct RepoView: View {&#xA;  11   11:     @Binding var repo: Repo&#xA;       12:     @State private var selection: Change? = nil&#xA;  12   13:     &#xA;  13   14:     var body: some View {&#xA;  14   15:         NavigationSplitView {&#xA;  14   16:             ChangeList(repo: $repo)&#xA;       16: , selection: $selection)&#xA;       17:                 .navigationDestination(item: $selection) { selection in&#xA;       18:                     ChangeView(change: $selection.safeBinding(defaultValue: selection))&#xA;       19:                 }&#xA;  15   20:                 .onAppear {&#xA;  16   21:                     repo.loadChanges()&#xA;  17   22:                 }&#xA;       23:         } detail: {&#xA;       24:             Text(&amp;#34;Select a change to view its contents.&amp;#34;)&#xA;  17   25:         }&#xA;  18   26:     }&#xA;  19   27: }&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The start of the output shows the same information the &lt;code&gt;jj log&lt;/code&gt; command shows for a change: commit hash, change ID, author, and description.&lt;/p&gt;&#xA;&lt;p&gt;The remainder of the output lists the files that changed and what changed in each file. You can&amp;rsquo;t see what changed in the sample output because the text has the same color. The &lt;code&gt;jj show&lt;/code&gt; command uses text color to indicate what changed. Additions have green text. Deletions have red text.&lt;/p&gt;&#xA;&lt;h2 id=&#34;abandoning-a-change&#34; class=&#34;relative group&#34;&gt;Abandoning a Change &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#abandoning-a-change&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Suppose you make a change, decide your change doesn&amp;rsquo;t work, and you don&amp;rsquo;t want to store it in the repo. How do you abandon the change?&lt;/p&gt;&#xA;&lt;p&gt;Run the &lt;code&gt;jj abandon&lt;/code&gt; command. If you don&amp;rsquo;t supply a change ID,&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj abandon&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The working copy&amp;rsquo;s change is abandoned. To abandon an older change, supply the change ID as the argument to the &lt;code&gt;jj abandon&lt;/code&gt; command.&lt;/p&gt;&#xA;&lt;p&gt;Be careful when abandoning a change because you lose work when abandoning a change. Creating small changes ensures you don&amp;rsquo;t mistakenly lose a lot of work.&lt;/p&gt;&#xA;&lt;h2 id=&#34;looking-for-a-jujutsu-gui-client&#34; class=&#34;relative group&#34;&gt;Looking for a Jujutsu GUI Client? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#looking-for-a-jujutsu-gui-client&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;If so, I&amp;rsquo;m developing &lt;a href=&#34;https://checksimsoftware.com/jjewel&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Jjewel&lt;/a&gt;, a native Mac app that provides a GUI for Jujutsu. Use Jjewel to perform the most common version control tasks and spend less time entering Terminal commands.&lt;/p&gt;&#xA;&lt;p&gt;Go to the &lt;a href=&#34;https://checksimsoftware.com/jjewel&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Jjewel site&lt;/a&gt; to learn more about the app and download it.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Jujutsu Version Control: Repositories</title>
      <link>https://www.meandmark.com/posts/jj-repos/</link>
      <pubDate>Mon, 04 Aug 2025 13:26:28 -0400</pubDate>
      <guid>https://www.meandmark.com/posts/jj-repos/</guid>
      <description>&lt;p&gt;In this article, you will learn how to create a Jujutsu repository, view the contents of a repository, and view the current repository status.&lt;/p&gt;&#xA;&lt;h2 id=&#34;creating-a-jujutsu-repository&#34; class=&#34;relative group&#34;&gt;Creating a Jujutsu Repository &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#creating-a-jujutsu-repository&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;To use Jujutsu you must create a repository to track the files in your project. Run the &lt;code&gt;jj git init&lt;/code&gt; command to create a repository. Currently Jujutsu uses git as the backend for repos so you have to include &lt;code&gt;git&lt;/code&gt; in the command.&lt;/p&gt;&#xA;&lt;p&gt;If you are also using git in your project, use the &lt;code&gt;--colocate&lt;/code&gt; option. Colocating the Jujutsu repo means the Jujutsu and git repos share a working copy. Existing tools that work with git, like text editors and IDEs, will see the changes you make to the project. If you commit from one of these tools, the commit also appears in your Jujutsu repo.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj git init --colocate RepoName&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you are not using git, you can omit the &lt;code&gt;--colocate&lt;/code&gt; option.&lt;/p&gt;&#xA;&lt;p&gt;The Jujutsu repository is in a &lt;code&gt;.jj&lt;/code&gt; folder inside the project folder.&lt;/p&gt;&#xA;&lt;h2 id=&#34;viewing-repository-contents&#34; class=&#34;relative group&#34;&gt;Viewing Repository Contents &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#viewing-repository-contents&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Run the &lt;code&gt;jj log&lt;/code&gt; command, which you can shorten to &lt;code&gt;jj&lt;/code&gt;, to view the contents of a Jujutsu repo.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj log&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The contents of a new Jujutsu repo look similar to the following output:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;@  powyprrv mark@example.com 2025-07-25 15:19:42 7320284b&#xA;│  (empty) (no description set)&#xA;◆  zzzzzzzz root() 00000000&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;There are two changes in this output. The first change takes up the first two lines. The &lt;code&gt;@&lt;/code&gt; indicates this change is the working copy, the current change. The &lt;code&gt;powyprrv&lt;/code&gt; is the change ID that uniquely identifies the change. A change&amp;rsquo;s ID never changes.&lt;/p&gt;&#xA;&lt;p&gt;Some Jujutsu commands take a change ID as an argument. The first characters of the change ID appear as a different color in the log. Those characters are enough to uniquely identify the change. This means you can type only those characters in a command instead of typing the whole change ID.&lt;/p&gt;&#xA;&lt;p&gt;After the change ID is the change author&amp;rsquo;s email address, followed by the timestamp of the change. The &lt;code&gt;7320284b&lt;/code&gt; is the commit hash. The commit hash can change. Most of the time you can ignore the commit hash.&lt;/p&gt;&#xA;&lt;p&gt;The second line shows the description of the change. A new repo is empty with no description.&lt;/p&gt;&#xA;&lt;p&gt;The third line shows the second change, which is the repo&amp;rsquo;s root change. The diamond on the left side indicates the change is immutable. The root change has no author and no timestamp.&lt;/p&gt;&#xA;&lt;h2 id=&#34;viewing-the-current-repository-status&#34; class=&#34;relative group&#34;&gt;Viewing the Current Repository Status &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#viewing-the-current-repository-status&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Run the &lt;code&gt;jj status&lt;/code&gt; command, which you can shorten to &lt;code&gt;jj st&lt;/code&gt;, to view the current status of the repo.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj status&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The status of a new Jujutsu repo looks similar to the following output:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;The working copy has no changes.&#xA;Working copy  (@) : powyprrv 7320284b (empty) (no description set)&#xA;Parent commit (@-): zzzzzzzz 00000000 (empty) (no description set)&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If the working copy has changes, the output shows the files that were changed.&lt;/p&gt;&#xA;&lt;p&gt;The status output shows the working copy and the parent commit. You can supply the working copy to Jujutsu commands by typing &lt;code&gt;@&lt;/code&gt; and supply the parent commit to Jujutsu commands by typing &lt;code&gt;@-&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The status output for both changes includes the change ID, commit hash, and a description of the change. The &lt;code&gt;(empty)&lt;/code&gt; text indicates an empty change. A newly created Jujutsu repo has no real changes so the working copy is empty until you make changes in your project.&lt;/p&gt;&#xA;&lt;h2 id=&#34;looking-for-a-jujutsu-gui-client&#34; class=&#34;relative group&#34;&gt;Looking for a Jujutsu GUI Client? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#looking-for-a-jujutsu-gui-client&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;If so, I&amp;rsquo;m developing &lt;a href=&#34;https://checksimsoftware.com/jjewel&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Jjewel&lt;/a&gt;, a native Mac app that provides a GUI for Jujutsu. Use Jjewel to perform the most common version control tasks and spend less time entering Terminal commands.&lt;/p&gt;&#xA;&lt;p&gt;Go to the &lt;a href=&#34;https://checksimsoftware.com/jjewel&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Jjewel site&lt;/a&gt; to learn more about the app and download it.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Jujutsu Version Control: Setup</title>
      <link>https://www.meandmark.com/posts/jj-setup/</link>
      <pubDate>Fri, 01 Aug 2025 13:24:37 -0400</pubDate>
      <guid>https://www.meandmark.com/posts/jj-setup/</guid>
      <description>&lt;p&gt;This article is the first in a series of articles introducing the &lt;a href=&#34;https://github.com/jj-vcs/jj&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Jujutsu version control system&lt;/a&gt;. This article covers the following topics involved with setting up Jujutsu:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Installing Jujutsu&lt;/li&gt;&#xA;&lt;li&gt;Setting the author for commits&lt;/li&gt;&#xA;&lt;li&gt;Setting the text editor to use for commit messages&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;installing-jujutsu&#34; class=&#34;relative group&#34;&gt;Installing Jujutsu &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#installing-jujutsu&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The first step to using Jujutsu is to install it. The Jujutsu documentation &lt;a href=&#34;https://jj-vcs.github.io/jj/latest/install-and-setup/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;lists ways to install Jujutsu&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The easiest way to install Jujutsu is to download a prebuilt binary and copy the &lt;code&gt;jj&lt;/code&gt; binary file to a desired location. The Jujutsu developers include binaries for Linux, Mac, and Windows. I installed the binary at &lt;code&gt;/usr/local/bin&lt;/code&gt; on my Mac.&lt;/p&gt;&#xA;&lt;h2 id=&#34;setting-the-author-for-commits&#34; class=&#34;relative group&#34;&gt;Setting the Author for Commits &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#setting-the-author-for-commits&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;To get Jujutsu to show your name as the author of changes you make, run the &lt;code&gt;jj config set&lt;/code&gt; command and use the &lt;code&gt;--user&lt;/code&gt; option. Set the user name and email address.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj config set --user user.name &amp;#34;Your Name&amp;#34;&#xA;jj config set --user user.email &amp;#34;your.name@example.com&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can also set the user name in Jujutsu&amp;rsquo;s &lt;code&gt;cargo.toml&lt;/code&gt; configuration file. On Mac the &lt;code&gt;cargo.toml&lt;/code&gt; file is located at the following path:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;~/.config/jj&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Press Cmd-Shift-Dot to show hidden files in the Finder and locate the &lt;code&gt;cargo.toml&lt;/code&gt; file.&lt;/p&gt;&#xA;&lt;p&gt;Add the following text to the &lt;code&gt;cargo.toml&lt;/code&gt; file and supply your name and email address:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[user]&#xA;name = &amp;#34;Your Name&amp;#34;&#xA;email = &amp;#34;your.name@example.com&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;setting-the-editor-for-commit-messages&#34; class=&#34;relative group&#34;&gt;Setting the Editor for Commit Messages &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#setting-the-editor-for-commit-messages&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Run the &lt;code&gt;jj config set&lt;/code&gt; command to set the text editor to use for commit messages. Add the &lt;code&gt;--user&lt;/code&gt; option. Enter &lt;code&gt;ui.editor&lt;/code&gt; and supply the name of the editor.&lt;/p&gt;&#xA;&lt;p&gt;For a Terminal editor like Vim or Emacs, put the name in quotes. For a GUI editor, add a space and &lt;code&gt;-w&lt;/code&gt; after the name.&lt;/p&gt;&#xA;&lt;p&gt;The following example sets the editor to VS Code:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;jj config set --user ui.editor &amp;#34;code -w&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The Windows version of VS Code has the name &lt;code&gt;code.cmd&lt;/code&gt; instead of &lt;code&gt;code&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can also set the editor in the &lt;code&gt;config.toml&lt;/code&gt; file. Add the following text to set the editor to BBEdit:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[ui]&#xA;editor = &amp;#34;bbedit -w&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;looking-for-a-jujutsu-gui-client&#34; class=&#34;relative group&#34;&gt;Looking for a Jujutsu GUI Client? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#looking-for-a-jujutsu-gui-client&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;If so, I&amp;rsquo;m developing &lt;a href=&#34;https://checksimsoftware.com/jjewel&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Jjewel&lt;/a&gt;, a native Mac app that provides a GUI for Jujutsu. Use Jjewel to perform the most common version control tasks and spend less time entering Terminal commands.&lt;/p&gt;&#xA;&lt;p&gt;Go to the &lt;a href=&#34;https://checksimsoftware.com/jjewel&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Jjewel site&lt;/a&gt; to learn more about the app and download it.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Dealing with the config is undefined Error in an Ash Database Migration</title>
      <link>https://www.meandmark.com/posts/config-func-undefined-ash-database-migration/</link>
      <pubDate>Fri, 08 Nov 2024 13:57:52 -0500</pubDate>
      <guid>https://www.meandmark.com/posts/config-func-undefined-ash-database-migration/</guid>
      <description>&lt;p&gt;I recently created an Ash app, created the Ash domain and resources, and ran the &lt;code&gt;mix ash.codegen&lt;/code&gt; to create a database migration. When I ran the command, I got the following error message:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;(UndefinedFunctionError) function ForumApp.Forum.config/0 is undefined or private&#xA;    (forum_app 0.1.0) ForumApp.Forum.config()&#xA;    (ash_postgres 2.4.12) lib/migration_generator/migration_generator.ex:160: AshPostgres.MigrationGenerator.snapshot_path/2&#xA;    (ash_postgres 2.4.12) lib/migration_generator/migration_generator.ex:168: anonymous fn/2 in AshPostgres.MigrationGenerator.create_extension_migrations/2&#xA;    (elixir 1.17.2) lib/enum.ex:1703: Enum.&amp;#34;-map/2-lists^map/1-1-&amp;#34;/2&#xA;    (elixir 1.17.2) lib/enum.ex:1703: Enum.&amp;#34;-map/2-lists^map/1-1-&amp;#34;/2&#xA;    (ash_postgres 2.4.12) lib/migration_generator/migration_generator.ex:53: AshPostgres.MigrationGenerator.generate/2&#xA;    (mix 1.17.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5&#xA;    (elixir 1.17.2) lib/enum.ex:1703: Enum.&amp;#34;-map/2-lists^map/1-1-&amp;#34;/2&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I knew I made a mistake somewhere, but when I compared the code I wrote with the code from other Ash projects I made, I didn&amp;rsquo;t see any differences besides the name of the project.&lt;/p&gt;&#xA;&lt;p&gt;After trying for a day to find the source of the problem, I asked a question about this problem on &lt;a href=&#34;https://elixirforum.com/t/where-is-the-config-function-for-an-ash-domain-created/67294&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;the Elixir Forum&lt;/a&gt; and was guided toward the cause of the problem and the solution.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-cause-of-the-problem&#34; class=&#34;relative group&#34;&gt;The Cause of the Problem &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#the-cause-of-the-problem&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;If you get this error when doing a database migration, check that the &lt;code&gt;postgres&lt;/code&gt; section of your Ash resource has the correct repo name.&lt;/p&gt;&#xA;&lt;p&gt;My mistake was I passed the name of my Ash domain as the repo instead of the name of the repo.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-elixir&#34; data-lang=&#34;elixir&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;postgres &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  table &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;posts&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  repo &lt;span style=&#34;color:#a6e22e&#34;&gt;ForumApp.Forum&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;end&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;the-solution&#34; class=&#34;relative group&#34;&gt;The solution &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#the-solution&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Use the name of the repo instead of the name of the Ash domain.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-elixir&#34; data-lang=&#34;elixir&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;postgres &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  table &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;posts&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  repo &lt;span style=&#34;color:#a6e22e&#34;&gt;ForumApp.Repo&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;end&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>Add Newsletter Signup Form to Hugo Website</title>
      <link>https://www.meandmark.com/posts/add-newsletter-signup-form-to-hugo-website/</link>
      <pubDate>Fri, 13 Sep 2024 14:22:47 -0400</pubDate>
      <guid>https://www.meandmark.com/posts/add-newsletter-signup-form-to-hugo-website/</guid>
      <description>&lt;p&gt;You have a Hugo website. You have a newsletter using a service like Beehiiv, ConvertKit, or MailerLite. You want to add a form to your site for people to subscribe to your newsletter? How do you do that?&lt;/p&gt;&#xA;&lt;p&gt;Adding a newsletter signup form to a Hugo website requires the following steps:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a partial for the form.&lt;/li&gt;&#xA;&lt;li&gt;Copy the form&amp;rsquo;s HTML to the partial.&lt;/li&gt;&#xA;&lt;li&gt;Call the partial in Hugo.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;create-a-partial&#34; class=&#34;relative group&#34;&gt;Create a Partial &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-a-partial&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;A partial is a snippet of HTML code that you can easily add to your site. Newsletter signup forms contain a lot of HTML code. It is much easier to create a partial for the form and add the partial in Hugo than to copy and paste the form HTML.&lt;/p&gt;&#xA;&lt;p&gt;To create a partial, go to the &lt;code&gt;layout&lt;/code&gt; folder of your Hugo project and create a &lt;code&gt;partials&lt;/code&gt; folder. Add an HTML file to the &lt;code&gt;partials&lt;/code&gt; folder. I&amp;rsquo;m going to use the name &lt;code&gt;newsletter-form.html&lt;/code&gt; for this article. You can name the file whatever you want.&lt;/p&gt;&#xA;&lt;h2 id=&#34;copy-the-forms-html-to-the-partial&#34; class=&#34;relative group&#34;&gt;Copy the Form&amp;rsquo;s HTML to the Partial &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#copy-the-forms-html-to-the-partial&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Sign in to your newsletter provider&amp;rsquo;s site and access the forms for your newsletter. The form should provide a way to get its HTML code. Usually you can access the HTML by viewing or publishing the form.&lt;/p&gt;&#xA;&lt;p&gt;Copy the HTML. Go to the file for your partial, and paste the HTML.&lt;/p&gt;&#xA;&lt;h2 id=&#34;call-the-partial&#34; class=&#34;relative group&#34;&gt;Call the Partial &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#call-the-partial&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Add the following code where you want the form to appear:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;{{ partial &amp;#34;newsletter-form.html&amp;#34; . }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Many sites like to place the signup form at the end of every blog post. To do this, you will have to call the partial in your theme&amp;rsquo;s &lt;code&gt;single.html&lt;/code&gt; file. The &lt;code&gt;single.html&lt;/code&gt; file controls what appears when someone reads a blog post on your site.&lt;/p&gt;&#xA;&lt;p&gt;Go to the folder for your theme. Inside that folder is a &lt;code&gt;layouts&lt;/code&gt; folder. Go there. Go to the &lt;code&gt;_default&lt;/code&gt; folder. Inside that folder is the &lt;code&gt;single.html&lt;/code&gt; file. Open it.&lt;/p&gt;&#xA;&lt;p&gt;You should see the following partial call in the HTML file:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;{{ .Content }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This partial call displays the content of your post. Add the call to your partial after the &lt;code&gt;.Content&lt;/code&gt; call.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;{{ .Content }}&#xA;{{ partial &amp;#34;newsletter-form.html&amp;#34; . }}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The form should appear at the end of the post.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Migrating a Site From Wordpress to Hugo</title>
      <link>https://www.meandmark.com/posts/migrating-from-wordpress-to-hugo/</link>
      <pubDate>Mon, 09 Sep 2024 14:08:36 -0400</pubDate>
      <guid>https://www.meandmark.com/posts/migrating-from-wordpress-to-hugo/</guid>
      <description>&lt;p&gt;I recently migrated several sites, including this one, from WordPress to &lt;a href=&#34;https://gohugo.io&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Hugo&lt;/a&gt;. I learned a lot doing the migration and decided to share what I learned to help others who want to migrate to Hugo.&lt;/p&gt;&#xA;&lt;h2 id=&#34;prerequisites&#34; class=&#34;relative group&#34;&gt;Prerequisites &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#prerequisites&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Getting the most out of this article requires the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You installed Hugo.&lt;/li&gt;&#xA;&lt;li&gt;You know how to use the command line.&lt;/li&gt;&#xA;&lt;li&gt;You know how to access your site&amp;rsquo;s files on your web host.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;backup-wordpress&#34; class=&#34;relative group&#34;&gt;Backup WordPress &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#backup-wordpress&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Start by backing up your WordPress data in case the migration goes wrong. Export your WordPress content using the Export tool in the WordPress administration panel. Backup the database as well. You can even backup the whole site if your web host has a tool to do that.&lt;/p&gt;&#xA;&lt;h2 id=&#34;convert-the-wordpress-posts-to-markdown&#34; class=&#34;relative group&#34;&gt;Convert the WordPress Posts to Markdown &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#convert-the-wordpress-posts-to-markdown&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;WordPress and Hugo store posts and pages differently. WordPress posts and pages are HTML files that are stored in a database. Hugo uses Markdown to store posts and pages. To convert your WordPress posts and pages to Hugo, you must convert them to Markdown.&lt;/p&gt;&#xA;&lt;p&gt;I used the &lt;a href=&#34;https://github.com/SchumacherFM/wordpress-to-hugo-exporter&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;WordPress to Hugo Exporter&lt;/a&gt; plugin to migrate the WordPress posts and pages to a format that Hugo can use.&lt;/p&gt;&#xA;&lt;p&gt;This plugin is not part of the WordPress plugin directory so you have to download the plugin from GitHub and copy the plugin to the plugins folder on your WordPress site. Once you have the plugin copied, you can activate it from the WordPress administration panel. After activating the plugin, you can export the data by choosing Export to Hugo from the Tools menu.&lt;/p&gt;&#xA;&lt;p&gt;When you choose Export to Hugo, the plugin will download a zip file that contains a folder with the following items:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A &lt;code&gt;posts&lt;/code&gt; folder that contains Markdown files for each blog post.&lt;/li&gt;&#xA;&lt;li&gt;A folder for each page that contains a Markdown file for the page.&lt;/li&gt;&#xA;&lt;li&gt;A &lt;code&gt;wp-content&lt;/code&gt; folder that contains the images in your posts and pages.&lt;/li&gt;&#xA;&lt;li&gt;A &lt;code&gt;config.yaml&lt;/code&gt; file that contains the URL, name, and description of the site.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;create-the-hugo-site&#34; class=&#34;relative group&#34;&gt;Create the Hugo Site &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-the-hugo-site&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;After converting your WordPress content to Markdown, you can create your Hugo website.&lt;/p&gt;&#xA;&lt;p&gt;The Hugo website has a &lt;a href=&#34;https://gohugo.io/getting-started/quick-start/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Quick Start guide&lt;/a&gt; that shows you how to create a new site. I&amp;rsquo;m not going to repeat the information here.&lt;/p&gt;&#xA;&lt;h2 id=&#34;add-a-theme&#34; class=&#34;relative group&#34;&gt;Add a Theme &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-a-theme&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Every Hugo site requires a theme that controls how the site looks. The Hugo site has a &lt;a href=&#34;https://themes.gohugo.io&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;page of themes&lt;/a&gt; for you to browse.&lt;/p&gt;&#xA;&lt;p&gt;The easiest way to add a theme to your site is to navigate to the &lt;code&gt;themes&lt;/code&gt; directory in your project and run the &lt;code&gt;git clone&lt;/code&gt; command, supplying the URL of the GitHub repo for the theme. The following command installs the Congo theme:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;git clone https://github.com/jpanther/congo&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After installing the theme set the theme to use in the &lt;code&gt;hugo.toml&lt;/code&gt; file. The following code sets the theme to Congo:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;theme = &amp;#39;congo&amp;#39;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;When I was testing out themes to use for my sites, I noticed that themes that had not been updated in 6 or more months caused problems. I would get errors when I built the site. I recommend starting with themes that have been updated in the past few months.&lt;/p&gt;&#xA;&lt;h3 id=&#34;configure-the-site&#34; class=&#34;relative group&#34;&gt;Configure the Site &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#configure-the-site&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Open the file &lt;code&gt;hugo.toml&lt;/code&gt;. The contents of the file should look similar to the following:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;baseURL = &amp;#39;https://example.org/&amp;#39;&#xA;languageCode = &amp;#39;en-us&amp;#39;&#xA;title = &amp;#39;My New Hugo Site&amp;#39;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Change the baseURL and title to the URL and title of your site. If you use the Wordpress to Hugo Exporter plugin, you can use the contents of the &lt;code&gt;config.yaml&lt;/code&gt; file to configure the site.&lt;/p&gt;&#xA;&lt;h3 id=&#34;add-a-navigation-menu&#34; class=&#34;relative group&#34;&gt;Add a Navigation Menu &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-a-navigation-menu&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Most sites have a navigation menu. Open the &lt;code&gt;hugo.toml&lt;/code&gt; file to add a navigation menu to your site.&lt;/p&gt;&#xA;&lt;p&gt;Add a &lt;code&gt;[menus]&lt;/code&gt; section to add the menu. Add an entry for each item. The following code recreates the navigation menu for this site:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[menus]&#xA;&#x9;[[menus.main]]&#xA;&#x9;&#x9;name = &amp;#39;Articles&amp;#39;&#xA;&#x9;&#x9;pageRef = &amp;#39;/posts&amp;#39;&#xA;&#x9;&#x9;weight = 10&#xA;&#x9;[[menus.main]]&#xA;&#x9;&#x9;name = &amp;#39;GitHub&amp;#39;&#xA;&#x9;&#x9;url = &amp;#39;https://github.com/meandmark&amp;#39;&#xA;&#x9;&#x9;weight = 20&#xA;&#x9;[[menus.main]]&#xA;&#x9;&#x9;name = &amp;#39;RSS Feed&amp;#39;&#xA;&#x9;&#x9;pageRef = &amp;#39;/index.xml&amp;#39;&#xA;&#x9;&#x9;weight = 30&#xA;&#x9;[[menus.main]]&#xA;&#x9;&#x9;name = &amp;#39;Contact&amp;#39;&#xA;&#x9;&#x9;pageRef = &amp;#39;/contact&amp;#39;&#xA;&#x9;&#x9;weight = 40&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;name&lt;/code&gt; argument is the name of the item. Use the &lt;code&gt;pageRef&lt;/code&gt; argument for internal links and &lt;code&gt;url&lt;/code&gt; for external links. I&amp;rsquo;m not sure what the &lt;code&gt;weight&lt;/code&gt; argument is used for. But every example I&amp;rsquo;ve seen uses increasing weight values for menu items.&lt;/p&gt;&#xA;&lt;p&gt;The Hugo documentation says to use &lt;code&gt;pageRef&lt;/code&gt; for internal links. But I found that Hugo generated empty links for the internal links. I had to use &lt;code&gt;url&lt;/code&gt; to generate working links. If you get empty links, use &lt;code&gt;url&lt;/code&gt; instead of &lt;code&gt;pageRef&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[menus]&#xA;&#x9;[[menus.main]]&#xA;&#x9;&#x9;name = &amp;#39;Articles&amp;#39;&#xA;&#x9;&#x9;url = &amp;#39;/posts&amp;#39;&#xA;&#x9;&#x9;weight = 10&#xA;&#x9;[[menus.main]]&#xA;&#x9;&#x9;name = &amp;#39;GitHub&amp;#39;&#xA;&#x9;&#x9;url = &amp;#39;https://github.com/meandmark&amp;#39;&#xA;&#x9;&#x9;weight = 20&#xA;&#x9;[[menus.main]]&#xA;&#x9;&#x9;name = &amp;#39;RSS Feed&amp;#39;&#xA;&#x9;&#x9;url = &amp;#39;/index.xml&amp;#39;&#xA;&#x9;&#x9;weight = 30&#xA;&#x9;[[menus.main]]&#xA;&#x9;&#x9;name = &amp;#39;Contact&amp;#39;&#xA;&#x9;&#x9;url = &amp;#39;/contact&amp;#39;&#xA;&#x9;&#x9;weight = 40&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;copy-your-content-to-hugo&#34; class=&#34;relative group&#34;&gt;Copy Your Content to Hugo &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#copy-your-content-to-hugo&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;If you use the WordPress to Hugo Converter plugin, the download contains a &lt;code&gt;posts&lt;/code&gt; folder for your posts and a folder for each WordPress page. Copy those folders to the &lt;code&gt;content&lt;/code&gt; folder of your Hugo project.&lt;/p&gt;&#xA;&lt;h2 id=&#34;add-a-home-page&#34; class=&#34;relative group&#34;&gt;Add a Home Page &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-a-home-page&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Some of the WordPress sites I was migrating did not have a dedicated home page. The home page would show a list of posts. I found that what the home page showed on those sites depended on the theme. If you want more control over the contents of the home page, I recommend creating a dedicated home page for your Hugo site.&lt;/p&gt;&#xA;&lt;p&gt;Add a file named &lt;code&gt;_index.md&lt;/code&gt; to the &lt;code&gt;content&lt;/code&gt; folder to create a home page. Notice the leading underscore character in the file name. If you omit the underscore, the changes you make to the site will not appear on the rest of the site. When I named the file &lt;code&gt;index.md&lt;/code&gt; on one of my sites, the changes I made to the links in the navigation menu would only apply to the home page.&lt;/p&gt;&#xA;&lt;p&gt;After creating the &lt;code&gt;_index.md&lt;/code&gt; file, you can add whatever content you want on the home page.&lt;/p&gt;&#xA;&lt;h2 id=&#34;dealing-with-images&#34; class=&#34;relative group&#34;&gt;Dealing with Images &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#dealing-with-images&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;If you look at the Markdown file of a post or page with images, you will notice the file uses HTML image tags instead of Markdown tags. The HTML image tag looks similar to the following:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;img loading=&amp;#34;lazy&amp;#34; decoding=&amp;#34;async&amp;#34; src=&amp;#34;https://www.meandmark.com/blog/wp-content/uploads/2022/02/Xcode13InfoPlist.png&amp;#34; alt=&amp;#34;Xcode13InfoPlist&amp;#34; border=&amp;#34;0&amp;#34; width=&amp;#34;512&amp;#34; height=&amp;#34;245&amp;#34; /&amp;gt; &#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The parser Hugo uses to convert Markdown to HTML ignores raw HTML in Markdown by default. When you build the Hugo project, the HTML image tags are ignored. The HTML files for your site will have no images in them.&lt;/p&gt;&#xA;&lt;p&gt;To get the images to appear, you must configure your project to tell the Markdown parser to process raw HTML in Markdown. In the &lt;code&gt;hugo.toml&lt;/code&gt; file, add the following code:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[markup.goldmark.renderer]&#xA;  unsafe = true&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Looking at the HTML markup for the image, notice that the image file is buried in a hierarchy of folders inside a &lt;code&gt;wp-content&lt;/code&gt; folder. The WordPress to Hugo Converter plugin generates a &lt;code&gt;wp-content&lt;/code&gt; folder. This folder and its contents must be in the folder where your site resides on your web host&amp;rsquo;s server.&lt;/p&gt;&#xA;&lt;p&gt;Copy the &lt;code&gt;wp-content&lt;/code&gt; folder into the Hugo project&amp;rsquo;s &lt;code&gt;content&lt;/code&gt; folder. When you build the project, the folder will be copied to the &lt;code&gt;public&lt;/code&gt; folder. The Hugo documentation says image files belong in the &lt;code&gt;assets&lt;/code&gt; folder, but the folder wasn&amp;rsquo;t copied when I had the &lt;code&gt;wp-content&lt;/code&gt; folder in the &lt;code&gt;assets&lt;/code&gt; folder.&lt;/p&gt;&#xA;&lt;p&gt;Another alternative is to copy the &lt;code&gt;wp-content&lt;/code&gt; folder and its contents directly to your web host.&lt;/p&gt;&#xA;&lt;h2 id=&#34;test-your-site&#34; class=&#34;relative group&#34;&gt;Test Your Site &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#test-your-site&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;At this point you are ready to test your site. Start by running the &lt;code&gt;hugo&lt;/code&gt; command to build the project.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;hugo&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Run the &lt;code&gt;hugo server&lt;/code&gt; command to start a server to test your Hugo site.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;hugo server&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can access your site in a web browser with the following URL:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;localhost:1313&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;deploy-your-site&#34; class=&#34;relative group&#34;&gt;Deploy Your Site &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#deploy-your-site&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;When everything is working correctly, you can deploy your site. Run the &lt;code&gt;hugo&lt;/code&gt; command to build the project.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;hugo&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The &lt;code&gt;public&lt;/code&gt; folder contains the built website.&lt;/p&gt;&#xA;&lt;p&gt;Go to your web host and copy the contents of the &lt;code&gt;public&lt;/code&gt; folder to the main folder for your domain. The exact location depends on your web host, but most web hosts have a &lt;code&gt;public_html&lt;/code&gt; folder as the main folder. Go inside that folder and copy the contents of the &lt;code&gt;public&lt;/code&gt; folder.&lt;/p&gt;&#xA;&lt;h2 id=&#34;questions&#34; class=&#34;relative group&#34;&gt;Questions &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#questions&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;If you have any questions about migrating a WordPress site to Hugo, go to the &#xA;      &#xA;    &lt;a href=&#34;https://www.meandmark.com/contact/&#34;&gt;Contact page&lt;/a&gt; to email me your question.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Dealing with the PostgreSQL connection refused error in the Phoenix framework</title>
      <link>https://www.meandmark.com/dealing-with-the-postgresql-connection-refused-error-in-the-phoenix-framework/</link>
      <pubDate>Wed, 24 Apr 2024 20:17:55 +0000</pubDate>
      <guid>https://www.meandmark.com/dealing-with-the-postgresql-connection-refused-error-in-the-phoenix-framework/</guid>
      <description>&lt;p&gt;I wanted to learn to use the &lt;a href=&#34;https://phoenixframework.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Phoenix web development framework&lt;/a&gt;. I was going through the &lt;a href=&#34;https://hexdocs.pm/phoenix/up_and_running.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Up and Running guide&lt;/a&gt; on the Phoenix framework’s site. When I ran the &lt;code&gt;mix ecto.create&lt;/code&gt; command to create the database, I kept getting the following error:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;15:45:35.314 [error] Postgrex.Protocol (#PID&amp;lt;0.344.0&amp;gt;) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused – :econnrefused&lt;br&gt;&#xA;** (Mix) The database for Hello.Repo couldn’t be created: killed&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I noticed the following instruction in the tutorial:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Then configure your database in config/dev.exs&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Without providing any more details. After some trial and error, I got the tutorial project up and running. I learned two requirements to get the &lt;code&gt;mix ecto.create&lt;/code&gt; command to work.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;You must start the PostgreSQL server.&lt;/li&gt;&#xA;&lt;li&gt;Make sure the database user and password are correct.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;startingthedatabaseserver&#34; class=&#34;relative group&#34;&gt;Starting the Database Server &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#startingthedatabaseserver&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;As someone inexperienced with web development, I didn’t realize you have to start a database server to create a database. I used the &lt;a href=&#34;https://postgresapp.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Postgres.app Mac app&lt;/a&gt; to create and start the database server.&lt;/p&gt;&#xA;&lt;h3 id=&#34;configuringthedatabaseuserandpassword&#34; class=&#34;relative group&#34;&gt;Configuring the Database User and Password &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#configuringthedatabaseuserandpassword&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The Phoenix tutorial assumes the database user and password are both &lt;code&gt;postgres&lt;/code&gt;. If your &lt;code&gt;postgres&lt;/code&gt; user has a different password, you must either change the password when running PostgreSQL or create a new user and password and use them in Phoenix.&lt;/p&gt;&#xA;&lt;p&gt;Inside the project folder is a &lt;code&gt;config&lt;/code&gt; folder. Inside that folder is a file called &lt;code&gt;dev.exs&lt;/code&gt;. Open this file in a text editor. At the top of the file, you should see text similar to the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Configure your database&#xA;config :hello, Hello.Repo,&#xA;  username: &amp;quot;postgres&amp;quot;,&#xA;  password: &amp;quot;postgres&amp;quot;,&#xA;  hostname: &amp;quot;localhost&amp;quot;,&#xA;  database: &amp;quot;hello_dev&amp;quot;,&#xA;  stacktrace: true,&#xA;  show_sensitive_data_on_connection_error: true,&#xA;  pool_size: 10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If your &lt;code&gt;postgres&lt;/code&gt; user has a different password, enter it in the &lt;code&gt;password&lt;/code&gt; field. If you create a new user, enter the name in the &lt;code&gt;username&lt;/code&gt; field and the password in the &lt;code&gt;password&lt;/code&gt; field.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 13 Missing Info.plist</title>
      <link>https://www.meandmark.com/xcode-13-missing-info-plist/</link>
      <pubDate>Mon, 07 Feb 2022 22:56:13 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-13-missing-info-plist/</guid>
      <description>&lt;p&gt;If you create a new project in Xcode 13, you will notice there is no &lt;code&gt;Info.plist&lt;/code&gt; file on the left side of the project window. How do you access &lt;code&gt;Info.plist&lt;/code&gt; and add items to it?&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select the project file from the left side of the project window to open the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Select the app target from the list of targets on the left side of the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Click the Info button at the top of the project editor.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://www.meandmark.com/blog/wp-content/uploads/2022/02/Xcode13InfoPlist.png&#34; alt=&#34;Xcode13InfoPlist&#34; border=&#34;0&#34; width=&#34;512&#34; height=&#34;245&#34; /&gt; &#xA;&lt;p&gt;The Custom Target Properties section contains the &lt;code&gt;Info.plist&lt;/code&gt; file. Add, edit, and remove entries from there. Move the mouse arrow over an entry to show buttons for adding and removing entries.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 13.0 Does Not Have macOS 12 SDK</title>
      <link>https://www.meandmark.com/xcode-13-0-does-not-have-macos-12-sdk/</link>
      <pubDate>Thu, 07 Oct 2021 20:01:27 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-13-0-does-not-have-macos-12-sdk/</guid>
      <description>&lt;p&gt;The Xcode 13 betas included the macOS 12 SDK. When Apple released iOS 15, they released Xcode 13.0. Because macOS 12 was still in beta during iOS 15’s release, Xcode 13.0 includes the macOS 11.3 SDK.&lt;/p&gt;&#xA;&lt;p&gt;If you are writing a Mac app that uses something added in the macOS 12 SDK, such as &lt;a href=&#34;https://www.swiftbysundell.com/articles/bindable-swiftui-list-elements/#xcode-s-new-element-binding-syntax&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;SwiftUI’s element binding syntax&lt;/a&gt;, the code won’t compile, even if the new feature supports macOS 11.&lt;/p&gt;&#xA;&lt;p&gt;To use the macOS 12 SDK, install one of the Xcode 13 betas until Apple releases macOS 12. When Apple ships macOS 12, they will ship a new Xcode version that includes the macOS 12 SDK.&lt;/p&gt;&#xA;&lt;h4 id=&#34;update&#34; class=&#34;relative group&#34;&gt;UPDATE &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Apple released Xcode 13.1 on October 25, 2021. Xcode 13.1 includes the macOS 12 SDK.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 13: Missing Products Folder</title>
      <link>https://www.meandmark.com/xcode-13-missing-products-folder/</link>
      <pubDate>Wed, 29 Sep 2021 00:43:53 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-13-missing-products-folder/</guid>
      <description>&lt;p&gt;When you create a new project in Xcode 13, you will notice there is no Products folder in the project navigator. Choose Product &amp;gt; Show Build Folder in Finder to access the Products folder.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 12: Consolidated iOS App Project Templates</title>
      <link>https://www.meandmark.com/xcode-12-consolidated-ios-app-project-templates/</link>
      <pubDate>Mon, 16 Nov 2020 03:39:49 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-12-consolidated-ios-app-project-templates/</guid>
      <description>&lt;p&gt;In Xcode 12 Apple consolidated many of their iOS app project templates into one template: App. If you are following a tutorial written for an older Xcode version that has templates like single view app and master-detail app, choose the App template.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>How to Show Source Code on Reddit</title>
      <link>https://www.meandmark.com/how-to-show-source-code-on-reddit/</link>
      <pubDate>Sat, 03 Oct 2020 19:55:15 +0000</pubDate>
      <guid>https://www.meandmark.com/how-to-show-source-code-on-reddit/</guid>
      <description>&lt;p&gt;I see many people who ask a programming question on Reddit and do one of two things to show their code:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;They show a screenshot of their screen.&lt;/li&gt;&#xA;&lt;li&gt;They use the inline code setting instead of creating a code block.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;By doing these things, the people asking the question make their code extremely difficult to read, making it less likely they will get an answer.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://www.meandmark.com/blog/wp-content/uploads/2020/10/RedditLongInlineListing.png&#34; alt=&#34;RedditLongInlineListing&#34; border=&#34;0&#34; width=&#34;512&#34; height=&#34;320&#34; /&gt; &#xA;&lt;p&gt;Notice how the code isn’t indented properly in the inline code block above. This sample isn’t too bad, but I have seen long inline code blocks that are almost unreadable.&lt;/p&gt;&#xA;&lt;p&gt;The way to make a code listing readable on Reddit is to create a Markdown code block. Start by clicking the Markdown mode button on the right side of the toolbar above the text view for writing the post.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://www.meandmark.com/blog/wp-content/uploads/2020/10/RedditPostUI.png&#34; alt=&#34;RedditPostUI&#34; border=&#34;0&#34; width=&#34;512&#34; height=&#34;245&#34; /&gt; &#xA;&lt;p&gt;Write your post in Markdown. Any paragraphs you write will appear as normal body text in the final post. To create a code block, put three backticks on the line above the code listing and three more on the line below the listing.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;```&#xA;// Put your code listing here&#xA;override func viewDidLoad() {&#xA;    super.viewDidLoad()&#xA;    // Do view setup here.&#xA;}&#xA;```&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Then we you click the Post button, your code listing will appear in a block similar to the listing above, minus the backticks above and below the code.&lt;/p&gt;&#xA;&lt;p&gt;By using Markdown code blocks for code listings in Reddit, your code will be much easier to read. People will be more likely to answer your question because you took the time to make an easy to read listing.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Where Did the Multiplatform SwiftUI Project Templates Go in Xcode 12.0?</title>
      <link>https://www.meandmark.com/where-did-the-multiplatform-swiftui-project-templates-go-in-xcode-12-0/</link>
      <pubDate>Thu, 01 Oct 2020 18:53:51 +0000</pubDate>
      <guid>https://www.meandmark.com/where-did-the-multiplatform-swiftui-project-templates-go-in-xcode-12-0/</guid>
      <description>&lt;p&gt;As part of Xcode 12, Apple added project templates for creating SwiftUI apps that run on both iOS devices and Macs. In the Xcode 12 betas, these project templates appeared in the Multiplatform section.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://www.meandmark.com/blog/wp-content/uploads/2020/10/Xcode12MultiplatformProjectTemplates.png&#34; alt=&#34;Xcode12MultiplatformProjectTemplates&#34; border=&#34;0&#34; width=&#34;405&#34; height=&#34;187&#34; /&gt; &#xA;&lt;p&gt;When Apple released iOS 14 in September, they also released Xcode 12.0. If you install Xcode 12.0 and create a project, you will see that the App and Document App projects are missing from the Multiplatform section. What happened?&lt;/p&gt;&#xA;&lt;p&gt;The App and Document App templates require the macOS 11 SDK. Because macOS 11 was still in beta when Xcode 12.0 shipped, Apple did not include the macOS 11 SDK in Xcode 12.0. That’s why the App and Document App templates are missing in Xcode 12.0. No macOS 11 SDK, no App and Document App templates.&lt;/p&gt;&#xA;&lt;p&gt;If you want to use the App and Document App templates, you must install Xcode 12.2, which includes the macOS 11 SDK. Apple will release Xcode 12.2 when macOS 11 ships. If you can’t wait for macOS 11 to ship, &lt;a href=&#34;https://xcodereleases.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;download the Xcode 12.2 beta&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE: November 2020&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Xcode 12.2 is now available at the Mac App Store, and it includes the multiplatform SwiftUI project templates.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Adding a Swift Package to Multiple Targets</title>
      <link>https://www.meandmark.com/adding-a-swift-package-to-multiple-targets/</link>
      <pubDate>Tue, 11 Aug 2020 21:40:31 +0000</pubDate>
      <guid>https://www.meandmark.com/adding-a-swift-package-to-multiple-targets/</guid>
      <description>&lt;p&gt;If your Xcode project has multiple targets and you add a Swift package, Xcode will let you add the package to only one of the targets. How do you add the package to the other targets?&lt;/p&gt;&#xA;&lt;p&gt;Select a target from the project editor. Click the Add button in the Frameworks, Libraries, and Embedded Content section.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://www.meandmark.com/blog/wp-content/uploads/2020/08/FrameworksAndLibraries.png&#34; alt=&#34;FrameworksAndLibraries&#34; border=&#34;0&#34; width=&#34;512&#34; height=&#34;223&#34; /&gt; &#xA;&lt;p&gt;A sheet will open with a list of frameworks and libraries that you can add. The Swift package will appear in the list.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Disk Space Required to Install Xcode</title>
      <link>https://www.meandmark.com/disk-space-required-to-install-xcode/</link>
      <pubDate>Wed, 29 Apr 2020 20:08:21 +0000</pubDate>
      <guid>https://www.meandmark.com/disk-space-required-to-install-xcode/</guid>
      <description>&lt;p&gt;People constantly post on Apple’s developer forums complaining that when they try to install Xcode, an alert opens saying they don’t have enough disk space to install it. These people always say they have enough space because they have more free space on their disk than the Xcode download. Usually the person asking the question has 15–20 GB of free space on their startup disk.&lt;/p&gt;&#xA;&lt;h3 id=&#34;youneedmorefreespacethanthedownloadsize&#34; class=&#34;relative group&#34;&gt;You Need More Free Space Than the Download Size &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#youneedmorefreespacethanthedownloadsize&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The Xcode file that you download is a compressed file. You need enough disk space to store both the compressed file you downloaded and the expanded file. Suppose your Xcode download is 8 GB. The expanded file is going to be bigger than that. Xcode 11.4.1 takes up 17.39 GB on my Mac. At this point you need 25.39 GB of free space. Add in some temporary storage space for swapping files, and you need a minimum of 30 GB of disk space to install Xcode.&lt;/p&gt;&#xA;&lt;p&gt;30 GB of disk space is just an example. That may not be enough free space, especially for newer Xcode versions. Xcode releases keep getting larger over time so the amount of free disk space you need will increase as well.&lt;/p&gt;&#xA;&lt;h3 id=&#34;summary&#34; class=&#34;relative group&#34;&gt;Summary &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#summary&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If an alert opens saying you don’t have enough space to install Xcode, you don’t. Have enough free disk space that is at least 5 times the size of the compressed Xcode file you are going to download from Apple. I know that can be hard to do, especially if you are using a laptop with a 128 GB SSD, but you have to free up the space.&lt;/p&gt;&#xA;&lt;p&gt;The app &lt;a href=&#34;http://www.one-minute-games.com/portfolio/dev-cleaner/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;DevCleaner for Xcode&lt;/a&gt; can free up gigabytes of disk space by removing caches and other old files that accumulate over time.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 11: Export Mac App Archive</title>
      <link>https://www.meandmark.com/xcode-11-export-mac-app-archive/</link>
      <pubDate>Thu, 23 Jan 2020 21:26:50 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-11-export-mac-app-archive/</guid>
      <description>&lt;p&gt;Xcode 11 provides a subtle button to export a Mac app archive. In the Organizer, select an archive and scroll so you can see the Status column for the archive. Move the cursor over the Status column to make the Export App button appear.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://www.meandmark.com/blog/wp-content/uploads/2020/01/Xcode11ExportApp.png&#34; alt=&#34;Xcode11ExportApp&#34; border=&#34;0&#34; width=&#34;512&#34; height=&#34;41&#34; /&gt;</description>
    </item>
    <item>
      <title>Xcode 11 Version Control Changes</title>
      <link>https://www.meandmark.com/xcode-11-version-control-changes/</link>
      <pubDate>Sat, 19 Oct 2019 18:53:42 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-11-version-control-changes/</guid>
      <description>&lt;p&gt;This post lists all the changes I found in Xcode 11 on version control.&lt;/p&gt;&#xA;&lt;h3 id=&#34;codereviewbutton&#34; class=&#34;relative group&#34;&gt;Code Review Button &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#codereviewbutton&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 11 adds a code review button to the toolbar that lets you view the changes you made to the currently selected file.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://www.meandmark.com/blog/wp-content/uploads/2019/10/CodeReviewButton.png&#34; alt=&#34;CodeReviewButton&#34; border=&#34;0&#34; width=&#34;231&#34; height=&#34;31&#34; /&gt; &#xA;&lt;p&gt;The code review button is the button with the two arrows facing right and left.&lt;/p&gt;&#xA;&lt;h3 id=&#34;discardingchangesusingtheeditor&#34; class=&#34;relative group&#34;&gt;Discarding Changes Using the Editor &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#discardingchangesusingtheeditor&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you make changes to your source code, a blue bar appears on the left side of the editor next to the changed code.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://www.meandmark.com/blog/wp-content/uploads/2019/10/SeeVersionControlChangesInEditor.png&#34; alt=&#34;SeeVersionControlChangesInEditor&#34; border=&#34;0&#34; width=&#34;359&#34; height=&#34;78&#34; /&gt; &#xA;&lt;p&gt;If you click the blue bar, a popover opens that lets you discard the change you made to that block of code.&lt;/p&gt;&#xA;&lt;h3 id=&#34;stashingchanges&#34; class=&#34;relative group&#34;&gt;Stashing Changes &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#stashingchanges&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;In Xcode 11 you can stash uncommitted changes in Xcode. Stashing changes lets you temporarily store changes you make to your code so you can switch branches. Stashing is potentially dangerous. If you mistakenly remove a stash, you can’t get it back. It’s safer to create a temporary branch and commit your changes to the temporary branch.&lt;/p&gt;&#xA;&lt;p&gt;Choose Source Control &amp;gt; Stash Changes to stash your changes. A sheet opens for you to enter an optional message. Click the Stash button to complete the stash.&lt;/p&gt;&#xA;&lt;p&gt;You can view your stashes from the source control navigator. The stashes are in the Stashed Changes folder. Select a stash to view the changes you made.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://www.meandmark.com/blog/wp-content/uploads/2019/10/ViewStashes.png&#34; alt=&#34;ViewStashes&#34; border=&#34;0&#34; width=&#34;512&#34; height=&#34;362&#34; /&gt; &#xA;&lt;p&gt;Right-clicking on a stash opens a contextual menu that lets you apply and delete your stashes.&lt;/p&gt;&#xA;&lt;h3 id=&#34;cherrypicking&#34; class=&#34;relative group&#34;&gt;Cherry Picking &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#cherrypicking&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 11 adds support for cherry picking commits. Cherry picking involves taking a commit from one git branch and applying it to another.&lt;/p&gt;&#xA;&lt;p&gt;To cherry pick a commit, switch to the branch where you want to apply the cherry pick. Choose Source Control &amp;gt; Cherry Pick.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://www.meandmark.com/blog/wp-content/uploads/2019/10/CherryPickSheet.png&#34; alt=&#34;CherryPickSheet&#34; border=&#34;0&#34; width=&#34;476&#34; height=&#34;255&#34; /&gt; &#xA;&lt;p&gt;A sheet opens for you to enter a revision identifier, which is the identifier git supplies for a commit. Finding the revision identifier for the commit you want to cherry pick is the hardest part. When you enter a valid identifier, the commit will appear in the list of commits. Select the commit and click the Cherry-Pick button to cherry pick the commit.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 11: User Interface Menu for New Projects</title>
      <link>https://www.meandmark.com/xcode-11-user-interface-menu-for-new-projects/</link>
      <pubDate>Wed, 25 Sep 2019 19:15:01 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-11-user-interface-menu-for-new-projects/</guid>
      <description>&lt;p&gt;When you create an iOS or Cocoa app project in Xcode 11, there is a User Interface menu in Step 2 of the New Project Assistant.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://www.meandmark.com/blog/wp-content/uploads/2019/09/Xcode11UserInterfaceMenu.png&#34; alt=&#34;Xcode11UserInterfaceMenu&#34; border=&#34;0&#34; width=&#34;455&#34; height=&#34;322&#34; /&gt; &#xA;&lt;p&gt;For iOS projects the user interface choices are SwiftUI and storyboard. For Mac projects the user interface choices are SwiftUI, storyboard and xib file.&lt;/p&gt;&#xA;&lt;p&gt;Xcode defaults to using SwiftUI as the user interface for new Xcode 11 projects. If you want to use storyboards and view controllers for your app’s user interface, make sure you choose Storyboard from the User Interface menu.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 11: Opening Editors</title>
      <link>https://www.meandmark.com/xcode-11-opening-editors/</link>
      <pubDate>Tue, 17 Sep 2019 04:03:04 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-11-opening-editors/</guid>
      <description>&lt;p&gt;Xcode 11 makes it easier to open new editors. You can open a new editor without switching to the Assistant Editor. Either choose File &amp;gt; New &amp;gt; Editor or click the Add Editor button in the jump bar.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://www.meandmark.com/blog/wp-content/uploads/2019/09/Xcode11AddEditorHighlighted.png&#34; alt=&#34;Xcode11AddEditorHighlighted&#34; border=&#34;0&#34; width=&#34;512&#34; height=&#34;48&#34; /&gt; &#xA;&lt;p&gt;Xcode defaults to adding editors to the right, stacking the editors horizontally. If you want new editors to appear below the current editor, choose File &amp;gt; New &amp;gt; Editor Below. When you do this, the menu item will change from Editor Below to Editor on Right.&lt;/p&gt;&#xA;&lt;p&gt;Choosing View &amp;gt; Change Editor Orientation will toggle stacking editors vertically and horizontally.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Unit Testing a Project with Spaces in Its Name</title>
      <link>https://www.meandmark.com/unit-testing-a-project-with-spaces-in-its-name/</link>
      <pubDate>Mon, 17 Jun 2019 19:55:00 +0000</pubDate>
      <guid>https://www.meandmark.com/unit-testing-a-project-with-spaces-in-its-name/</guid>
      <description>&lt;p&gt;Suppose you have an Xcode project with spaces in the name.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;My App&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In your unit tests you want to import the module so you can access your app’s classes in your unit tests. If you import the app project with the spaces,&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@testable import My App&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You’ll get errors from the compiler.&lt;/p&gt;&#xA;&lt;p&gt;How do you import the project name? Replace the spaces with underscores.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@testable import My_App&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now you can access your app’s classes in your tests.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode Bug Creating Bitbucket Repositories</title>
      <link>https://www.meandmark.com/xcode-bug-creating-bitbucket-repositories/</link>
      <pubDate>Sun, 10 Mar 2019 19:10:18 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-bug-creating-bitbucket-repositories/</guid>
      <description>&lt;p&gt;Xcode 10 has bug/limitation in creating Bitbucket repositories for your projects. If the name of the repository has uppercase letters, such as &lt;code&gt;MyProject&lt;/code&gt;, an alert pops up when you create the repository with the helpful message &lt;code&gt;An unknown error occurred&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The workaround is to use all lowercase letters in the repository name, such as &lt;code&gt;myproject&lt;/code&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 10: Create Global Git Ignore File</title>
      <link>https://www.meandmark.com/xcode-10-create-global-git-ignore-file/</link>
      <pubDate>Mon, 07 Jan 2019 21:13:20 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-10-create-global-git-ignore-file/</guid>
      <description>&lt;p&gt;Xcode 10 lets you create a global .gitignore file so you don’t have to create a .gitignore file for each project you create. Go to Xcode’s Source Control Preferences and click the Git button in the preferences window.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2019/01/Xcode10GitIgnoredFilesHighlighted.png&#34; alt=&#34;Xcode10GitIgnoredFilesHighlighted&#34; border=&#34;0&#34; width=&#34;512&#34; height=&#34;318&#34; /&gt; &#xA;&lt;p&gt;You most likely have an empty list of ignored files. Click the Add button to add files to ignore. Adding files to ignore from Xcode is a little tedious. You have to add one file at a time. But you only have to enter them once.&lt;/p&gt;&#xA;&lt;p&gt;If you need to know what files to ignore, read the Generating a Git Ignore File section in the following article:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://meandmark.com/blog/2018/02/telling-git-to-ignore-files-in-xcode-projects/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Telling Git to Ignore Files in Xcode Projects&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Using a Ruby Gem in a Mac App</title>
      <link>https://www.meandmark.com/using-a-ruby-gem-in-a-mac-app/</link>
      <pubDate>Mon, 07 Jan 2019 03:18:57 +0000</pubDate>
      <guid>https://www.meandmark.com/using-a-ruby-gem-in-a-mac-app/</guid>
      <description>&lt;p&gt;I wanted to run a Ruby tool (packaged as a gem) in a Mac app, but I didn’t want people to have to install the Ruby gem to run my app. I knew I wanted to bundle the gem in my app bundle, but I wasn’t sure how to do so. I finally figured it out so I am sharing what I learned with you. There are five main steps to bundling a Ruby gem in a Mac app and running the gem.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Install the gems on your Mac&lt;/li&gt;&#xA;&lt;li&gt;Add a Copy Files build phase&lt;/li&gt;&#xA;&lt;li&gt;Find the gems folder in the app bundle&lt;/li&gt;&#xA;&lt;li&gt;Configure the command to run the gem&lt;/li&gt;&#xA;&lt;li&gt;Run the gem in your app&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;step1:installthegemsonyourmac&#34; class=&#34;relative group&#34;&gt;Step 1: Install the Gems on Your Mac &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#step1:installthegemsonyourmac&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Before you can copy Ruby gems to your app bundle, you must install them on your Mac. The standard &lt;code&gt;gem install&lt;/code&gt; command installs the gem in a location that’s difficult to find. What you should do is install the gems you want to use in a folder you can find easily, such as a &lt;code&gt;gems&lt;/code&gt; folder inside your project folder.&lt;/p&gt;&#xA;&lt;p&gt;To install the gems into a custom location, use the &lt;code&gt;-i&lt;/code&gt; option and supply the path to the destination folder.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;gem install -i /path/to/gem/folder gemName&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;step2:addacopyfilesbuildphase&#34; class=&#34;relative group&#34;&gt;Step 2: Add a Copy Files Build Phase &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#step2:addacopyfilesbuildphase&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;You must add a Copy Files build phase to your app target that copies the Ruby gem to the app bundle when building the project. Select your project from the project navigator to open the project editor. Select your target from the project editor. Click the Build Phases button at the top of the project editor.&lt;/p&gt;&#xA;&lt;p&gt;In Xcode choose Editor &amp;gt; Add Build Phase &amp;gt; Add Copy Files Build Phase.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2019/01/Xcode10CopyFilesBuildPhase-1.png&#34; alt=&#34;Xcode10CopyFilesBuildPhase&#34; border=&#34;0&#34; width=&#34;512&#34; height=&#34;137&#34; /&gt; &#xA;&lt;p&gt;Use the Destination menu to specify where in the app bundle to copy the files. I chose the Resources folder.&lt;/p&gt;&#xA;&lt;p&gt;If you want to copy the files into a subfolder, enter the name of the folder in the Subpath text field.&lt;/p&gt;&#xA;&lt;p&gt;Click the Add button to add the gems to the Copy Files build phase. A sheet will open. Click the Add Other button. Navigate to your gem folder location and select the gem folder containing the gems you want to add.&lt;/p&gt;&#xA;&lt;h3 id=&#34;step3:findthegemsfolderintheappbundle&#34; class=&#34;relative group&#34;&gt;Step 3: Find the gems Folder in the App Bundle &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#step3:findthegemsfolderintheappbundle&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The next step is to locate your gems folder in the app bundle so you can run the gem and set up environment variables to run the gem. You are going to use the &lt;code&gt;Bundle&lt;/code&gt; class. The &lt;code&gt;Bundle&lt;/code&gt; class has accessors to get to standard parts of the bundle, such as the Resources folder.&lt;/p&gt;&#xA;&lt;p&gt;Once you get to a standard location in the bundle, you must build a path to the folder containing your gems. The following code locates a &lt;code&gt;gems&lt;/code&gt; folder inside the Resources folder:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; resourceDirectory = Bundle.main.resourceURL {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; pathString = resourceDirectory.path &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/gems&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; URL(fileURLWithPath: pathString)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The folder containing the gems should have a &lt;code&gt;bin&lt;/code&gt; folder containing the executable files. You would build a path to the executable file and use that path as the first argument when running the gem.&lt;/p&gt;&#xA;&lt;h3 id=&#34;step4:configurethecommandtorunthegem&#34; class=&#34;relative group&#34;&gt;Step 4: Configure the Command to Run the Gem &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#step4:configurethecommandtorunthegem&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Before you can run the gem, you must configure the command to call it. Use the &lt;code&gt;Process&lt;/code&gt; class, formerly called &lt;code&gt;NSTask&lt;/code&gt;, to run a command-line program, such as a gem.&lt;/p&gt;&#xA;&lt;p&gt;Start by creating a &lt;code&gt;Process&lt;/code&gt; object.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; taskToRun = Process()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You must set up the following items:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The launch path&lt;/li&gt;&#xA;&lt;li&gt;Environment variables&lt;/li&gt;&#xA;&lt;li&gt;The arguments to pass&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Use the &lt;code&gt;launchPath&lt;/code&gt; property to set the launch path. For Ruby gems the launch path is the path to the Ruby interpreter.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;taskToRun.launchPath = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/usr/bin/ruby&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use the &lt;code&gt;environment&lt;/code&gt; property to set environment variables. An environment variable is a dictionary. For Ruby gems the environment variable key is &lt;code&gt;GEM_HOME&lt;/code&gt; and its value is the path to your gems folder.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;taskToRun.environment = [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;GEM_HOME&amp;#34;&lt;/span&gt; : gemsPath]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use the &lt;code&gt;arguments&lt;/code&gt; property to pass arguments to the gem. The &lt;code&gt;arguments&lt;/code&gt; property is an array of strings. The first argument is the path to the executable file of the gem you want to run. Add any arguments the gem requires.&lt;/p&gt;&#xA;&lt;p&gt;When supplying options as arguments, make sure you have separate entries for the option and its value. Suppose your gem has a &lt;code&gt;-o&lt;/code&gt; option followed by the name of an output file. The &lt;code&gt;-o&lt;/code&gt; is one entry. The name of the output file is a separate entry.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; argumentList = [gemExecutablePath, inputURL.path, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;-o&amp;#34;&lt;/span&gt;, outputURL.path]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;taskToRun.arguments = argumentList&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;step5:runthegem&#34; class=&#34;relative group&#34;&gt;Step 5: Run the Gem &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#step5:runthegem&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The final step is to run the gem. On macOS 10.13 and later, call the &lt;code&gt;run&lt;/code&gt; function to run the task you configured.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;try&lt;/span&gt; taskToRun.run()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;} &lt;span style=&#34;color:#66d9ef&#34;&gt;catch&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  fatalError(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Error running command line tool.&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On earlier versions of macOS, call the &lt;code&gt;launch&lt;/code&gt; function to run the task.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;taskToRun.launch()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    <item>
      <title>Xcode 10: Subversion Support Removed</title>
      <link>https://www.meandmark.com/xcode-10-subversion-support-removed/</link>
      <pubDate>Sun, 09 Dec 2018 05:01:57 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-10-subversion-support-removed/</guid>
      <description>&lt;p&gt;Xcode 10 removes support for Subversion. If you want to continue to use Subversion with Xcode, stick with Xcode 9. Alternatively, you can switch to git or use another tool for Subversion.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Making iOS Document-Based Apps</title>
      <link>https://www.meandmark.com/making-ios-document-based-apps/</link>
      <pubDate>Mon, 12 Nov 2018 20:45:26 +0000</pubDate>
      <guid>https://www.meandmark.com/making-ios-document-based-apps/</guid>
      <description>&lt;p&gt;I have a two-part tutorial on making document-based iOS apps over at &lt;a href=&#34;http://swiftdevjournal.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Swift Dev Journal&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://swiftdevjournal.com/creating-document-based-ios-apps-part-1/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Part 1&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://swiftdevjournal.com/creating-document-based-ios-apps-part-2-make-a-text-editor/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Part 2&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 10: Running Tests in Random Order</title>
      <link>https://www.meandmark.com/xcode-10-running-tests-in-random-order/</link>
      <pubDate>Tue, 06 Nov 2018 05:04:05 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-10-running-tests-in-random-order/</guid>
      <description>&lt;p&gt;In Xcode 10 you can tell Xcode to run your tests in random order. Open the scheme editor for your project and select the Test step.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/11/Xcode10RandomizeTestOrder.png&#34; alt=&#34;Xcode10RandomizeTestOrder&#34; border=&#34;0&#34; width=&#34;448&#34; height=&#34;240&#34; /&gt; &#xA;&lt;p&gt;Click the Options button next to the test target to open a popover. Select the Randomize execution order checkbox to run your tests in random order.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 10: Clean Build Folder</title>
      <link>https://www.meandmark.com/xcode-10-clean-build-folder/</link>
      <pubDate>Mon, 29 Oct 2018 18:20:15 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-10-clean-build-folder/</guid>
      <description>&lt;p&gt;In Xcode 10 you no longer need to hold down the Option key to clean the build folder. You can just choose Product &amp;gt; Clean Build Folder.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Imported and Exported UTIs</title>
      <link>https://www.meandmark.com/imported-and-exported-utis-2/</link>
      <pubDate>Wed, 24 Oct 2018 19:05:48 +0000</pubDate>
      <guid>https://www.meandmark.com/imported-and-exported-utis-2/</guid>
      <description>&lt;p&gt;If you create a document-based app project in Xcode, select the app target in the project editor, and click the Info button, you will see sections for imported and exported UTIs. If you have any of the following questions:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is a UTI?&lt;/li&gt;&#xA;&lt;li&gt;When would I use an imported UTI?&lt;/li&gt;&#xA;&lt;li&gt;When would I use an exported UTI?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Keep reading because this articles answers those questions.&lt;/p&gt;&#xA;&lt;h3 id=&#34;whatisauti&#34; class=&#34;relative group&#34;&gt;What is a UTI? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#whatisauti&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;A UTI is a Uniform Type Identifier that uniquely identifies a file type. Apple has &lt;a href=&#34;https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html#//apple_ref/doc/uid/TP40009259-SW1&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;a list of system-declared UTIs&lt;/a&gt;, but it’s not being actively maintained. For example a plain text file has the UTI &lt;code&gt;public.plain-text&lt;/code&gt;. Most common file types have &lt;code&gt;public&lt;/code&gt; at the start of their UTIs.&lt;/p&gt;&#xA;&lt;p&gt;If you create a new file type, you must create a UTI for it. The UTI should take the form &lt;code&gt;com.CompanyName.FileType&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;whentouseanimporteduti&#34; class=&#34;relative group&#34;&gt;When to Use an Imported UTI &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#whentouseanimporteduti&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Use imported UTIs when your app edits file types that it doesn’t own. Suppose you’re developing an image editor. Your image editor edits image files in multiple file formats, such as PNG, JPEG, and TIFF. You would add an imported UTI for each file type the image editor can edit.&lt;/p&gt;&#xA;&lt;h3 id=&#34;whentouseanexporteduti&#34; class=&#34;relative group&#34;&gt;When to Use an Exported UTI &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#whentouseanexporteduti&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Use an exported UTI for any file types your app owns. When you create a new file type for your app’s documents, your app owns that file type, and you should create an exported UTI for the file type. The exported UTI lets the operating system and other apps know about the new file type.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Swift Dev Journal</title>
      <link>https://www.meandmark.com/swift-dev-journal/</link>
      <pubDate>Fri, 19 Oct 2018 04:02:43 +0000</pubDate>
      <guid>https://www.meandmark.com/swift-dev-journal/</guid>
      <description>&lt;p&gt;I want to let you know about a new site I launched, &lt;a href=&#34;https://swiftdevjournal.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Swift Dev Journal&lt;/a&gt;. Swift Dev Journal has articles to help iOS and Mac developers create apps in Swift.&lt;/p&gt;&#xA;&lt;p&gt;None of the blog posts here are moving. Regarding future writing, longer articles and tutorials about iOS and Mac development will be on Swift Dev Journal. This blog will contain tips and shorter articles, such as the changes in new versions of Xcode, as well as articles that wouldn’t fit at Swift Dev Journal.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 10: Projects Use New Build System</title>
      <link>https://www.meandmark.com/xcode-10-projects-use-new-build-system/</link>
      <pubDate>Mon, 01 Oct 2018 04:02:16 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-10-projects-use-new-build-system/</guid>
      <description>&lt;p&gt;In Xcode 10 projects use the new build system by default. If you want to use the legacy build system in a project, choose File &amp;gt; Project Settings. Choose Legacy Build System from the Build System menu.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 10: See Changed Code in Editor</title>
      <link>https://www.meandmark.com/xcode-10-see-changed-code-in-editor-2/</link>
      <pubDate>Thu, 27 Sep 2018 04:03:09 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-10-see-changed-code-in-editor-2/</guid>
      <description>&lt;p&gt;If your Xcode project is under version control, Xcode’s editor highlights the changes you make to the code. When you add or change code, Xcode places a blue bar on the left edge of the editor.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/Xcode10VersionControlChangesInEditorHighlighted.png&#34; alt=&#34;Xcode10VersionControlChangesInEditorHighlighted&#34; border=&#34;0&#34; width=&#34;397&#34; height=&#34;98&#34; /&gt; &#xA;&lt;p&gt;Clicking the blue bar opens a popover to discard the change. For some reason you can’t commit changes from the editor. You can only discard changes.&lt;/p&gt;&#xA;&lt;p&gt;If you remove code, there may be a blue dot instead of a blue bar in the editor. Click the dot to discard the change and restore the code you removed.&lt;/p&gt;&#xA;&lt;h3 id=&#34;otherbarcolors&#34; class=&#34;relative group&#34;&gt;Other Bar Colors &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#otherbarcolors&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The blue bar on the left side of the editor window is the most common color you’ll see. But Xcode also has the following color bars for source control changes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A gray bar indicates changes you committed locally but did not push to a remote repository.&lt;/li&gt;&#xA;&lt;li&gt;A blue outline indicates upstream changes, changes someone else working on the project made.&lt;/li&gt;&#xA;&lt;li&gt;A red bar indicates the changes you made conflict with upsream changes.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;troubleshooting&#34; class=&#34;relative group&#34;&gt;Troubleshooting &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#troubleshooting&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you do not see colored bars on the left side of the editor, you may need to turn on showing source control changes from Xcode’s Source Control preferences.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/Xcode10SourceControlPreferences.png&#34; alt=&#34;Xcode10SourceControlPreferences&#34; border=&#34;0&#34; width=&#34;456&#34; height=&#34;284&#34; /&gt; &#xA;&lt;p&gt;Make sure the Show Source Control changes checkbox is selected. Select the Include upstream changes checkbox to see upstream changes in the editor.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 10: Improved Bitbucket and GitLab support</title>
      <link>https://www.meandmark.com/xcode-10-improved-bitbucket-and-gitlab-support-2/</link>
      <pubDate>Thu, 20 Sep 2018 04:01:11 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-10-improved-bitbucket-and-gitlab-support-2/</guid>
      <description>&lt;p&gt;Xcode 10 improves version control support for Bitbucket and GitLab. You can add your Bitbucket and GitLab accounts to Xcode from Xcode’s Accounts preferences.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/XcodeAccountsPreferencesHighlighted.png&#34; alt=&#34;XcodeAccountsPreferencesHighlighted&#34; border=&#34;0&#34; width=&#34;456&#34; height=&#34;331&#34; /&gt; &#xA;&lt;p&gt;Click the Add button to add an account. A sheet opens.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/Xcode10AddBitbucketAccount.png&#34; alt=&#34;Xcode10AddBitbucketAccount&#34; border=&#34;0&#34; width=&#34;299&#34; height=&#34;223&#34; /&gt; &#xA;&lt;p&gt;Choose Bitbucket Cloud to add your Bitbucket account. Choose GitLab.com to add your GitLab account.&lt;/p&gt;&#xA;&lt;p&gt;Starting in Xcode 10 you can add your Xcode project to Bitbucket or GitLab from Xcode. Open the Source Control navigator by choosing View &amp;gt; Navigators &amp;gt; Show Source Control Navigator. Select the Remotes folder, control-click, and choose Create Remote. A sheet opens.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/Xcode10AddBitbucketRepoHighlighted.png&#34; alt=&#34;Xcode10AddBitbucketRepoHighlighted&#34; border=&#34;0&#34; width=&#34;299&#34; height=&#34;264&#34; /&gt; &#xA;&lt;p&gt;Choose your account from the Account menu. Click the Create button to add your project to Bitbucket or GitLab.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 10: Library Moved to Toolbar</title>
      <link>https://www.meandmark.com/xcode-10-library-moved-to-toolbar/</link>
      <pubDate>Mon, 17 Sep 2018 18:26:50 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-10-library-moved-to-toolbar/</guid>
      <description>&lt;p&gt;In Xcode 10 the Library, where you access things like code snippets and user interface elements, is no longer in the lower right portion of the project window. The button to access the Library has been moved to the right side of the toolbar, next to the buttons to show the various editors.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/Xcode10LibraryButtonHighlighted.png&#34; alt=&#34;Xcode10LibraryButtonHighlighted&#34; border=&#34;0&#34; width=&#34;298&#34; height=&#34;28&#34; /&gt; &#xA;&lt;p&gt;Click the Library button to open the Library in a separate window. Option-clicking the Library button keeps the window open, which helps a lot when you’re building your app’s user interface.&lt;/p&gt;&#xA;&lt;p&gt;The specific library that opens depends on the file you’re currently viewing/editing. If you’re in a source code file, clicking the Library button will open the code snippets library. If you’re in a xib file or storyboard, clicking the Library button will open the object library that contains the UI elements.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Supporting Dynamic Type in iOS Text Views</title>
      <link>https://www.meandmark.com/supporting-dynamic-type-in-ios-text-views-2/</link>
      <pubDate>Mon, 10 Sep 2018 04:12:51 +0000</pubDate>
      <guid>https://www.meandmark.com/supporting-dynamic-type-in-ios-text-views-2/</guid>
      <description>&lt;p&gt;Dynamic Type on iOS lets people adjust the size of text to make text easier to read. Someone with poor eyesight can use larger text if the app supports Dynamic Type.&lt;/p&gt;&#xA;&lt;p&gt;You can support Dynamic Type in your iOS app without writing any code. You have to do the following things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use plain text in the text view.&lt;/li&gt;&#xA;&lt;li&gt;Tell the text view to support Dynamic Type in Interface Builder.&lt;/li&gt;&#xA;&lt;li&gt;Choose a Dynamic Type text style as the text view’s font.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You can perform all these tasks from the attributes inspector in Interface Builder. Select your text view from the storyboard or xib file.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/TextViewDynamicTypeIB.png&#34; alt=&#34;TextViewDynamicTypeIB&#34; border=&#34;0&#34; width=&#34;279&#34; height=&#34;183&#34; /&gt; &#xA;&lt;p&gt;To use plain text in the text view, choose Plain from the Text menu.&lt;/p&gt;&#xA;&lt;p&gt;Select the Dynamic Type checkbox to support Dynamic Type. If you build your project at this point, you will most likely get the following warning in Xcode:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Automatically Adjusts Font requires using a Dynamic Type text style&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Text views in iOS Xcode projects initially use the system font, which does not support Dynamic Type. You must change the font to use a Dynamic Type text style. Click the button on the right side in the Font text field to open a popover to change the font.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/TextViewFontPopover.png&#34; alt=&#34;TextViewFontPopover&#34; border=&#34;0&#34; width=&#34;299&#34; height=&#34;157&#34; /&gt; &#xA;&lt;p&gt;Use the Font menu to select a text style. There’s a Text Styles group of menu items. Choose one of them as the font for the text view to support Dynamic Type.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Linker command failed with exit code 1</title>
      <link>https://www.meandmark.com/linker-command-failed-with-exit-code-1/</link>
      <pubDate>Thu, 06 Sep 2018 04:41:05 +0000</pubDate>
      <guid>https://www.meandmark.com/linker-command-failed-with-exit-code-1/</guid>
      <description>&lt;p&gt;If you have done any programming in Xcode, you have come across the following error message when building your project:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Linker command failed with exit code 1.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This error message is frustrating because it tells you nothing besides the fact the linker command failed. You want to know what the real error is so you can fix it.&lt;/p&gt;&#xA;&lt;h3 id=&#34;findtherealerror&#34; class=&#34;relative group&#34;&gt;Find the Real Error &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#findtherealerror&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The first step to fixing a link error is to find out what the real error is. To find the real error, open Xcode’s report navigator by choosing View &amp;gt; Navigator &amp;gt; Show Report Navigator.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/ReportNavigatorXcode9.png&#34; alt=&#34;ReportNavigatorXcode9&#34; border=&#34;0&#34; width=&#34;269&#34; height=&#34;157&#34; /&gt; &#xA;&lt;p&gt;The report navigator shows recent builds. If you have a linker error, there will be a red icon next to the build, which you can see in the screenshot. Select the build to see the build transcript, the list of steps Xcode took to build the project.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/BuildLogHighlighted.png&#34; alt=&#34;BuildLogHighlighted&#34; border=&#34;0&#34; width=&#34;299&#34; height=&#34;205&#34; /&gt; &#xA;&lt;p&gt;If you have a link error, the build transcript will provide the real error message. Selecting a step from the build transcript makes a little button appear next to the step (The screenshot arrow is pointing to the button). Click that button to see a more detailed build log for that step.&lt;/p&gt;&#xA;&lt;p&gt;The two most common link errors are undefined symbol and duplicate symbol.&lt;/p&gt;&#xA;&lt;h3 id=&#34;undefinedsymbolerror&#34; class=&#34;relative group&#34;&gt;Undefined Symbol Error &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#undefinedsymbolerror&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;An undefined symbol link error occurs when the linker cannot find a data structure name or a function name. The most common cause of an undefined symbol error is a missing framework or library that contains the symbol. Some things to check to fix an undefined symbol error include the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Make sure you added the library or framework to your project.&lt;/li&gt;&#xA;&lt;li&gt;Make sure the library or framework you added is in the Link Binary with Libraries build phase.&lt;/li&gt;&#xA;&lt;li&gt;If you’re coding in Swift, make sure you imported the library or framework in your code with the &lt;code&gt;import&lt;/code&gt; statement.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/LinkBinaryBuildPhase.png&#34; alt=&#34;LinkBinaryBuildPhase&#34; border=&#34;0&#34; width=&#34;299&#34; height=&#34;155&#34; /&gt; &#xA;&lt;h4 id=&#34;headerfiles&#34; class=&#34;relative group&#34;&gt;Header Files &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#headerfiles&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;If you’re coding in a language that uses header files, working with header files is another big cause of undefined symbol link errors. Make sure you include the header properly. A common error in C or C++ code is to include a header file that’s not a system header with angle brackets.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;MyHeader.h&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Xcode won’t be able to find &lt;code&gt;MyHeader.h&lt;/code&gt; in this case because the header is not a system header. Use quotes to include the header file.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;quot;MyHeader.h&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h4 id=&#34;searchpaths&#34; class=&#34;relative group&#34;&gt;Search Paths &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#searchpaths&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;If none of the fixes I mentioned earlier work, you may need to add search paths for the library, framework, or header file so Xcode can find them. Xcode has a Search Paths collection of build settings, which you can access from the project editor.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/SearchPathsBuildSettings.png&#34; alt=&#34;SearchPathsBuildSettings&#34; border=&#34;0&#34; width=&#34;299&#34; height=&#34;145&#34; /&gt; &#xA;&lt;h3 id=&#34;duplicatesymbolerror&#34; class=&#34;relative group&#34;&gt;Duplicate Symbol Error &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#duplicatesymbolerror&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;A duplicate symbol error occurs when the linker finds two or more data structures or functions with the same name. People using Xcode to learn C++ can run into this error if they create a command-line tool project. The command-line tool project includes a &lt;code&gt;main.cpp&lt;/code&gt; file that has a &lt;code&gt;main&lt;/code&gt; function in it. If you add a new file with its own &lt;code&gt;main&lt;/code&gt; function and forget to remove the one Xcode created for you, you get a duplicate symbol error.&lt;/p&gt;&#xA;&lt;p&gt;When trying to fix a duplicate symbol error, the first thing to check is that you haven’t defined a symbol twice in your project. Xcode’s find navigator helps you find all occurrences of a given symbol in your project.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/09/FindNavigator.png&#34; alt=&#34;FindNavigator&#34; border=&#34;0&#34; width=&#34;269&#34; height=&#34;102&#34; /&gt; &#xA;&lt;p&gt;If you’re using external frameworks or libraries, make sure your symbol names aren’t duplicates of symbols in the framework or library. If you are using custom namespaces in your code, make sure you set up the namespaces properly.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating a Keyboard Input Accessory View</title>
      <link>https://www.meandmark.com/creating-a-keyboard-input-accessory-view/</link>
      <pubDate>Fri, 10 Aug 2018 19:22:32 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-a-keyboard-input-accessory-view/</guid>
      <description>&lt;p&gt;In this article you’ll learn about keyboard input accessory views and how to add them to your iOS app to make text editing smoother.&lt;/p&gt;&#xA;&lt;p&gt;Adding a keyboard input accessory view isn’t too difficult. Add a new xib file to your project for the view. Load the view from the xib file. Set the input accessory view to the view you loaded. There’s less than 10 lines of code involved.&lt;/p&gt;&#xA;&lt;h3 id=&#34;whatisakeyboardinputaccessoryview&#34; class=&#34;relative group&#34;&gt;What Is a Keyboard Input Accessory View? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#whatisakeyboardinputaccessoryview&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;A keyboard input accessory view is a view that appears above the iOS onscreen keyboard. The default iOS behavior is to have no input accessory view, but nothing is stopping you from adding one. A common use of an input accessory view is to show a toolbar with frequently used commands when typing text. The writing app Ulysses uses an input accessory view to insert Markdown characters into the text. If you were writing an iOS HTML editor, you could show a toolbar with buttons to insert the most common HTML tags.&lt;/p&gt;&#xA;&lt;p&gt;Keep in mind that a keyboard input accessory view has type &lt;code&gt;UIView?&lt;/code&gt;, which means the accessory view can be any kind of view. The accessory view does not have to be a toolbar. I’m using a toolbar as an example in this article because many apps have a toolbar as the accessory view.&lt;/p&gt;&#xA;&lt;h3 id=&#34;step1:createaxibfilefortheaccessoryview&#34; class=&#34;relative group&#34;&gt;Step 1: Create a Xib File for the Accessory View &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#step1:createaxibfilefortheaccessoryview&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The first step in creating a keyboard input accessory view is to create a new xib file and add it to your project. In Xcode choose File &amp;gt; New &amp;gt; File to add a new file to your project. The xib file templates are in the User Interface section under iOS.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/08/AddNewiOSXibFile.png&#34; alt=&#34;AddNewiOSXibFile&#34; border=&#34;0&#34; width=&#34;598&#34; height=&#34;439&#34; /&gt; &#xA;&lt;p&gt;The empty xib file is the best option for toolbars. If you want a custom view for the accessory view, you can choose View instead of Empty.&lt;/p&gt;&#xA;&lt;h3 id=&#34;step2:addtheaccessoryviewtothexibfile&#34; class=&#34;relative group&#34;&gt;Step 2: Add the Accessory View to the Xib File &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#step2:addtheaccessoryviewtothexibfile&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Take a toolbar (or whatever kind of view you want to use) from the object library and drag it to the canvas. The toolbar has one item in it. Add bar button items to the toolbar to fill the toolbar.&lt;/p&gt;&#xA;&lt;p&gt;While you’re in Interface Builder go to the identity inspector and set the class for the File’s Owner object in the xib file.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/08/FilesOwnerClassBlurred.png&#34; alt=&#34;FilesOwnerClassBlurred&#34; border=&#34;0&#34; width=&#34;285&#34; height=&#34;127&#34; /&gt; &#xA;&lt;p&gt;Set the class to the view controller where you’re going to use the input accessory view. By setting the File’s Owner class to the view controller, you will be able to connect the controls in the input accessory view to IBActions in the view controller to respond to tapping the controls. In the xib file make a connection from the controls to File’s Owner to connect to IBActions.&lt;/p&gt;&#xA;&lt;h3 id=&#34;step3:loadtheaccessoryviewfromthexibfile&#34; class=&#34;relative group&#34;&gt;Step 3: Load the Accessory View from the Xib File &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#step3:loadtheaccessoryviewfromthexibfile&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now it’s time to write some code to load the input accessory view. Call the Bundle class’s &lt;code&gt;loadNibNamed&lt;/code&gt; function to load a xib file from the app bundle. Supply the name of the xib file as the first argument. Pass &lt;code&gt;self&lt;/code&gt; as the &lt;code&gt;owner&lt;/code&gt; argument, and pass &lt;code&gt;nil&lt;/code&gt; as the &lt;code&gt;options&lt;/code&gt; argument.&lt;/p&gt;&#xA;&lt;p&gt;Calling &lt;code&gt;loadNibNamed&lt;/code&gt; returns an array of the top level objects in the xib file. The input accessory view is the only top level object in the xib file you created so accessing the view is easy. Use the &lt;code&gt;first&lt;/code&gt; property to access the first item in the array and grab the accessory view. The last code to write is to set the text view’s input accessory view to the view you loaded from the xib file. The following function sets up an input accessory view for a toolbar:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func setupInputAccessoryView() {&#xA;    let nibContents = Bundle.main.loadNibNamed(&amp;quot;KeyboardInputAccessoryView&amp;quot;, &#xA;        owner: self, options: nil)&#xA;    if let toolbar = nibContents?.first as? UIToolbar {&#xA;        textView.inputAccessoryView = toolbar&#xA;    }    &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;conclusion&#34; class=&#34;relative group&#34;&gt;Conclusion &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#conclusion&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;There’s no more code to write. If you build your project and show the keyboard, the toolbar will appear at the top of the keyboard.&lt;/p&gt;&#xA;&lt;p&gt;I noticed a bug in the iOS 11 Simulator where the toolbar would stay at the bottom of the screen after dismissing the keyboard. I did not run into this issue on iOS devices. If the toolbar is not going away, set the &lt;code&gt;isHidden&lt;/code&gt; property of the input accessory view to &lt;code&gt;true&lt;/code&gt; when dismissing the keyboard. Set &lt;code&gt;isHidden&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; when showing the keyboard.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Make UIDocument File Wrapper Appear as Single File</title>
      <link>https://www.meandmark.com/make-uidocument-file-wrapper-appear-as-single-file/</link>
      <pubDate>Fri, 03 Aug 2018 04:06:30 +0000</pubDate>
      <guid>https://www.meandmark.com/make-uidocument-file-wrapper-appear-as-single-file/</guid>
      <description>&lt;p&gt;I was recently working on an iOS document-based app that saves the document in a file wrapper. When I looked in the document browser, the document appeared as a folder instead of a single file. For Mac document types Xcode has a checkbox to select to make the document appear as a single file, but iOS document types do not have this checkbox. How do you make the document appear as a single file?&lt;/p&gt;&#xA;&lt;p&gt;To make the document appear as a single file in the document browser, the document’s exported UTI must conform to the UTI &lt;code&gt;com.apple.package&lt;/code&gt;. In Xcode’s project editor, add &lt;code&gt;com.apple.package&lt;/code&gt; to the Conforms To text field for the exported UTI.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/08/ExportedUTIFileWrappersHighlighted.png&#34; alt=&#34;ExportedUTIFileWrappersHighlighted&#34; border=&#34;0&#34; width=&#34;598&#34; height=&#34;241&#34; /&gt; &#xA;&lt;p&gt;Rebuild your project. Any documents you save should appear as single files instead of folders.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Working with File Wrappers in Swift</title>
      <link>https://www.meandmark.com/working-with-file-wrappers-in-swift/</link>
      <pubDate>Tue, 17 Jul 2018 20:14:42 +0000</pubDate>
      <guid>https://www.meandmark.com/working-with-file-wrappers-in-swift/</guid>
      <description>&lt;p&gt;Back in 2010 I wrote an &lt;a href=&#34;https://meandmark.com/blog/2010/10/working-with-cocoa-file-packages/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;article on working with file wrappers&lt;/a&gt;. Recently I needed to work with file wrappers, and I noticed the file wrapper code is much different in Swift so I figured working with file wrappers in Swift would be a good topic for an article.&lt;/p&gt;&#xA;&lt;p&gt;This article assumes you’re creating a document-based application. I have only used file wrappers in document-based applications.&lt;/p&gt;&#xA;&lt;h3 id=&#34;whatisafilewrapper&#34; class=&#34;relative group&#34;&gt;What Is a File Wrapper? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#whatisafilewrapper&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;A file wrapper is a bundle, which is a collection of one or more directories that looks like a single file in the Finder. Most Mac applications are bundles. You can examine their contents by selecting an application, right-clicking, and choosing Show Package Contents.&lt;/p&gt;&#xA;&lt;p&gt;When should you use a file wrapper? Use a file wrapper when you want to save your application’s document data in multiple files. A level editor for a game may want to save the level layout, the level’s enemy list, and the level’s treasure list in separate files.&lt;/p&gt;&#xA;&lt;p&gt;The simplest file wrapper is a single directory that stores all the files. But you can create multiple directories to store your files to keep them better organized.&lt;/p&gt;&#xA;&lt;p&gt;There are three tasks to perform to add file package support to a document-based application. First, you must tell Xcode that your document type is a file wrapper. Second, you must implement the &lt;code&gt;fileWrapperOfType&lt;/code&gt; method in your &lt;code&gt;NSDocument&lt;/code&gt; subclass to save to a file wrapper. Third, you must implement the &lt;code&gt;readFromFileWrapper&lt;/code&gt; method in your &lt;code&gt;NSDocument&lt;/code&gt; subclass to open a file wrapper and read its contents.&lt;/p&gt;&#xA;&lt;h3 id=&#34;makingyourdocumenttypeafilewrapper&#34; class=&#34;relative group&#34;&gt;Making Your Document Type a File Wrapper &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#makingyourdocumenttypeafilewrapper&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;You can access your document type from Xcode’s project editor.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select your project from the project navigator to open the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Select the application target from the target list on the left side of the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Click the Info button at the top of the project editor.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/07/DocumentTypeAsBundleHighlighted.png&#34; alt=&#34;DocumentTypeAsBundleHighlighted&#34; border=&#34;0&#34; width=&#34;598&#34; height=&#34;183&#34; /&gt; &#xA;&lt;p&gt;Go to the Document Types section and select the Bundle checkbox. Now your document will be saved as a file wrapper.&lt;/p&gt;&#xA;&lt;h3 id=&#34;writingadocumentfilewrapper&#34; class=&#34;relative group&#34;&gt;Writing a Document File Wrapper &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#writingadocumentfilewrapper&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To write a document file wrapper, you must override and implement the &lt;code&gt;fileWrapperOfType&lt;/code&gt; method. Here is the Swift signature for &lt;code&gt;fileWrapperOfType&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;override func fileWrapper(ofType typeName: String) throws -&amp;gt; FileWrapper&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The file wrapper &lt;code&gt;fileWrapperOfType&lt;/code&gt; returns is the root directory for the file wrapper.&lt;/p&gt;&#xA;&lt;p&gt;In your implementation of &lt;code&gt;fileWrapperOfType&lt;/code&gt;, you must perform the following tasks:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a directory file wrapper.&lt;/li&gt;&#xA;&lt;li&gt;Get your app’s data into a &lt;code&gt;Data&lt;/code&gt; object.&lt;/li&gt;&#xA;&lt;li&gt;Create a file wrapper and add the file to a directory file wrapper.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;creatingadirectoryfilewrapper&#34; class=&#34;relative group&#34;&gt;Creating a Directory File Wrapper &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#creatingadirectoryfilewrapper&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;At a minimum you must create a root directory for the file wrapper. To create a directory in a file wrapper, call the &lt;code&gt;FileWrapper&lt;/code&gt; method &lt;code&gt;directoryWithFileWrappers&lt;/code&gt; and supply an empty Swift dictionary.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let rootDirectory = FileWrapper(directoryWithFileWrappers: [:])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to add any other directories to your file wrapper, call &lt;code&gt;directoryWithFileWrappers&lt;/code&gt; again and supply an empty Swift dictionary.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let htmlDirectory = FileWrapper(directoryWithFileWrappers: [:])&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The root directory in a file wrapper does not need a name, but any other directories you create need a name. Set the &lt;code&gt;filename&lt;/code&gt; or &lt;code&gt;preferredFilename&lt;/code&gt; property for the directory file wrapper to name the directory. The following code gives the HTML directory the name HTML:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;htmlDirectory.filename = &amp;quot;HTML&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h4 id=&#34;gettingyourdataintoadataobject&#34; class=&#34;relative group&#34;&gt;Getting Your Data into a Data Object &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#gettingyourdataintoadataobject&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Files in file wrappers store their data in a &lt;code&gt;Data&lt;/code&gt; (formerly &lt;code&gt;NSData&lt;/code&gt;) object. Converting to &lt;code&gt;Data&lt;/code&gt; depends on what you are storing, but the following code converts a string to &lt;code&gt;Data&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let htmlData = htmlString.data(using: .utf8)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h4 id=&#34;creatingafilewrapper&#34; class=&#34;relative group&#34;&gt;Creating a File Wrapper &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#creatingafilewrapper&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;To create a file wrapper for a regular file, call the &lt;code&gt;FileWrapper&lt;/code&gt; method &lt;code&gt;regularFileWithContents&lt;/code&gt; and supply the &lt;code&gt;Data&lt;/code&gt; object that contains the file’s data.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let wrapper = FileWrapper(regularFileWithContents: htmlData)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Set the &lt;code&gt;filename&lt;/code&gt; or &lt;code&gt;preferredFilename&lt;/code&gt; property to name the file.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;wrapper.filename = &amp;quot;index.html&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In a real app you won’t be hardcoding filenames much. Suppose you have a document that has a list of articles. You would use the title of the article as the filename instead of giving the file a specific name. Remember that you use file wrappers to store multiple files. If you have 20 files to save, hardcoding the name of each file is going to be a pain.&lt;/p&gt;&#xA;&lt;p&gt;After creating the file wrapper, call the directory’s &lt;code&gt;addFileWrapper&lt;/code&gt; method to add it to the directory.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;htmlDirectory.addFileWrapper(wrapper)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Call &lt;code&gt;addFileWrapper&lt;/code&gt; to add a subdirectory to a file wrapper. The following code adds the HTML directory to the root directory:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;rootDirectory.addFileWrapper(htmlDirectory)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;readingfromafilewrapper&#34; class=&#34;relative group&#34;&gt;Reading from a File Wrapper &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#readingfromafilewrapper&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;At this point you know how to write to a file wrapper. The next step is to read the file wrapper. To read the file wrapper, you must override the &lt;code&gt;readFromFileWrapper&lt;/code&gt; method. Here is the signature for &lt;code&gt;readFromFileWrapper&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;override func read(from fileWrapper: FileWrapper, ofType typeName: String) throws&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;fileWrapper&lt;/code&gt; argument is the root directory of the file wrapper.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;fileWrappers&lt;/code&gt; property contains the contents of a file wrapper. The contents appear in a Swift dictionary, where the key is the name of a file or directory and the value is a file wrapper, which can be either a file or a directory.&lt;/p&gt;&#xA;&lt;p&gt;To access a directory or file from the dictionary, supply the key as the dictionary subscript. The following code shows how to access a HTML directory inside the root file wrapper:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;if let wrappers = fileWrapper.fileWrappers {&#xA;    let htmlDirectory = wrappers[&amp;quot;HTML&amp;quot;]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Make sure the subscript you supply matches the filename or preferred filename you gave to the file or directory. If you make a typing mistake, you won’t be able to read from the file wrapper.&lt;/p&gt;&#xA;&lt;h4 id=&#34;readingtheindividualfiles&#34; class=&#34;relative group&#34;&gt;Reading the Individual Files &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#readingtheindividualfiles&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Use the &lt;code&gt;fileWrappers&lt;/code&gt; property to access the individual files in a file wrapper directory. The following code provides a list of files inside a HTML directory:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;htmlFiles = htmlDirectory.fileWrappers&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The contents appear in a Swift dictionary, where the key contains the name of the file and the value contains a file wrapper.&lt;/p&gt;&#xA;&lt;p&gt;Use the &lt;code&gt;regularFileContents&lt;/code&gt; property to access the contents of a file. The &lt;code&gt;regularFileContents&lt;/code&gt; property has type &lt;code&gt;Data?&lt;/code&gt;, which means it’s either a &lt;code&gt;Data&lt;/code&gt; object or nil. By using &lt;code&gt;regularFileContents&lt;/code&gt;, you can get the &lt;code&gt;Data&lt;/code&gt; object.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;if let homepage = htmlFiles[&amp;quot;index.html&amp;quot;] {&#xA;    let homepageData = homepage.regularFileContents&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h4 id=&#34;loadingthedata&#34; class=&#34;relative group&#34;&gt;Loading the Data &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#loadingthedata&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Accessing the file wrapper’s &lt;code&gt;regularFileContents&lt;/code&gt; property gives you a &lt;code&gt;Data&lt;/code&gt; object to load the file’s contents in your app. Loading the file’s contents depends on the type of data being stored, but the following code loads a file’s contents into a string variable:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let htmlString = String(data: homepageData, encoding: .utf8)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode Turns on the App Sandbox for New Cocoa Projects</title>
      <link>https://www.meandmark.com/xcode-turns-on-the-app-sandbox-for-new-cocoa-projects/</link>
      <pubDate>Wed, 11 Jul 2018 04:01:09 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-turns-on-the-app-sandbox-for-new-cocoa-projects/</guid>
      <description>&lt;p&gt;I ran into an issue with a new document-based Cocoa app throwing exceptions when I tried to save the document. It turns out the issue was the App Sandbox, which is turned on when you create a new Cocoa application project in Xcode.&lt;/p&gt;&#xA;&lt;p&gt;You can see the App Sandbox settings by selecting your project from the project navigator to open the project editor. Select your target and click the Capabilities button at the top of the editor. The following screenshot shows the initial settings:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;https://meandmark.com/blog/wp-content/uploads/2018/07/AppSandboxDefaultSettingsHighlighted.png&#34; alt=&#34;AppSandboxDefaultSettingsHighlighted&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;430&#34; /&gt; &#xA;&lt;p&gt;Notice that the App Sandbox initially doesn’t give your app access to anything. It won’t let you print or make any network connections. Surprisingly the App Sandbox does not initially give you permission to open a Save panel to let someone choose where to save a document on their Mac. Apparently opening a Save panel is insecure. Access to user selected files is read only initially. To allow a Save panel to open, you must change the permission for user selected files to Read/Write.&lt;/p&gt;&#xA;&lt;h3 id=&#34;summary&#34; class=&#34;relative group&#34;&gt;Summary &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#summary&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If Xcode is throwing exceptions when your Cocoa app does simple things like print, open a Save panel, or show a website in a web view, it might not be a problem in your code. It might be the App Sandbox.&lt;/p&gt;&#xA;&lt;p&gt;There are two ways to work around the App Sandbox. The first workaround is to turn off the App Sandbox. The second workaround is to give your app permission to do things like print and display web content in the App Sandbox.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Getting Started with Unit Testing in Swift 4</title>
      <link>https://www.meandmark.com/getting-started-with-unit-testing-in-swift-4-2/</link>
      <pubDate>Wed, 13 Jun 2018 19:07:56 +0000</pubDate>
      <guid>https://www.meandmark.com/getting-started-with-unit-testing-in-swift-4-2/</guid>
      <description>&lt;p&gt;One of the most read articles on this blog is &lt;a href=&#34;http://meandmark.com/blog/2014/07/an-introduction-to-swift-unit-testing/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;An Introduction to Swift Unit Testing&lt;/a&gt;. The article is almost four years old and uses Swift 1. Because of that I have decided to build upon that article here, updating the code to Swift 4 and adding an example project to unit test.&lt;/p&gt;&#xA;&lt;h3 id=&#34;theproject&#34; class=&#34;relative group&#34;&gt;The Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#theproject&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I am going to add unit tests to TemperatureConverter, a project that converts temperatures from Celsius to Fahrenheit. I wrote TemperatureConverter as an introduction to Cocoa in my &lt;a href=&#34;http://meandmark.com/blog/2017/03/creating-a-simple-mac-application-using-cocoa-swift-and-storyboards/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Creating a Simple Mac Application Using Cocoa, Swift, and Storyboards&lt;/a&gt; article. You can either go through the article and create the project, or you can &lt;a href=&#34;https://github.com/meandmark/TemperatureConverter&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;download the project from GitHub&lt;/a&gt;. The &lt;code&gt;unit-testing&lt;/code&gt; branch contains the unit tests.&lt;/p&gt;&#xA;&lt;p&gt;If you go through the article and create the project, make sure you select the Include Unit Tests checkbox when creating the project. You need a unit test target to do unit testing in Xcode.&lt;/p&gt;&#xA;&lt;p&gt;Whether you follow the article and create the project or download it from GitHub, keep in mind that I removed the UI test target in my version of the project. I don’t want the additional target to get in the way. If you download the project from GitHub and keep the UI test target, you may get build errors when you unit test. The errors occur because I set the deployment target of the project to macOS 10.10, but Xcode UI tests require 10.11. Either change the deployment target to 10.11 or remove the UI test target from the project.&lt;/p&gt;&#xA;&lt;h3 id=&#34;theunittests&#34; class=&#34;relative group&#34;&gt;The Unit Tests &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#theunittests&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;In the course of this article, I’m going to add the following unit tests to the TemperatureConverter project:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A test that the freezing point of water is 32 degrees Fahrenheit.&lt;/li&gt;&#xA;&lt;li&gt;A test that the boiling point of water is 212 degrees Fahrenheit.&lt;/li&gt;&#xA;&lt;li&gt;A test for negative Celsius temperatures.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;theunittestfile&#34; class=&#34;relative group&#34;&gt;The Unit Test File &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#theunittestfile&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you create a project in Xcode that has a unit test target, Xcode creates a unit test file for you. Select the file &lt;code&gt;TemperatureConverterTests.swift&lt;/code&gt; to open the unit test file. You should see the following test functions:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;setUp&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;tearDown&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;testExample&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;testPerformanceExample&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You can remove the &lt;code&gt;testExample&lt;/code&gt; and &lt;code&gt;testPerformanceExample&lt;/code&gt; functions. You’re not going to use them.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;setUp&lt;/code&gt; function gets called before every test. If you need to initialize some properties before running your tests, put that code in &lt;code&gt;setUp&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;tearDown&lt;/code&gt; function gets called after every test. If there’s any cleanup work to do after running your tests, put that code in &lt;code&gt;tearDown&lt;/code&gt;. I’m not going to use &lt;code&gt;setUp&lt;/code&gt; or &lt;code&gt;tearDown&lt;/code&gt; in this article.&lt;/p&gt;&#xA;&lt;p&gt;Make sure you see the following line of code before the declaration of the unit testing class:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@testable import TemperatureConverter&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you don’t see it, add that line of code. You need to import the module for the app so you can access the app’s classes in your unit tests.&lt;/p&gt;&#xA;&lt;h3 id=&#34;thefirstunittest&#34; class=&#34;relative group&#34;&gt;The First Unit Test &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#thefirstunittest&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now it’s time to write the first unit test. Swift unit test functions have the following properties:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;They start with the word &lt;code&gt;test&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;They take no arguments.&lt;/li&gt;&#xA;&lt;li&gt;They return no value.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The first unit test is going to test the freezing point of water. You have to perform the following steps to create the unit test:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a view controller because the view controller contains the function to convert the temperature.&lt;/li&gt;&#xA;&lt;li&gt;Supply a Celsius temperature, which will be 0 for this test.&lt;/li&gt;&#xA;&lt;li&gt;Convert the Celsius temperature to Fahrenheit.&lt;/li&gt;&#xA;&lt;li&gt;Perform an assertion that the converted temperature equals the freezing point of water.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Xcode unit test assertions start with &lt;code&gt;XCTAssert&lt;/code&gt;. If you type &lt;code&gt;XCTAssert&lt;/code&gt; in Xcode, the code completion should show you a list of all the possible assertions. The assertion to call for the first test is &lt;code&gt;XCTAssertEqual&lt;/code&gt;. &lt;code&gt;XCTAssertEqual&lt;/code&gt; asserts that two values are equal. Swift has multiple versions of &lt;code&gt;XCTAssertEqual&lt;/code&gt;. The version I use takes the following arguments:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Two floating-point values.&lt;/li&gt;&#xA;&lt;li&gt;An accuracy threshold to determine if the two values are equal. Floating-point math can result in values with slight differences, such as giving you the value 31.99999999 instead of 32.0. With a suitable accuracy threshold, 31.99999999 and 32.0 will test as equal.&lt;/li&gt;&#xA;&lt;li&gt;An error message that appears if the test fails.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If this test fails, you want to know what the converted temperature is. To print the value of a variable in an error message, use the following notation:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;\(variableName)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The following is the initial version of the test to make sure the test fails:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func testWaterFreezingPoint() {&#xA;    let vc = ViewController()&#xA;    let celsiusTemperature = Float(0)&#xA;    let fahrenheitFreezingPoint = Float(40)&#xA;&#xA;    let fahrenheitTemperature = vc.convert(celsius: celsiusTemperature)&#xA;    XCTAssertEqual(fahrenheitTemperature, fahrenheitFreezingPoint, accuracy: 0.01, &#xA;        &amp;quot;The freezing point of water should be 40 degrees Fahrenheit. &#xA;        Fahrenheit Temperature: \(fahrenheitTemperature)&amp;quot;)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To run the test choose Product &amp;gt; Test in Xcode. The test should fail with an error message telling you that the Fahrenheit temperature is 32.0 degrees. Click the Red icon on the right side of the editor to see the error message. To make the test pass, change the value of &lt;code&gt;fahrenheitFreezingPoint&lt;/code&gt; from 40 to 32. You should also change the error message in the assertion to say that the freezing point of water should be 32 degrees.&lt;/p&gt;&#xA;&lt;p&gt;After making the corrections, choose Product &amp;gt; Test. The test should pass. By supplying the value 0.01 for the &lt;code&gt;accuracy&lt;/code&gt; argument, the test will pass if the converted temperature is greater than 31.99 and less than 32.01.&lt;/p&gt;&#xA;&lt;h2 id=&#34;thesecondunittest&#34; class=&#34;relative group&#34;&gt;The Second Unit Test &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#thesecondunittest&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The second test tests the boiling point of water. It’s going to be similar to the first test.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a view controller because the view controller contains the function to convert the temperature.&lt;/li&gt;&#xA;&lt;li&gt;Supply a Celsius temperature, which will be 100 for this test.&lt;/li&gt;&#xA;&lt;li&gt;Convert the Celsius temperature to Fahrenheit.&lt;/li&gt;&#xA;&lt;li&gt;Perform an assertion that the converted temperature equals the boiling point of water.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The main difference is using the boiling point of water instead of the freezing point. The following code tests the boiling point of water and should pass:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func testWaterBoilingPoint() {&#xA;    let vc = ViewController()&#xA;    let celsiusTemperature = Float(100)&#xA;    let fahrenheitBoilingPoint = Float(212)&#xA;&#xA;    let fahrenheitTemperature = vc.convert(celsius: celsiusTemperature)&#xA;    XCTAssertEqual(fahrenheitTemperature, fahrenheitBoilingPoint, accuracy: 0.01, &#xA;        &amp;quot;The boiling point of water should be 212 degrees Fahrenheit. &#xA;        Fahrenheit Temperature: \(fahrenheitTemperature)&amp;quot;)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;thefinalunittest&#34; class=&#34;relative group&#34;&gt;The Final Unit Test &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#thefinalunittest&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I have one last test to write for this article. The first two tests used non-negative Celsius temperatures. The last test uses a negative Celsius temperature to see if the temperature conversion works.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func testNegativeCelsiusTemperature() {&#xA;    let vc = ViewController()&#xA;    let celsiusTemperature = Float(-10)&#xA;    let fahrenheitExpected = Float(14)&#xA;&#xA;    let fahrenheitTemperature = vc.convert(celsius: celsiusTemperature)&#xA;    XCTAssertEqual(fahrenheitTemperature, fahrenheitExpected, accuracy: 0.01, &#xA;        &amp;quot;-10 degrees Celsius should equal 14 degrees Fahrenheit. &#xA;        Fahrenheit Temperature: \(fahrenheitTemperature)&amp;quot;)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I supply a temperature of –10 degrees Celsius, which should convert to 14 degrees Fahrenheit.&lt;/p&gt;&#xA;&lt;h3 id=&#34;wheretogofromhere&#34; class=&#34;relative group&#34;&gt;Where to Go from Here? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#wheretogofromhere&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Three tests do not make an exhaustive test suite. You can practice creating unit tests by adding to the three tests I wrote in this article. I can think of at least two more tests to write: one to test a Celsius temperature that yields a non-integer Fahrenheit temperature and one to test a non-integer Celsius temperature.&lt;/p&gt;&#xA;&lt;p&gt;To learn more about unit testing with XCTest, read the &lt;a href=&#34;https://developer.apple.com/documentation/xctest&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;XCTest documentation&lt;/a&gt;, which you can also read in Xcode.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Resources for Creating Custom Instruments with Xcode 10</title>
      <link>https://www.meandmark.com/resources-for-creating-custom-instruments-with-xcode10/</link>
      <pubDate>Mon, 11 Jun 2018 04:01:09 +0000</pubDate>
      <guid>https://www.meandmark.com/resources-for-creating-custom-instruments-with-xcode10/</guid>
      <description>&lt;p&gt;At WWDC 2018 Apple unveiled improved support for creating custom instruments for Instruments. The following list contains helpful resources from Apple on how to create custom instruments:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;a href=&#34;https://developer.apple.com/videos/play/wwdc2018/410/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Creating Custom Instruments&lt;/a&gt; WWDC video is the best guide currently available for creating custom instruments.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&#34;https://developer.apple.com/videos/play/wwdc2018/405/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Measuring Performance Using Logging&lt;/a&gt; WWDC video shows how to use logging signposts to measure areas of your code in a custom instrument.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&#34;https://help.apple.com/instruments/developer/mac/10.0/#/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Instruments Developer Help documentation&lt;/a&gt; provides a lower-level reference for creating custom instruments.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
    </item>
    <item>
      <title>Is There a More Misused Stack Overflow Tag than Xcode?</title>
      <link>https://www.meandmark.com/is-there-a-more-misused-stack-overflow-tag-than-xcode-2/</link>
      <pubDate>Fri, 08 Jun 2018 19:40:03 +0000</pubDate>
      <guid>https://www.meandmark.com/is-there-a-more-misused-stack-overflow-tag-than-xcode-2/</guid>
      <description>&lt;p&gt;I tend to focus on Stack Overflow tags in the Apple ecosystem so there may be other tags that are misused. But for Apple developers the Xcode tag is misused constantly. If you go to the &lt;a href=&#34;https://stackoverflow.com/questions/tagged/xcode&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Stack Overflow tag for Xcode page&lt;/a&gt;, you will see the following explanation for the Xcode tag at the top of the page:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Xcode is Apple’s integrated development environment (IDE). USAGE NOTE: Use this tag only for questions about the Xcode IDE itself, and not for general Mac or iOS programming topics. Use [cocoa] for Mac programming questions, and [cocoa-touch] or [ios] or [Swift] for iOS programming questions.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;The tag should be used only for questions involving the Xcode tool. iOS development questions should use the iOS or Cocoa Touch tags. But if you read through the questions tagged with Xcode, you’ll notice most of the questions are about iOS development and have nothing to do with Xcode besides the fact that the people asking the questions are using it.&lt;/p&gt;&#xA;&lt;p&gt;What’s the point of having an explanation of the tag if most people ignore it?&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 9.3: Core Animation Instrument Deprecated</title>
      <link>https://www.meandmark.com/xcode-9-3-core-animation-instrument-deprecated/</link>
      <pubDate>Wed, 25 Apr 2018 18:42:58 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-3-core-animation-instrument-deprecated/</guid>
      <description>&lt;p&gt;Apple deprecated the Core Animation instrument in Xcode 9.3. If you’re looking for the debug options the Core Animation instrument had, use Xcode’s view debugger. Choose Debug &amp;gt; View Debugging &amp;gt; Rendering to access the debug options.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Version Control Book Released</title>
      <link>https://www.meandmark.com/version-control-book-released-2/</link>
      <pubDate>Tue, 17 Apr 2018 19:01:47 +0000</pubDate>
      <guid>https://www.meandmark.com/version-control-book-released-2/</guid>
      <description>&lt;p&gt;I released my latest book, &lt;em&gt;Version Control for iOS and Mac Developers&lt;/em&gt;. It’s a free download. Go to the &lt;a href=&#34;http://meandmark.com/versioncontrolbook.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;book’s website&lt;/a&gt; to download it.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode Releases Site</title>
      <link>https://www.meandmark.com/xcode-releases-site/</link>
      <pubDate>Fri, 13 Apr 2018 18:08:18 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-releases-site/</guid>
      <description>&lt;p&gt;A common question I see on Apple developer forums is what version of Xcode can be used with a particular version of macOS. The &lt;a href=&#34;http://xcodereleases.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode Releases&lt;/a&gt; site provides the answer to this question.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://xcodereleases.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode Releases&lt;/a&gt; lists every Xcode version Apple has ever released along with operating system requirements and download links. As you can see from the website:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Xcode 11.3.1 is the latest version for macOS 10.14.&lt;/li&gt;&#xA;&lt;li&gt;Xcode 10.1 is the latest version for macOS 10.13.&lt;/li&gt;&#xA;&lt;li&gt;Xcode 9.2 is the latest version for macOS 10.12.&lt;/li&gt;&#xA;&lt;li&gt;Xcode 8.2.1 is the latest version for macOS 10.11.&lt;/li&gt;&#xA;&lt;li&gt;Xcode 7.2.1 is the latest version for macOS 10.10.&lt;/li&gt;&#xA;&lt;li&gt;Xcode 6.2 is the latest version for macOS 10.9.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
    </item>
    <item>
      <title>Git Detached Head</title>
      <link>https://www.meandmark.com/git-detached-head/</link>
      <pubDate>Tue, 27 Mar 2018 04:06:13 +0000</pubDate>
      <guid>https://www.meandmark.com/git-detached-head/</guid>
      <description>&lt;p&gt;I’ve recently seen multiple questions online from people having problems committing to git because the git repository had a detached head. This article answers the most common questions about detached heads.&lt;/p&gt;&#xA;&lt;h4 id=&#34;whatisadetachedhead&#34; class=&#34;relative group&#34;&gt;What Is a Detached Head? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#whatisadetachedhead&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;A detached head in a git repository occurs when the repository has no current branch.&lt;/p&gt;&#xA;&lt;h4 id=&#34;whyisadetachedheadbad&#34; class=&#34;relative group&#34;&gt;Why Is a Detached Head Bad? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#whyisadetachedheadbad&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;A detached head isn’t a problem until you commit some changes. If you commit changes with a detached head, the new commit exists, but it will not appear in any branch’s commit history. The only way to access a commit from a detached head is to memorize the commit number. Git commit numbers are long, random hexadecimal numbers, making them difficult to remember.&lt;/p&gt;&#xA;&lt;h4 id=&#34;whatcausesadetachedhead&#34; class=&#34;relative group&#34;&gt;What Causes a Detached Head? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#whatcausesadetachedhead&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Checking out a specific commit is the most common way to detach the head from a git repository.&lt;/p&gt;&#xA;&lt;h4 id=&#34;howdoyoufixadetachedhead&#34; class=&#34;relative group&#34;&gt;How Do You Fix a Detached Head? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#howdoyoufixadetachedhead&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Check out a local branch. The branch you check out will become the current branch, the attached head of the repository.&lt;/p&gt;&#xA;&lt;p&gt;To checkout a local branch in Xcode, open the source control navigator by choosing View &amp;gt; Navigators &amp;gt; Show Source Control Navigator.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2018/03/SourceControlNavigatorDetachedHead.png&#34; alt=&#34;SourceControlNavigatorDetachedHead&#34; border=&#34;0&#34; width=&#34;265&#34; height=&#34;151&#34; /&gt; &#xA;&lt;p&gt;Notice the long hexadecimal number number next to the SpriteKitGitDemo folder in the screenshot. That number is the commit number. The fact that there’s a commit number instead of a branch name next to the folder means the repository has a detached head.&lt;/p&gt;&#xA;&lt;p&gt;The local branches are inside the Branches folder. Click the disclosure triangle to show them.&lt;/p&gt;&#xA;&lt;p&gt;Select a branch, right-click, and choose Checkout to check out the branch.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a class=&#34;btn btn-primary&#34; href=&#34;http://meandmark.com/versioncontrolbook.html&#34; role=&#34;button&#34;&gt;Learn More About Version Control&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Going Back to a Previous Git Commit in Xcode</title>
      <link>https://www.meandmark.com/going-back-to-a-previous-git-commit-in-xcode/</link>
      <pubDate>Mon, 12 Mar 2018 04:09:29 +0000</pubDate>
      <guid>https://www.meandmark.com/going-back-to-a-previous-git-commit-in-xcode/</guid>
      <description>&lt;p&gt;Something that can happen to you when using version control is you commit a change to the version control repository, realize you made a mistake, and want to go back to an earlier commit. How do you do this in Xcode?&lt;/p&gt;&#xA;&lt;p&gt;Xcode provides no direct way to go back to an earlier commit. What you have to do is create a branch off the earlier commit and work off that branch.&lt;/p&gt;&#xA;&lt;p&gt;Open the source control navigator by choosing View &amp;gt; Navigators &amp;gt; Show Source Control Navigator. Select the current branch from the source control navigator. The Xcode editor shows all the commits for that branch.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2018/03/XcodeCommitList.png&#34; alt=&#34;XcodeCommitList&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;382&#34; /&gt; &#xA;&lt;p&gt;Select the commit you want to use, right-click, and choose Branch from CommitNumber. The commit number is a long hexadecimal number. Name the branch and click the Create button. Now you’re working from the earlier commit.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a class=&#34;btn btn-primary&#34; href=&#34;http://meandmark.com/versioncontrolbook.html&#34; role=&#34;button&#34;&gt;Learn More About Version Control&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Ignoring Files That Are Already in a Git Repository</title>
      <link>https://www.meandmark.com/ignoring-files-that-are-already-in-a-git-repository/</link>
      <pubDate>Mon, 05 Mar 2018 05:03:35 +0000</pubDate>
      <guid>https://www.meandmark.com/ignoring-files-that-are-already-in-a-git-repository/</guid>
      <description>&lt;p&gt;In a previous post, I showed how to &lt;a href=&#34;http://meandmark.com/blog/2018/02/telling-git-to-ignore-files-in-xcode-projects/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;tell git to ignore files in Xcode projects&lt;/a&gt;. But what do you do if you want to ignore a file that git is currently tracking?&lt;/p&gt;&#xA;&lt;p&gt;Remove the file from the git repository. Add the file you want to ignore to the git ignore file. If you don’t perform this step, git will track the file when you add it back to the repository. Add the file back to the project after removing the file from the repository.&lt;/p&gt;&#xA;&lt;h3 id=&#34;removingafilethatsinanxcodeprojectfromtherepository&#34; class=&#34;relative group&#34;&gt;Removing a File That’s in an Xcode Project from the Repository &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#removingafilethatsinanxcodeprojectfromtherepository&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To remove a file that’s part of an Xcode project from a git repository, you must remove the file from the project. Select the file from the project navigator on the left side of the project window and press the Delete key.&lt;/p&gt;&#xA;&lt;p&gt;Xcode will ask you if you want to remove the reference to the file from the project or move the file to the Trash. Move the file to the Trash.&lt;/p&gt;&#xA;&lt;p&gt;After removing the file from the project, choose Source Control &amp;gt; Commit to commit and remove the file from the repository.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2018/03/XcodeCommitRemovingFile.png&#34; alt=&#34;XcodeCommitRemovingFile&#34; border=&#34;0&#34; width=&#34;198&#34; height=&#34;160&#34; /&gt; &#xA;&lt;h3 id=&#34;addthefilebacktotheproject&#34; class=&#34;relative group&#34;&gt;Add the File back to the Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#addthefilebacktotheproject&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now that you removed the file from the repository, get the file out of the Trash and move it back to your project folder. Choose File &amp;gt; Add Files to ProjectName to add the file back to your Xcode project.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a class=&#34;btn btn-primary&#34; href=&#34;http://meandmark.com/versioncontrolbook.html&#34; role=&#34;button&#34;&gt;Learn More About Version Control&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Telling Git to Ignore Files in Xcode Projects</title>
      <link>https://www.meandmark.com/telling-git-to-ignore-files-in-xcode-projects/</link>
      <pubDate>Wed, 28 Feb 2018 05:01:34 +0000</pubDate>
      <guid>https://www.meandmark.com/telling-git-to-ignore-files-in-xcode-projects/</guid>
      <description>&lt;p&gt;When you create a project in Xcode and create a git repository, git initially tracks every file in the project, but this behavior isn’t what you want. Xcode projects contain a lot of files. Some of these files shouldn’t be tracked by git because they change every time you build your project. Having files you don’t want in git being marked as updated and ready to commit is annoying at best. At worst Xcode won’t let you switch branches because of uncommitted changes.&lt;/p&gt;&#xA;&lt;p&gt;How do you get git to track the files you’re interested in tracking, such as your source code files, and not track the files you don’t care about? Create a git ignore file and add it to your git repository.&lt;/p&gt;&#xA;&lt;h3 id=&#34;generatingagitignorefile&#34; class=&#34;relative group&#34;&gt;Generating a Git Ignore File &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#generatingagitignorefile&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The git ignore file is just a text file with the name &lt;code&gt;.gitignore&lt;/code&gt;. It contains a list of files and directories. Git will ignore any of the files or directories it finds in the git ignore file.&lt;/p&gt;&#xA;&lt;p&gt;What files and directories do you put in a git ignore file? That depends on the tools and languages you use to build your software. Fortunately the website &lt;a href=&#34;https://www.gitignore.io&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;gitignore.io&lt;/a&gt; has done the hard work for you. Go to gitignore.io and enter a programming language or an IDE to create a git ignore file. If you go to the site and enter &lt;strong&gt;Xcode&lt;/strong&gt;, gitignore.io creates &lt;a href=&#34;https://www.gitignore.io/api/xcode&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;the following git ignore file&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Created by https://www.gitignore.io/api/xcode&#xA;&#xA;### Xcode ###&#xA;# Xcode&#xA;#&#xA;# gitignore contributors: remember to update Global/Xcode.gitignore, &#xA;#   Objective-C.gitignore &amp;amp; Swift.gitignore&#xA;&#xA;## Build generated&#xA;build/&#xA;DerivedData/&#xA;&#xA;## Various settings&#xA;*.pbxuser&#xA;!default.pbxuser&#xA;*.mode1v3&#xA;!default.mode1v3&#xA;*.mode2v3&#xA;!default.mode2v3&#xA;*.perspectivev3&#xA;!default.perspectivev3&#xA;xcuserdata/&#xA;&#xA;## Other&#xA;*.moved-aside&#xA;*.xccheckout&#xA;*.xcscmblueprint&#xA;&#xA;### Xcode Patch ###&#xA;*.xcodeproj/*&#xA;!*.xcodeproj/project.pbxproj&#xA;!*.xcodeproj/xcshareddata/&#xA;!*.xcworkspace/contents.xcworkspacedata&#xA;/*.gcno&#xA;&#xA;# End of https://www.gitignore.io/api/xcode&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Xcode project files have a lot of files in them, don’t they?&lt;/p&gt;&#xA;&lt;h3 id=&#34;savingthegitignorefile&#34; class=&#34;relative group&#34;&gt;Saving the Git Ignore File &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#savingthegitignorefile&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now you need to copy the git ignore file into a text file. Open a text editor (not a word processor like Pages or Word). If you don’t have a text editor, download &lt;a href=&#34;http://www.barebones.com/products/bbedit/index.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;BBEdit&lt;/a&gt; or &lt;a href=&#34;https://code.visualstudio.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Visual Studio Code&lt;/a&gt;. They should do the job.&lt;/p&gt;&#xA;&lt;p&gt;Copy the contents of the git ignore file into the text document. Save it in the project folder with the name &lt;code&gt;.gitignore&lt;/code&gt;. Files that start with &lt;code&gt;.&lt;/code&gt; are invisible in the Finder. To show hidden files in the Finder, hold down the Command and Shift keys and press the period (.) key. If you navigate to your project folder, you should see the git ignore file. Press Cmd-Shift-Period to go back to hiding the invisible files.&lt;/p&gt;&#xA;&lt;h3 id=&#34;addingthegitignorefiletoyourrepository&#34; class=&#34;relative group&#34;&gt;Adding the Git Ignore File to Your Repository &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#addingthegitignorefiletoyourrepository&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;After creating the git ignore file, add it to your repository. In Xcode choose Source Control &amp;gt; Commit. A sheet opens.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2018/02/XcodeCommitGitIgnoreHighlighted.png&#34; alt=&#34;XcodeCommitGitIgnoreHighlighted&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;403&#34; /&gt; &#xA;&lt;p&gt;Select the checkbox next to the git ignore file and deselect any other checkboxes. Add a commit message and click the Commit button.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a class=&#34;btn btn-primary&#34; href=&#34;http://meandmark.com/versioncontrolbook.html&#34; role=&#34;button&#34;&gt;Learn More About Version Control&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 9: Adding Your Project to GitHub</title>
      <link>https://www.meandmark.com/xcode-9-adding-your-project-to-github/</link>
      <pubDate>Wed, 21 Feb 2018 05:07:07 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-adding-your-project-to-github/</guid>
      <description>&lt;p&gt;Before Xcode 9, setting up your project to work on GitHub involved &lt;a href=&#34;http://meandmark.com/blog/2015/09/creating-an-xcode-project-to-work-with-github-or-bitbucket/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;a lot of work&lt;/a&gt;. You had to login to GitHub, create a repository, go back to your Mac, launch the Terminal application, navigate to your project directory, and run multiple git commands.&lt;/p&gt;&#xA;&lt;p&gt;Xcode 9 makes working with GitHub much easier. You can add your Xcode project to GitHub without leaving Xcode.&lt;/p&gt;&#xA;&lt;p&gt;Start by going to the source control navigator by choosing View &amp;gt; Navigators &amp;gt; Show Source Control Navigator.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2018/02/SourceCodeNavigatorAtStart.png&#34; alt=&#34;SourceCodeNavigatorAtStart&#34; border=&#34;0&#34; width=&#34;267&#34; height=&#34;114&#34; /&gt; &#xA;&lt;p&gt;Select the Remotes folder, right-click, and choose Create Remote on GitHub. A sheet similar to the following will open:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2018/02/CreateGitHubRemoteBlur.png&#34; alt=&#34;CreateGitHubRemoteBlur&#34; border=&#34;0&#34; width=&#34;514&#34; height=&#34;451&#34; /&gt; &#xA;&lt;p&gt;Unless you’ve already configured a GitHub account in Xcode, choose Add a GitHub Account from the Account menu.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2018/02/GitHubLogin.png&#34; alt=&#34;GitHubLogin&#34; border=&#34;0&#34; width=&#34;470&#34; height=&#34;196&#34; /&gt; &#xA;&lt;p&gt;Enter your GitHub account name and password. Click the Sign In button to use your GitHub account for this repository.&lt;/p&gt;&#xA;&lt;p&gt;Choose public visibility unless you have a paid GitHub account. You must have a paid account to create private GitHub repositories.&lt;/p&gt;&#xA;&lt;p&gt;Click the Create button to create the remote branch. Your Xcode project is now on GitHub.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a class=&#34;btn btn-primary&#34; href=&#34;http://meandmark.com/versioncontrolbook.html&#34; role=&#34;button&#34;&gt;Learn More About Version Control&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Handling Swipe Gestures in a SpriteKit Game</title>
      <link>https://www.meandmark.com/handling-swipe-gestures-in-a-spritekit-game-2/</link>
      <pubDate>Fri, 16 Feb 2018 05:01:44 +0000</pubDate>
      <guid>https://www.meandmark.com/handling-swipe-gestures-in-a-spritekit-game-2/</guid>
      <description>&lt;p&gt;When you create a SpriteKit Xcode project, the &lt;code&gt;GameScene.swift&lt;/code&gt; file contains functions to handle touch and/or mouse events, depending on the type of SpriteKit project you create. You can also use swipe gestures in SpriteKit games. Supporting swipe gestures requires you to perform two tasks.&lt;/p&gt;&#xA;&lt;p&gt;The first task is to create a swipe gesture recognizer. The swipe gesture recognizer takes two arguments: a target and a selector (function) to call when someone performs the gesture. Set the swipe gesture recognizer’s direction and add it to the view. The following code demonstrates how to create a swipe gesture recognizer for swiping right:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;override func didMove(to view: SKView) {&#xA;    let swipeRight = UISwipeGestureRecognizer(target: self, &#xA;        action: #selector(GameScene.swipeRight(sender:)))&#xA;    swipeRight.direction = .right&#xA;    view.addGestureRecognizer(swipeRight)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The second task is to write a function to handle the swipe.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@objc func swipeRight(sender: UISwipeGestureRecognizer) {&#xA;    // Handle the swipe&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The functions to handle the swipes need the &lt;code&gt;@objc&lt;/code&gt; at the start because they’re selectors that access the Objective-C runtime.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating a Git Repository for an Existing Xcode Project</title>
      <link>https://www.meandmark.com/creating-a-git-repository-for-an-existing-xcode-project/</link>
      <pubDate>Mon, 12 Feb 2018 05:41:36 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-a-git-repository-for-an-existing-xcode-project/</guid>
      <description>&lt;p&gt;When you create a new Xcode project, Xcode gives you the option to create a git repository on your Mac.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2018/02/CreateGitRepoNewProject.png&#34; alt=&#34;CreateGitRepoNewProject&#34; border=&#34;0&#34; width=&#34;598&#34; height=&#34;135&#34; /&gt; &#xA;&lt;p&gt;How do you create a git repository for a project after the project has been created?&lt;/p&gt;&#xA;&lt;p&gt;Choose Source Control &amp;gt; Create Git Repositories. A sheet opens.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2018/02/Xcode9AddGitRepoExistingProject.png&#34; alt=&#34;Xcode9AddGitRepoExistingProject&#34; border=&#34;0&#34; width=&#34;592&#34; height=&#34;407&#34; /&gt; &#xA;&lt;p&gt;Click the Create button and Xcode will create a git repository for your project.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a class=&#34;btn btn-primary&#34; href=&#34;http://meandmark.com/versioncontrolbook.html&#34; role=&#34;button&#34;&gt;Learn More About Version Control&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Using agvtool to Update Version and Build Numbers</title>
      <link>https://www.meandmark.com/using-agvtool-to-update-version-and-build-numbers/</link>
      <pubDate>Mon, 05 Feb 2018 05:03:51 +0000</pubDate>
      <guid>https://www.meandmark.com/using-agvtool-to-update-version-and-build-numbers/</guid>
      <description>&lt;p&gt;Apple bundles a command-line tool with Xcode, agvtool, to automatically update your project’s version and build numbers. This article shows you how to use agvtool in your Xcode projects.&lt;/p&gt;&#xA;&lt;h3 id=&#34;enablingagvtoolinyourproject&#34; class=&#34;relative group&#34;&gt;Enabling agvtool in Your Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#enablingagvtoolinyourproject&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Before you can use agvtool, you must tell Xcode to use it for your project. To enable agvtool, change the following build settings:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Set the Versioning System build setting to Apple Generic.&lt;/li&gt;&#xA;&lt;li&gt;Give the Current Project Version build setting an initial value. Agvtool works best with integer build numbers. 1 is a good choice.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2018/02/AgvtoolProjectSettings.png&#34; alt=&#34;AgvtoolProjectSettings&#34; border=&#34;0&#34; width=&#34;593&#34; height=&#34;254&#34; /&gt; &#xA;&lt;h3 id=&#34;updatingthebuildnumber&#34; class=&#34;relative group&#34;&gt;Updating the Build Number &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#updatingthebuildnumber&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Because agvtool is a command-line tool, you have to run it from the Terminal application. Navigate to your project’s directory before running agvtool.&lt;/p&gt;&#xA;&lt;p&gt;The most common thing you will be doing in agvtool is incrementing the build number. Run agvtool with the &lt;code&gt;next-version -all&lt;/code&gt; option to increment the build number.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;agvtool next-version -all&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To set the build number to a specific value, supply the desired build number. The most common reason for explicitly setting a build number is to use non-integer build numbers. The following example sets the build number to 8.2:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;agvtool next-version -all 8.2&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;what-version&lt;/code&gt; option lets you see the current build number.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;agvtool what-version&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;updatingtheversionnumber&#34; class=&#34;relative group&#34;&gt;Updating the Version Number &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#updatingtheversionnumber&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To update the version number of your project, run agvtool with the &lt;code&gt;new-marketing-version&lt;/code&gt; option and supply the version number. The following example sets the version to 0.5:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;agvtool new-marketing-version 0.5&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;what-marketing-version&lt;/code&gt; option lets you see the current version number.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;agvtool what-marketing-version&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Report a Bug to Apple from Xcode</title>
      <link>https://www.meandmark.com/report-a-bug-to-apple-from-xcode/</link>
      <pubDate>Wed, 31 Jan 2018 20:31:59 +0000</pubDate>
      <guid>https://www.meandmark.com/report-a-bug-to-apple-from-xcode/</guid>
      <description>&lt;p&gt;In Xcode choose Help &amp;gt; Report an Issue to send a bug report to Apple.&lt;/p&gt;&#xA;&lt;p&gt;I’m not sure when this menu item was added to Xcode. I know it’s available in Xcode 9.2.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Frequently Asked Questions on Making Your First Game</title>
      <link>https://www.meandmark.com/frequently-asked-questions-on-making-your-first-game/</link>
      <pubDate>Fri, 26 Jan 2018 05:22:15 +0000</pubDate>
      <guid>https://www.meandmark.com/frequently-asked-questions-on-making-your-first-game/</guid>
      <description>&lt;p&gt;I was recently doing some research on people new to game development for a possible project. A few questions cropped up repeatedly so I decided to answer them here.&lt;/p&gt;&#xA;&lt;h3 id=&#34;whatengineorlibraryshouldiuse&#34; class=&#34;relative group&#34;&gt;What Engine or Library Should I use? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#whatengineorlibraryshouldiuse&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;People new to game development often ask what game engine or library to use. There are a lot of game engines and libraries to choose from. The following six engines/libraries are suitable choices for someone making their first game:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.yoyogames.com/gamemaker&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;GameMaker&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://unity3d.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Unity&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://godotengine.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Godot&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://developer.apple.com/documentation/spritekit&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;SpriteKit&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://www.libsdl.org/index.php&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;SDL&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.sfml-dev.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;SFML&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The links provide good descriptions of each engine/library. I’m not going to rehash the material here.&lt;/p&gt;&#xA;&lt;p&gt;If I had to recommend one engine or library for people learning to develop games, I would recommend Unity. It’s free until you start making $100,000(US) a year with your games. It runs on Windows and Mac. Unity is versatile, allowing you to make 2D and 3D games that run on iOS, Android, Windows, Mac, and Linux. Lots of people use Unity so there are numerous books, articles, and videos to help you learn how to use Unity. Unity also has a large asset store of tools, libraries, and artwork you can buy to speed up the development of your game.&lt;/p&gt;&#xA;&lt;p&gt;When would you go with one of the other engines or libraries?&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use GameMaker if you want to make games without writing code.&lt;/li&gt;&#xA;&lt;li&gt;Use Godot if you’re using Linux, or you want to use a game engine and don’t like Unity.&lt;/li&gt;&#xA;&lt;li&gt;Use SpriteKit if you’re interested only in making 2D iOS games.&lt;/li&gt;&#xA;&lt;li&gt;Use SDL or SFML if you have programming experience and have no need for a built-in tool to create game levels visually.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Don’t worry about making the wrong engine choice. If your initial choice isn’t working for you, choose a different engine. Suppose you start with Unity and struggle with writing code. You can switch to GameMaker, which doesn’t force you to write code.&lt;/p&gt;&#xA;&lt;h3 id=&#34;whatprogramminglanguageshouldiuse&#34; class=&#34;relative group&#34;&gt;What Programming Language Should I Use? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#whatprogramminglanguageshouldiuse&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The language you use to write your game depends on the engine or library you use. If you choose Unity, you’re going to be writing code in C#. If you choose SpriteKit, you’re going to be coding in Swift or Objective-C. GameMaker and Godot come with their own scripting languages. SDL and SFML have support for more languages than the other game engines and libraries, including C, C++, Go, OCaml, Python, and Rust.&lt;/p&gt;&#xA;&lt;p&gt;If you read the last section, I said SDL and SFML are for people with previous programming experience, which means you already know at least one programming language. Choose a language you already know so you can concentrate on learning SDL or SFML.&lt;/p&gt;&#xA;&lt;h3 id=&#34;whatgameshouldimake&#34; class=&#34;relative group&#34;&gt;What Game Should I Make? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#whatgameshouldimake&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The specific game you choose to make is up to you. I’m going to provide one piece of advice on choosing your first game to make. Start with a small game, something you think you could finish in a week or two.&lt;/p&gt;&#xA;&lt;p&gt;Making games is difficult. You’re going to make mistakes. It’s better to make those mistakes on a small game than on a massive game.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Checking Modifier Keys in Swift</title>
      <link>https://www.meandmark.com/checking-modifier-keys-in-swift/</link>
      <pubDate>Mon, 22 Jan 2018 20:52:03 +0000</pubDate>
      <guid>https://www.meandmark.com/checking-modifier-keys-in-swift/</guid>
      <description>&lt;p&gt;Checking for modifier keys (Command, Control, Option, and Shift) when handling events is different in Objective-C and Swift. In Objective-C you perform a bitwise AND operation to check if modifier keys were held down. In Swift you check if the event’s modifier flags contains the specific modifier key.&lt;/p&gt;&#xA;&lt;p&gt;The following example demonstrates how to check the modifier keys for a mouse down event in Swift:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;override func mouseDown(with event: NSEvent) {&#xA;    if event.modifierFlags.contains(.command) {&#xA;        // Handle command-click&#xA;    } &#xA;    else if event.modifierFlags.contains(.control) {&#xA;        // Handle control-click&#xA;    }&#xA;    else {&#xA;        // Handle standard mouse click&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Swift Functional Programming: Pure Functions</title>
      <link>https://www.meandmark.com/swift-functional-programming-pure-functions/</link>
      <pubDate>Mon, 15 Jan 2018 20:32:32 +0000</pubDate>
      <guid>https://www.meandmark.com/swift-functional-programming-pure-functions/</guid>
      <description>&lt;p&gt;A pure function doesn’t reference any data outside of the function. If you supply a given input to a pure function, it always returns the same value. The following is a simple example of a pure function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func increment(value: Int) -&amp;gt; Int {&#xA;    return value + 1&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;increment&lt;/code&gt; function is pure because it increments the value you supply to it. It doesn’t modify any outside variables. If you pass the value 9 to &lt;code&gt;increment&lt;/code&gt;, it always returns 10.&lt;/p&gt;&#xA;&lt;p&gt;The following code is a hypothetical example of an impure function that updates contact information based on the values of text fields in an app’s user interface:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func updateContactInfo() {&#xA;    name = nameTextField.text&#xA;    address = addressTextField.text&#xA;    phone = phoneTextField.text&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;updateContactInfo&lt;/code&gt; function is impure because it modifies variables outside of the function: &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;address&lt;/code&gt;, and &lt;code&gt;phone&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;purefunctionssimplifyunittesting&#34; class=&#34;relative group&#34;&gt;Pure Functions Simplify Unit Testing &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#purefunctionssimplifyunittesting&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;A big advantage of pure functions is they’re much easier to unit test. To test the &lt;code&gt;increment&lt;/code&gt; function, all you have to do is create an integer, call &lt;code&gt;increment&lt;/code&gt;, and assert the incremented value is correct.&lt;/p&gt;&#xA;&lt;p&gt;I know &lt;code&gt;increment&lt;/code&gt; is a simple function, but unit testing any pure function follows the same steps.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create values for the arguments.&lt;/li&gt;&#xA;&lt;li&gt;Call the function.&lt;/li&gt;&#xA;&lt;li&gt;Assert the function returns the correct value.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Unit testing the &lt;code&gt;updateContactInfo&lt;/code&gt; function would be painful. You would have to perform the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create an instance of the data structure that contains the contact information.&lt;/li&gt;&#xA;&lt;li&gt;Create, mock, or stub three text fields.&lt;/li&gt;&#xA;&lt;li&gt;Provide text for the three text fields.&lt;/li&gt;&#xA;&lt;li&gt;Call &lt;code&gt;updateContactInfo&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Assert the name, address, and phone number are correct.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;</description>
    </item>
    <item>
      <title>Swift First Class Functions</title>
      <link>https://www.meandmark.com/swift-first-class-functions/</link>
      <pubDate>Fri, 12 Jan 2018 19:08:09 +0000</pubDate>
      <guid>https://www.meandmark.com/swift-first-class-functions/</guid>
      <description>&lt;p&gt;I considered writing an article about first class functions in Swift, but I came across the following article by John Sundell:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.swiftbysundell.com/posts/first-class-functions-in-swift&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;First class functions in Swift&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Sundell’s article covers pretty much everything I would cover in an article on first class functions. The examples are good too. So I decided to link to his article rather than write my own.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Migrating to Bootstrap 4</title>
      <link>https://www.meandmark.com/migrating-to-bootstrap-4/</link>
      <pubDate>Tue, 09 Jan 2018 22:46:30 +0000</pubDate>
      <guid>https://www.meandmark.com/migrating-to-bootstrap-4/</guid>
      <description>&lt;p&gt;I am migrating this website from Bootstrap 2 to Bootstrap 4. Some things may look off due to the migration.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Swift Functional Programming: reduce</title>
      <link>https://www.meandmark.com/swift-functional-programming-reduce/</link>
      <pubDate>Mon, 08 Jan 2018 05:02:48 +0000</pubDate>
      <guid>https://www.meandmark.com/swift-functional-programming-reduce/</guid>
      <description>&lt;p&gt;The &lt;code&gt;reduce&lt;/code&gt; function takes all the elements of a collection and combines them into a single value. Supply an initial value and a function or closure (unnamed function) to combine the elements.&lt;/p&gt;&#xA;&lt;p&gt;The following code demonstrates how to calculate the average for a collection of test scores:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let testScores = [78, 96, 48, 65, 59, 91]&#xA;&#xA;let average = testScores.reduce(0.0, { x, y in&#xA;    Double(x) + Double(y)&#xA;}) / Double(testScores.count)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The closure inside the call to &lt;code&gt;reduce&lt;/code&gt; calculates the sum of the test scores. Divide the sum by the number of scores to calculate the average. I had to convert the scores and the array count to floating-point values to calculate the average accurately. Swift does not let you divide two integers and return a floating-point value. Dividing two integers yields an integer, which you can test in a playground with the following code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let integerAverage = testScores.reduce(0, { x, y in&#xA;    x + y&#xA;}) / testScores.count&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Dividing the two integers yields an average of &lt;code&gt;72&lt;/code&gt; instead of &lt;code&gt;72.833333&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;a-cleaner-way&#34; class=&#34;relative group&#34;&gt;A Cleaner Way &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#a-cleaner-way&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;My code example demonstrates the syntax for using &lt;code&gt;reduce&lt;/code&gt; with closures, but the code could be cleaner. A cleaner way to calculate the average is to use &lt;code&gt;reduce&lt;/code&gt; to calculate the sum and do the floating-point conversion when dividing.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let sum = testScores.reduce(0, +)&#xA;let average = Double(sum) / Double(testScores.count)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The code to call &lt;code&gt;reduce&lt;/code&gt; is simpler in this version because there’s no closure to write.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Swift Functional Programming: map</title>
      <link>https://www.meandmark.com/swift-functional-programming-map-2/</link>
      <pubDate>Wed, 03 Jan 2018 05:01:36 +0000</pubDate>
      <guid>https://www.meandmark.com/swift-functional-programming-map-2/</guid>
      <description>&lt;p&gt;The &lt;code&gt;map&lt;/code&gt; function takes all the elements in a collection and applies a function or a closure (an unnamed function) to them. The following code demonstrates using &lt;code&gt;map&lt;/code&gt; to multiply each element of an array by itself:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let numbers = [1, 2, 3, 4, 5]&#xA;let squares = numbers.map {&#xA;    return $0 * $0&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;$0&lt;/code&gt; expression represents the current item in the array.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;squares&lt;/code&gt; array has the following values:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[1, 4, 9, 16, 25]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You could double the items in the &lt;code&gt;numbers&lt;/code&gt; array with the following code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let doubles = numbers.map {&#xA;    return $0 * 2&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;using-map-with-a-named-function&#34; class=&#34;relative group&#34;&gt;Using map with a Named Function &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#using-map-with-a-named-function&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I used closures in the previous examples. Now it’s time to demonstrate how to use &lt;code&gt;map&lt;/code&gt; with a named function. Supply the name of the function as the argument to &lt;code&gt;map&lt;/code&gt;. The following example uses a function with &lt;code&gt;map&lt;/code&gt; to multiply each element of an array by itself:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func square(value: Int) -&amp;gt; Int {&#xA;    return value * value&#xA;}&#xA;&#xA;let numbers = [1, 2, 3, 4, 5]&#xA;let squares = numbers.map(square)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Swift Functional Programming: filter</title>
      <link>https://www.meandmark.com/swift-functional-programming-filter/</link>
      <pubDate>Wed, 27 Dec 2017 19:20:05 +0000</pubDate>
      <guid>https://www.meandmark.com/swift-functional-programming-filter/</guid>
      <description>&lt;p&gt;I’m learning about functional programming in Swift. To sharpen my understanding I’m writing about what I’ve learned. I start with the &lt;code&gt;filter&lt;/code&gt; function.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-filter-function&#34; class=&#34;relative group&#34;&gt;The filter Function &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#the-filter-function&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;As its name indicates, the &lt;code&gt;filter&lt;/code&gt; function filters out the elements of a collection that don’t meet a condition. The &lt;code&gt;filter&lt;/code&gt; function operates on a collection, such as an array, using a closure (a function without a name) that returns a Boolean value. &lt;code&gt;filter&lt;/code&gt; returns the elements in the collection that return &lt;code&gt;true&lt;/code&gt; from the closure.&lt;/p&gt;&#xA;&lt;p&gt;Suppose you have an array of test scores, and you want to get the passing test scores. Test scores of 60 or higher pass. The following code demonstrates how to get the passing scores using &lt;code&gt;filter&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let testScores = [78, 96, 48, 65, 55, 91]&#xA;let passingScores = testScores.filter {&#xA;    $0 &amp;gt;= 60&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What the code does is take each item in the &lt;code&gt;testScores&lt;/code&gt; array and check if it’s greater than or equal to 60. If the item is greater than or equal to 60, it is added to the &lt;code&gt;passingScores&lt;/code&gt; array.&lt;/p&gt;&#xA;&lt;p&gt;If you look at the value of &lt;code&gt;passingScores&lt;/code&gt;, it has the following values:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;[78, 96, 65, 91]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;filter-lets-you-write-less-code&#34; class=&#34;relative group&#34;&gt;filter Lets You Write Less Code &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#filter-lets-you-write-less-code&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;A big advantage of using the &lt;code&gt;filter&lt;/code&gt; function is less code to write. If you were to get the passing scores without &lt;code&gt;filter&lt;/code&gt;, you would have to write something similar to the following code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let testScores = [78, 96, 48, 65, 55, 91]&#xA;var passingScores: [Int] = [ ]&#xA;&#xA;for score in testScores {&#xA;    if score &amp;gt;= 60 {&#xA;        passingScores.append(score)&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;what-is-0&#34; class=&#34;relative group&#34;&gt;What Is $0? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#what-is-0&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Looking at the code for the &lt;code&gt;filter&lt;/code&gt; example, you might be wondering what &lt;code&gt;$0&lt;/code&gt; is. The &lt;code&gt;$0&lt;/code&gt; expression represents the first argument in the closure, which is the current element in the array in my &lt;code&gt;filter&lt;/code&gt; example. It’s the equivalent of the &lt;code&gt;score&lt;/code&gt; variable in the code sample that doesn’t use &lt;code&gt;filter&lt;/code&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 9: Locating dSYM Files in Instruments</title>
      <link>https://www.meandmark.com/xcode-9-locating-dsym-files-in-instruments/</link>
      <pubDate>Tue, 12 Dec 2017 00:54:17 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-locating-dsym-files-in-instruments/</guid>
      <description>&lt;p&gt;Xcode 9 changed the way you locate a dSYM file if you’re seeing memory addresses instead of function names in the call tree view. Now you choose File &amp;gt; Symbols to locate the dSYM file.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/12/LocateDSYMXcode9.png&#34; alt=&#34;LocateDSYMXcode9&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;348&#34; /&gt; &#xA;&lt;p&gt;Select the app you’re profiling on the left side of the sheet. Click the Locate button to find the dSYM file.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode and New iOS Versions</title>
      <link>https://www.meandmark.com/xcode-and-new-ios-versions/</link>
      <pubDate>Mon, 04 Dec 2017 20:18:50 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-and-new-ios-versions/</guid>
      <description>&lt;p&gt;I have seen a lot of people on Apple’s developer forums having problems running their apps on iOS devices running the latest version of iOS. If you find yourself in this situation, remember the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Xcode is unaware of future iOS versions.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What this means is if you’re running Xcode 8, connect an iPhone running iOS 11, and try to build and run your project on that iPhone, it won’t work. Xcode 8 shipped with iOS 10 so it doesn’t know about iOS 11.&lt;/p&gt;&#xA;&lt;p&gt;This lack of awareness also applies to dot releases. If you’re running Xcode 9.1 and try to run a project on a device running iOS 11.2, it won’t work either because Xcode 9.1 shipped with iOS 11.1.&lt;/p&gt;&#xA;&lt;p&gt;How do you fix this problem? You have two options.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Stop constantly updating your iOS devices to the latest version of iOS.&lt;/li&gt;&#xA;&lt;li&gt;Always use the latest version of Xcode, which may involve running a beta version.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Option 1 is easier because you don’t have to be constantly updating Xcode. But if you’re already running the latest version of iOS, Option 2 is your only option.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 9: Activity Monitor Instrument Changes</title>
      <link>https://www.meandmark.com/xcode-9-activity-monitor-instrument-changes/</link>
      <pubDate>Mon, 27 Nov 2017 20:19:12 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-activity-monitor-instrument-changes/</guid>
      <description>&lt;p&gt;In Xcode 9 Apple removed the recording configuration options for the Activity Monitor instrument. The replacement is summaries for the system CPU usage, system memory usage, system disk activity, and system network activity. You can access these summaries from the jump bar.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/11/ActivityMonitorJumpBar.png&#34; alt=&#34;ActivityMonitorJumpBar&#34; border=&#34;0&#34; width=&#34;304&#34; height=&#34;111&#34; /&gt;</description>
    </item>
    <item>
      <title>Saving Settings with Core Data Metadata</title>
      <link>https://www.meandmark.com/saving-settings-with-core-data-metadata/</link>
      <pubDate>Mon, 06 Nov 2017 05:15:18 +0000</pubDate>
      <guid>https://www.meandmark.com/saving-settings-with-core-data-metadata/</guid>
      <description>&lt;p&gt;I’m working on a Core Data app where I needed to save some document settings. Creating Core Data entities for these settings was overkill. In my research for a solution I discovered persistent store metadata. I did not find much information online on using persistent store metadata so I’m sharing what I learned in this article.&lt;/p&gt;&#xA;&lt;p&gt;This article is not for people new to Core Data. If you’re new to Core Data, start by reading &lt;em&gt;Core Data Programming Guide&lt;/em&gt;, which is part of Apple’s developer documentation.&lt;/p&gt;&#xA;&lt;h3 id=&#34;persistent-store-metadata&#34; class=&#34;relative group&#34;&gt;Persistent Store Metadata &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#persistent-store-metadata&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Core Data uses persistent stores to save data. While you can use an in-memory store, most persistent stores are files. In a document-based Core Data app the document file contains the persistent store.&lt;/p&gt;&#xA;&lt;p&gt;Persistent stores have a &lt;code&gt;metadata&lt;/code&gt; property to store metadata. The metadata is a dictionary. The dictionary keys are strings, and the dictionary values can be any data type. Core Data stores the store type and unique identifier in the metadata. You can also add your own entries to the metadata to store small pieces of data that don’t belong in a Core Data entity.&lt;/p&gt;&#xA;&lt;p&gt;The most common reason for someone to use persistent store metadata is to save per-document settings in Core Data apps that use &lt;code&gt;NSPersistentDocument&lt;/code&gt;. Most people who use Core Data have no need to deal with the metadata. They can stick with Core Data entities and Apple’s &lt;code&gt;UserDefaults&lt;/code&gt; class. But there are edge cases where saving data in the persistent store’s metadata makes sense.&lt;/p&gt;&#xA;&lt;h3 id=&#34;getting-the-persistent-store&#34; class=&#34;relative group&#34;&gt;Getting the Persistent Store &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#getting-the-persistent-store&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The persistent store contains the metadata. If you want to access the metadata, you must access the persistent store. The managed object context has a persistent store coordinator. The coordinator contains an array of persistent stores. The store is the first element in the array.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let store = context.persistentStoreCoordinator?.persistentStores.first&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Keep in mind the array of persistent stores can be empty. If you create a new document in a document-based Core Data application, a persistent store is not created until you save the document. Check that the &lt;code&gt;persistentStores&lt;/code&gt; array is not empty before accessing its elements.&lt;/p&gt;&#xA;&lt;h3 id=&#34;updating-the-metadata&#34; class=&#34;relative group&#34;&gt;Updating the Metadata &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#updating-the-metadata&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Once you have access to the persistent store, take the following steps to fill the metadata:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a variable for the metadata.&lt;/li&gt;&#xA;&lt;li&gt;Set the variable to the store’s &lt;code&gt;metadata&lt;/code&gt; property.&lt;/li&gt;&#xA;&lt;li&gt;Add dictionary entries for your fields.&lt;/li&gt;&#xA;&lt;li&gt;Set the store’s &lt;code&gt;metadata&lt;/code&gt; property to your variable.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Core Data saves some internal data in the metadata. You should be adding your fields to the existing metadata, not overwriting the existing metadata with your fields. That’s why you create a variable for the metadata and set its initial value to the store’s existing metadata before you add any fields to the metadata.&lt;/p&gt;&#xA;&lt;p&gt;The following Swift code demonstrates how to update the metadata to store the author of a document:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;class Document: NSPersistentDocument {&#xA;    // Initial value for author. You would set the author&#39;s&#xA;    // value from a text field in your app&#39;s user interface.&#xA;    var author = &amp;quot;&amp;quot;&#xA;}&#xA;&#xA;if let store = context.persistentStoreCoordinator?.persistentStores.first {&#xA;    let metadata = fillMetadata(store: store)&#xA;    store.metadata = metadata&#xA;}&#xA;&#xA;func fillMetadata(store: NSPersistentStore) -&amp;gt; [String: Any] {&#xA;    var metadata: [String: Any] = store.metadata&#xA;    metadata[&amp;quot;Author&amp;quot;] = author&#xA;    return metadata&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;After updating the metadata, save the managed object context to save the metadata. If you stick with simpler data types like strings and integers, you can save without having to write any more code. If you try to save something more complicated, such as an enum, you will have to write code to conform to the &lt;code&gt;Codable&lt;/code&gt; protocol or your app will crash when you save.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;NSPersistentStoreCoordinator&lt;/code&gt; also has class and instance methods, both named &lt;code&gt;setMetadata&lt;/code&gt;, to set the metadata. I went with the simplest solution, setting the store’s &lt;code&gt;metadata&lt;/code&gt; property.&lt;/p&gt;&#xA;&lt;h3 id=&#34;when-to-update-the-metadata&#34; class=&#34;relative group&#34;&gt;When to Update the Metadata? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#when-to-update-the-metadata&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;A good time to update the metadata is when you’re about to save the managed object context. Register for the notification &lt;code&gt;NSManagedObjectContextWillSave&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let center = NotificationCenter.default&#xA;center.addObserver(self, selector: #selector(Document.contextWillSave(_:)), &#xA;    name: Notification.Name.NSManagedObjectContextWillSave, object: nil)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Handle the notification by calling your function to update the metadata.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func contextWillSave(_ aNotification: Notification) {&#xA;    updateMetadata()&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;retrieving-the-metadata&#34; class=&#34;relative group&#34;&gt;Retrieving the Metadata &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#retrieving-the-metadata&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Call the &lt;code&gt;NSPersistentStoreCoordinator&lt;/code&gt; instance method &lt;code&gt;metadataForPersistentStore&lt;/code&gt; to retrieve the metadata for your persistent store. Supply the persistent store as the argument to &lt;code&gt;metadataForPersistentStore&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The following Swift code demonstrates how to retrieve the document’s author from the metadata:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;if let store = context.persistentStoreCoordinator?.persistentStores.first,&#xA;    let metadata = context.persistentStoreCoordinator?.metadata(for: store) {        &#xA;        fillSettings(metadata: metadata)&#xA;}&#xA;&#xA;func fillSettings(metadata: [String: Any]) {&#xA;    if let theAuthor = metadata[&amp;quot;Author&amp;quot;] as? String {&#xA;        author = theAuthor&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;code&gt;NSPersistentStoreCoordinator&lt;/code&gt; also has a class method to retrieve the metadata, but it requires you to write a &lt;code&gt;do-try-catch&lt;/code&gt; block. Calling the instance method is easier.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>UITextView Word Count in Swift</title>
      <link>https://www.meandmark.com/uitextview-word-count-in-swift-2/</link>
      <pubDate>Tue, 24 Oct 2017 19:54:11 +0000</pubDate>
      <guid>https://www.meandmark.com/uitextview-word-count-in-swift-2/</guid>
      <description>&lt;p&gt;Getting the word count of an iOS text view is a little more difficult than a Mac text view because the &lt;code&gt;NSTextStorage&lt;/code&gt; class’s &lt;code&gt;words&lt;/code&gt; property is not available on iOS. A starting point for getting the word count is to separate the components of the text view’s string by whitespace and newline characters.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let words = textView.text.components(separatedBy: .whitespacesAndNewlines)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The problem is the &lt;code&gt;componentsSeparatedBy&lt;/code&gt; function treats empty strings as words. If you have an empty text view, the word count will be 1. Pressing the space bar increments the word count. If you hit the space bar 5 times, the word count goes up by 5 even though you didn’t type any words.&lt;/p&gt;&#xA;&lt;p&gt;The solution to get an accurate word count is to filter the empty strings out of the array of words.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@IBOutlet weak var textView: UITextView!&#xA;&#xA;let words = textView.text.components(separatedBy: .whitespacesAndNewlines)&#xA;let filteredWords = words.filter({ (word) -&amp;gt; Bool in&#xA;    word != &amp;quot;&amp;quot;&#xA;})&#xA;let wordCount = filteredWords.count&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>A Note About Swift for Job Recruiters</title>
      <link>https://www.meandmark.com/a-note-about-swift-for-job-recruiters/</link>
      <pubDate>Mon, 16 Oct 2017 19:44:03 +0000</pubDate>
      <guid>https://www.meandmark.com/a-note-about-swift-for-job-recruiters/</guid>
      <description>&lt;p&gt;Apple first showed the Swift language to developers in June 2014. At the time I am writing this, that means Swift has been out for a little over three years. That means no developer can have more than three years of Swift experience. You can’t require 5+ years of Swift experience in your job description when the language hasn’t been out that long. No one will have 5 years of Swift experience until June 2019.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 9: Undefined Behavior Sanitizer</title>
      <link>https://www.meandmark.com/xcode-9-undefined-behavior-sanitizer/</link>
      <pubDate>Thu, 05 Oct 2017 18:11:43 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-undefined-behavior-sanitizer/</guid>
      <description>&lt;p&gt;Xcode 9 adds the Undefined Behavior Sanitizer. Undefined Behavior Sanitizer detects undefined behavior in your code, specializing in checking unsafe constructs in C, C++, and Objective-C code.&lt;/p&gt;&#xA;&lt;p&gt;Undefined Behavior Sanitizer is turned off initially. You must enable it in your scheme. Select the Run step in the scheme and click the Diagnostics button at the top of the scheme editor. Select the Undefined Behavior Sanitizer checkbox.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/10/Xcode9UndefinedBehaviorSanitizer-1.png&#34; alt=&#34;Xcode9UndefinedBehaviorSanitizer&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;347&#34; /&gt; &#xA;&lt;p&gt;After selecting the Undefined Behavior Sanitizer checkbox, build and run your project to run it through Undefined Behavior Sanitizer. You can learn more about Undefined Behavior Sanitizer in the following WWDC video:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://developer.apple.com/videos/play/wwdc2017/406/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Finding Bugs Using Xcode Runtime Tools&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 9: Main Thread Checker</title>
      <link>https://www.meandmark.com/xcode-9-main-thread-checker-2/</link>
      <pubDate>Mon, 02 Oct 2017 19:36:07 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-main-thread-checker-2/</guid>
      <description>&lt;p&gt;Xcode 9 adds Main Thread Checker, a tool that detects when you make AppKit, UIKit, and WebKit calls on a background thread. Main Thread Checker should be enabled automatically when debugging, but you can check your scheme by selecting the Run step and clicking the Diagnostics button at the top of the scheme editor. Make sure the Main Thread Checker checkbox is selected.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/10/Xcode9UndefinedBehaviorSanitizer.png&#34; alt=&#34;Xcode9UndefinedBehaviorSanitizer&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;347&#34; /&gt; &#xA;&lt;p&gt;You can learn more about Main Thread Checker in the following WWDC video:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://developer.apple.com/videos/play/wwdc2017/406/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Finding Bugs Using Xcode Runtime Tools&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 9: Ignore Files</title>
      <link>https://www.meandmark.com/xcode-9-ignore-files-2/</link>
      <pubDate>Mon, 25 Sep 2017 19:52:30 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-ignore-files-2/</guid>
      <description>&lt;p&gt;Xcode 9’s Source Control preferences let you specify files to ignore so the version control system won’t track them.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/09/Xcode9IgnoreFiles.png&#34; alt=&#34;Xcode9IgnoreFiles&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;367&#34; /&gt;</description>
    </item>
    <item>
      <title>Xcode 9: New Build System</title>
      <link>https://www.meandmark.com/xcode-9-new-build-system/</link>
      <pubDate>Thu, 21 Sep 2017 18:48:00 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-new-build-system/</guid>
      <description>&lt;p&gt;Xcode 9 provides a preview of a new build system that has been built from scratch in Swift. The new build system is supposed to be faster and more reliable.&lt;/p&gt;&#xA;&lt;p&gt;To use the new build system in one of your projects, you must enable the new build system for that project. Choose File &amp;gt; Project Settings to open the project settings sheet. Choose New Build System from the Build System menu under Shared Project Settings.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/09/Xcode9NewBuildSystem.png&#34; alt=&#34;Xcode9NewBuildSystem&#34; border=&#34;0&#34; width=&#34;568&#34; height=&#34;470&#34; /&gt; &#xA;&lt;p&gt;I didn’t notice much of a difference using the new build system, but I don’t have any huge projects that take forever to build with the old build system.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 9: Cocoa Xib File Projects Return</title>
      <link>https://www.meandmark.com/xcode-9-cocoa-xib-file-projects-return-2/</link>
      <pubDate>Tue, 19 Sep 2017 19:05:33 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-cocoa-xib-file-projects-return-2/</guid>
      <description>&lt;p&gt;Xcode 8.3 removed the Use Storyboards checkbox for new Cocoa application projects. The checkbox has returned in Xcode 9 so you can choose whether to use storyboards or xib files for your project’s user interface.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 9: Swift Refactoring</title>
      <link>https://www.meandmark.com/xcode-9-swift-refactoring/</link>
      <pubDate>Mon, 18 Sep 2017 04:48:59 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-swift-refactoring/</guid>
      <description>&lt;p&gt;Xcode 9 adds Swift refactoring support, something Swift developers have been asking for since Swift’s introduction. Choose Editor &amp;gt; Refactor to access the refactoring options. Xcode 9 has the following refactoring options:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Rename&lt;/li&gt;&#xA;&lt;li&gt;Extract function&lt;/li&gt;&#xA;&lt;li&gt;Extract method&lt;/li&gt;&#xA;&lt;li&gt;Extract variable&lt;/li&gt;&#xA;&lt;li&gt;Extract all occurrences&lt;/li&gt;&#xA;&lt;li&gt;Add missing abstract class overrides&lt;/li&gt;&#xA;&lt;li&gt;Add missing protocol requirements&lt;/li&gt;&#xA;&lt;li&gt;Add missing switch cases&lt;/li&gt;&#xA;&lt;li&gt;Convert to switch statement&lt;/li&gt;&#xA;&lt;li&gt;Expand default&lt;/li&gt;&#xA;&lt;li&gt;Generate missing function definitions&lt;/li&gt;&#xA;&lt;li&gt;Wrap in NSLocalizedString&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I haven’t had the chance to use the refactoring tools much so I can’t provide more detailed information on the Swift refactoring options. You can find more information on Swift refactoring in the following article on the Swift language website:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://swift.org/blog/swift-local-refactoring/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Swift Local Refactoring&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 9: Improved GitHub Support</title>
      <link>https://www.meandmark.com/xcode-9-improved-github-support/</link>
      <pubDate>Fri, 15 Sep 2017 19:04:32 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-improved-github-support/</guid>
      <description>&lt;p&gt;Xcode 9 makes it easier to work with GitHub. Start by adding your GitHub account to Xcode. Go to Xcode’s Accounts preferences, click the Add button, and choose GitHub to add your GitHub account.&lt;/p&gt;&#xA;&lt;p&gt;Once you add your GitHub account to Xcode, you can go to any GitHub repository and clone the project in Xcode by clicking the Clone or download button and clicking the Open in Xcode link. You have to be logged into GitHub for the Open in Xcode link to be available.&lt;/p&gt;&#xA;&lt;p&gt;You can learn more about Xcode 9’s improved GitHub support by watching the following WWDC video:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://developer.apple.com/videos/play/wwdc2017/405/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;GitHub and the New Source Control Workflows in Xcode 9&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;update&#34; class=&#34;relative group&#34;&gt;Update &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;You can also clone GitHub repositories from Xcode by choosing Source Control &amp;gt; Clone. A sheet opens.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2018/02/Xcode9CloneGitHub.png&#34; alt=&#34;Xcode9CloneGitHub&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;379&#34; /&gt; &#xA;&lt;p&gt;In the search field you can search for a GitHub repository or enter the URL of the repository you want to clone. Select the repository you want to clone and click the Clone button.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 9: Source Control Navigator</title>
      <link>https://www.meandmark.com/xcode-9-source-control-navigator/</link>
      <pubDate>Wed, 13 Sep 2017 18:52:16 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-source-control-navigator/</guid>
      <description>&lt;p&gt;Xcode moved the branching version control operations to the source control navigator, whose button is next to the project navigator.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/09/Xcode9Branches.png&#34; alt=&#34;Xcode9Branches&#34; border=&#34;0&#34; width=&#34;256&#34; height=&#34;182&#34; /&gt; &#xA;&lt;p&gt;The source control navigator shows your local branches, tags, and remote branches. Selecting a branch shows the commit history for the branch. Double-clicking a commit shows the changes you made in that commit. Select a commit, right-click, and choose Checkout to revert your repository to that commit.&lt;/p&gt;&#xA;&lt;h3 id=&#34;branching-operations&#34; class=&#34;relative group&#34;&gt;Branching Operations &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#branching-operations&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To create a new branch, select the branch where you want to base the new branch, right-click, and choose Branch from. A sheet will open for you to name the branch.&lt;/p&gt;&#xA;&lt;p&gt;To switch to a branch, select the branch, right-click, and choose Checkout.&lt;/p&gt;&#xA;&lt;p&gt;To create a tag, select a branch, right-click, and choose Tag. A sheet will open for you to name the tag and supply a tag message.&lt;/p&gt;&#xA;&lt;p&gt;To delete a branch, select it, right-click, and choose Delete. You cannot delete the current branch.&lt;/p&gt;&#xA;&lt;p&gt;Merging branches involves a branch you select from the source control navigator and the current branch. Select a branch that’s not the current branch and right-click. The contextual menu that opens has items to merge the selected branch into the current branch and merge the current branch into the selected branch.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Custom Notifications in Swift</title>
      <link>https://www.meandmark.com/custom-notifications-in-swift/</link>
      <pubDate>Fri, 08 Sep 2017 19:20:51 +0000</pubDate>
      <guid>https://www.meandmark.com/custom-notifications-in-swift/</guid>
      <description>&lt;p&gt;Notifications allow an object of one class to send a message for an object of another class to handle so the two classes don’t have to know about each other. The Cocoa framework has dozens of notifications, but you can also create your own.&lt;/p&gt;&#xA;&lt;p&gt;Using custom notifications involves the following steps:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Get the notification center&lt;/li&gt;&#xA;&lt;li&gt;Post the notification&lt;/li&gt;&#xA;&lt;li&gt;Observe the notification&lt;/li&gt;&#xA;&lt;li&gt;Handle the notification&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;getting-the-notification-center&#34; class=&#34;relative group&#34;&gt;Getting the Notification Center &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#getting-the-notification-center&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The notification center is where you post and observe notifications. Each Cocoa application has its own notification center. Use the &lt;code&gt;NotificationCenter&lt;/code&gt; class’s &lt;code&gt;default&lt;/code&gt; property to access your application’s notification center.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let center = NotificationCenter.default&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;posting-a-notification&#34; class=&#34;relative group&#34;&gt;Posting a Notification &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#posting-a-notification&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Call the &lt;code&gt;NotificationCenter&lt;/code&gt; class’s &lt;code&gt;post&lt;/code&gt; function to post a notification. Supply the name of the notification and an optional object if you need to pass data to the notification observer.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;center.post(name: NSNotification.Name(rawValue: &amp;quot;NotificationName&amp;quot;), object: nil)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Notice that the notification name is a string. You may want to create an enumeration for your application’s custom notifications to avoid mistyping a notification name.&lt;/p&gt;&#xA;&lt;h3 id=&#34;observing-a-notification&#34; class=&#34;relative group&#34;&gt;Observing a Notification &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#observing-a-notification&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Call the &lt;code&gt;NotificationCenter&lt;/code&gt; class’s &lt;code&gt;addObserver&lt;/code&gt; function to observe a notification. The &lt;code&gt;addObserver&lt;/code&gt; function takes the following arguments:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The observing object, which is usually &lt;code&gt;self&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;The selector, which contains the name of the function to call when receiving a notification.&lt;/li&gt;&#xA;&lt;li&gt;The name of the notification to observe. The name must match the name you supplied to the &lt;code&gt;post&lt;/code&gt; function.&lt;/li&gt;&#xA;&lt;li&gt;The sender. If you want to observe all instances of the notification, use &lt;code&gt;nil&lt;/code&gt; as the sender. If you want to observe notifications posted by a specific object, supply the object as the sender.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The following example demonstrates observing a notification:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;center.addObserver(self, &#xA;    selector: #selector(MyClass.handleNotification(_:)), &#xA;    name: NSNotification.Name(rawValue: &amp;quot;NotificationName&amp;quot;), &#xA;    object: nil)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;handling-a-notification&#34; class=&#34;relative group&#34;&gt;Handling a Notification &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#handling-a-notification&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Handling a notification involves writing a function. Functions that handle notifications take a &lt;code&gt;NSNotification&lt;/code&gt; object as an argument.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func handleNotification(_ note: NSNotification) {&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The argument for the function must match the argument for the selector when observing the notification. I put the _ character before the &lt;code&gt;note&lt;/code&gt; argument so I wouldn’t have to supply an argument to the selector. If I didn’t have the _ character, I would have to supply the &lt;code&gt;note&lt;/code&gt; argument to the selector when observing the notification.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;#selector(MyClass.handleNotification(note:))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating a Document-Based Mac Application Using Swift and Storyboards</title>
      <link>https://www.meandmark.com/creating-a-document-based-mac-application-using-swift-and-storyboards/</link>
      <pubDate>Tue, 08 Aug 2017 01:06:07 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-a-document-based-mac-application-using-swift-and-storyboards/</guid>
      <description>&lt;p&gt;I continue my writing on crafting modern Cocoa applications with Swift and storyboards. In this article you’ll learn about building document-based Cocoa applications by developing a simple text editor. I hope this article and project provide a gentle introduction to building document-based Cocoa applications in Swift.&lt;/p&gt;&#xA;&lt;p&gt;If you haven’t read it already, I recommend reading my &lt;a href=&#34;http://meandmark.com/blog/2017/03/creating-a-simple-mac-application-using-cocoa-swift-and-storyboards/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Creating a Simple Mac Application Using Cocoa, Swift, and Storyboards&lt;/a&gt; article. It provides more detailed information on some steps I gloss over in this article.&lt;/p&gt;&#xA;&lt;h3 id=&#34;create-the-project&#34; class=&#34;relative group&#34;&gt;Create the Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-the-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Let’s start by creating a new project. In Xcode choose File &amp;gt; New &amp;gt; Project to open the New Project Assistant. Select Cocoa Application, which is in the macOS section. Click the Next button to move to the next step.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/08/NewProjectStep2.png&#34; alt=&#34;NewProjectStep2&#34; border=&#34;0&#34; width=&#34;598&#34; height=&#34;439&#34; /&gt; &#xA;&lt;p&gt;Enter a name for the project in the Product Name text field. Select None from the Team menu.&lt;/p&gt;&#xA;&lt;p&gt;Select the Create Document-Based Application checkbox and deselect the Use Core Data checkbox. Enter &lt;code&gt;rtf&lt;/code&gt; in the Document Extension text field because the project saves RTF files. RTF stands for &lt;a href=&#34;https://en.wikipedia.org/wiki/Rich_Text_Format&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Rich Text Format&lt;/a&gt;, a text file format the Cocoa text system natively supports.&lt;/p&gt;&#xA;&lt;p&gt;Click the Next button to move to the last step of the project creation process. Choose a location to save your project. If you want to put your project under version control, select the Create Git repository checkbox. Click the Create button.&lt;/p&gt;&#xA;&lt;p&gt;There are three files you will work on in the project.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Main.storyboard&lt;/code&gt; contains the user interface.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ViewController.swift&lt;/code&gt; contains the code for the view controller.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Document.swift&lt;/code&gt; contains the code for the document. The document is a subclass of &lt;code&gt;NSDocument&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The names &lt;code&gt;ViewController&lt;/code&gt; and &lt;code&gt;Document&lt;/code&gt; are generic. I kept these names for this project because there’s only one view controller in the project and a text editor deals with documents. If you write your own document-based applications, you would benefit from renaming the classes and files &lt;code&gt;ViewController&lt;/code&gt; and &lt;code&gt;Document&lt;/code&gt; to something more descriptive.&lt;/p&gt;&#xA;&lt;h3 id=&#34;create-the-user-interface&#34; class=&#34;relative group&#34;&gt;Create the User Interface &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-the-user-interface&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Select the storyboard from the project navigator to open it. At the start, the storyboard should look like the following:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/08/StoryboardStartingPoint.png&#34; alt=&#34;StoryboardStartingPoint&#34; border=&#34;0&#34; width=&#34;362&#34; height=&#34;600&#34; /&gt; &#xA;&lt;p&gt;Xcode provides a menu bar, a window controller for an empty window, and a view controller for the window’s content view. Start by selecting the label that says &lt;code&gt;Your document contents here&lt;/code&gt; and deleting it by pressing the Delete key.&lt;/p&gt;&#xA;&lt;h4 id=&#34;add-a-text-view&#34; class=&#34;relative group&#34;&gt;Add a Text View &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-a-text-view&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;The user interface for this project requires only one additional interface element: a text view. Find the text view in Xcode’s object library. Drag the text view from the object library to the view controller. Resize the text view so it fills the content view.&lt;/p&gt;&#xA;&lt;h4 id=&#34;tell-the-text-view-to-use-the-inspector-bar&#34; class=&#34;relative group&#34;&gt;Tell the Text View to Use the Inspector Bar &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#tell-the-text-view-to-use-the-inspector-bar&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;The inspector bar provides controls to do things like change the font, set the text alignment, and add lists. Using the inspector bar isn’t mandatory, but it makes text editing more pleasant.&lt;/p&gt;&#xA;&lt;p&gt;The nice thing about using the inspector bar is it requires no additional code. Select the text view and open the attributes inspector. Select the Uses Inspector Bar checkbox.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/08/UseInspectorBar.png&#34; alt=&#34;UseInspectorBar&#34; border=&#34;0&#34; width=&#34;246&#34; height=&#34;433&#34; /&gt; &#xA;&lt;h4 id=&#34;create-an-outlet-for-the-text-view&#34; class=&#34;relative group&#34;&gt;Create an Outlet for the Text View &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-an-outlet-for-the-text-view&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Select the file &lt;code&gt;ViewController.swift&lt;/code&gt; from the project navigator. Create an outlet for the text view so you can access the text view in your code.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@IBOutlet weak var textView: NSTextView!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now connect the text view in the storyboard to the outlet you just created. Open Xcode’s assistant editor so the files &lt;code&gt;ViewController.swift&lt;/code&gt; and &lt;code&gt;Main.storyboard&lt;/code&gt; are open at the same time. Choose View &amp;gt; Assistant Editor &amp;gt; Show Assistant Editor to open the assistant editor. Open &lt;code&gt;ViewController.swift&lt;/code&gt; in one editor and &lt;code&gt;Main.storyboard&lt;/code&gt; in the other editor.&lt;/p&gt;&#xA;&lt;p&gt;Select the text view in the storyboard. Hold down the Control key and drag it to the &lt;code&gt;textView&lt;/code&gt; variable in the source code file to connect the outlet.&lt;/p&gt;&#xA;&lt;h4 id=&#34;resize-the-text-view-when-the-window-resizes&#34; class=&#34;relative group&#34;&gt;Resize the Text View When the Window Resizes &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#resize-the-text-view-when-the-window-resizes&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;At this point you could build and run the project and have a mostly functioning text editor. You can create documents, enter text, cut and paste, choose fonts, and print documents. But you’ll notice a problem if you make the window larger. The text view stays the same size so you get empty space when you make the window bigger.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/08/TextViewNotResizing.png&#34; alt=&#34;TextViewNotResizing&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;387&#34; /&gt; &#xA;&lt;p&gt;The next step is to make the text view resize when the window resizes so the text view fills the window. Select the text view’s scroll view and open the size inspector. In the autoresizing section, click the two arrows in the inner square.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/08/AutoresizingMask.png&#34; alt=&#34;AutoresizingMask&#34; border=&#34;0&#34; width=&#34;258&#34; height=&#34;455&#34; /&gt; &#xA;&lt;h3 id=&#34;save-and-open-the-document&#34; class=&#34;relative group&#34;&gt;Save and Open the Document &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#save-and-open-the-document&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To make the text editor usable, you must save documents to disk and open those documents. Saving the document involves writing the text view’s contents to a file. Opening the document involves reading the saved data and filling the text view with the file’s data.&lt;/p&gt;&#xA;&lt;h4 id=&#34;accessing-the-view-controller-from-the-document&#34; class=&#34;relative group&#34;&gt;Accessing the View Controller from the Document &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#accessing-the-view-controller-from-the-document&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Remember that saving the document involves writing the text view’s contents to a file. To retrieve the text view’s contents, the document needs to access the view controller, which holds the text view. Add the following code to the &lt;code&gt;Document.swift&lt;/code&gt; file to get the view controller:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var viewController: ViewController? {&#xA;    return windowControllers[0].contentViewController as? ViewController&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The code takes advantage of the fact the document has only one window controller. Access the first item in the &lt;code&gt;windowControllers&lt;/code&gt; array and get its content view controller.&lt;/p&gt;&#xA;&lt;h4 id=&#34;saving-the-data&#34; class=&#34;relative group&#34;&gt;Saving the Data &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#saving-the-data&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;To save the document you must override the function &lt;code&gt;dataOfType&lt;/code&gt;. Fortunately Xcode provides a shell of this function in the &lt;code&gt;Document.swift&lt;/code&gt; file.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;override func data(ofType typeName: String) throws -&amp;gt; Data {&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Your job is to write the function, which saves the text view’s contents.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;override func data(ofType typeName: String) throws -&amp;gt; Data {&#xA;    // Save the text view contents to disk&#xA;    if let textView = viewController?.textView,&#xA;        let rangeLength = textView.string?.characters.count {&#xA;&#xA;        textView.breakUndoCoalescing()&#xA;        let textRange = NSRange(location: 0, length: rangeLength)&#xA;        if let contents = textView.rtf(from: textRange) {&#xA;            return contents&#xA;        }&#xA;    }&#xA;    throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The function starts with a nested &lt;code&gt;if-let&lt;/code&gt; statement. The outer &lt;code&gt;if-let&lt;/code&gt; statement grabs the text view. The inner &lt;code&gt;let&lt;/code&gt; statement gets the length of the text view’s contents.&lt;/p&gt;&#xA;&lt;p&gt;The call to &lt;code&gt;breakUndoCoalescing&lt;/code&gt; preserves the tracking of unsaved changes and the document’s dirty state so that saving the document doesn’t mess with them.&lt;/p&gt;&#xA;&lt;p&gt;The next two lines of code build a range for the text view’s contents and supply the range as an argument to the &lt;code&gt;NSText&lt;/code&gt; function &lt;code&gt;rtf&lt;/code&gt;. The &lt;code&gt;rtf&lt;/code&gt; function converts the text view’s contents to RTF for saving.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;throw&lt;/code&gt; statement at the end opens an alert if the save fails.&lt;/p&gt;&#xA;&lt;p&gt;Notice that you don’t have to open a Save panel to save the document. Cocoa’s document architecture handles that for you.&lt;/p&gt;&#xA;&lt;h4 id=&#34;loading-the-data&#34; class=&#34;relative group&#34;&gt;Loading the Data &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#loading-the-data&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;To load the data from disk, you must override the function &lt;code&gt;readFromData&lt;/code&gt;. Xcode supplies a shell of the function for you to fill in the &lt;code&gt;Document.swift&lt;/code&gt; file.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;override func read(from data: Data, ofType typeName: String) throws {&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Start by adding a property to the &lt;code&gt;Document&lt;/code&gt; class to store the saved text.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var text = NSAttributedString()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In the &lt;code&gt;readFromData&lt;/code&gt; function create an attributed string with the file’s RTF contents. Set the &lt;code&gt;text&lt;/code&gt; property to the attributed string you created.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;override func read(from data: Data, ofType typeName: String) throws {&#xA;    if let contents = NSAttributedString(rtf: data, documentAttributes: nil) {&#xA;        text = contents&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I used an &lt;code&gt;if-let&lt;/code&gt; statement instead of setting the &lt;code&gt;text&lt;/code&gt; variable directly to avoid dealing with Swift implicitly unwrapped optionals. Implicitly unwrapped optionals can crash your application if the optional value is nil. Avoid using implicitly unwrapped optionals when you can.&lt;/p&gt;&#xA;&lt;p&gt;You might be wondering why the &lt;code&gt;readFromData&lt;/code&gt; function doesn’t set the text view’s contents. My initial attempt at writing the code for this tutorial did set the text view’s contents. But I discovered that when loading a document, &lt;code&gt;readFromData&lt;/code&gt; is called before the storyboard loads the window controller and view controller. This means if you try to access the view controller in &lt;code&gt;readFromData&lt;/code&gt;, the view controller doesn’t yet exist. Because the view controller doesn’t exist, you can’t access the view controller and text view from &lt;code&gt;readFromData&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;filling-the-text-view-with-the-file8217s-contents&#34; class=&#34;relative group&#34;&gt;Filling the Text View with the File’s Contents &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#filling-the-text-view-with-the-file8217s-contents&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;The last step is to fill the text view with the loaded document’s contents. Override the &lt;code&gt;viewDidAppear&lt;/code&gt; function in the view controller.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;override func viewDidAppear() {&#xA;    // Fill the text view with the document&#39;s contents.&#xA;    let document = self.view.window?.windowController?.document as! Document&#xA;    textView.textStorage?.setAttributedString(document.text)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The first line of code in &lt;code&gt;viewDidAppear&lt;/code&gt; accesses the document. The second line sets the text view’s contents to the document’s &lt;code&gt;text&lt;/code&gt; property, which contains the data stored in the file.&lt;/p&gt;&#xA;&lt;p&gt;You might be wondering why I overrode &lt;code&gt;viewDidAppear&lt;/code&gt; instead of &lt;code&gt;viewDidLoad&lt;/code&gt;. &lt;code&gt;viewDidAppear&lt;/code&gt; is called after the storyboard and document are loaded so I can be sure the document exists. If I overrode &lt;code&gt;viewDidLoad&lt;/code&gt;, the document wouldn’t exist when &lt;code&gt;viewDidLoad&lt;/code&gt; was called, and the program would crash.&lt;/p&gt;&#xA;&lt;p&gt;If you build and run the project, you should be able to save and open documents.&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusion&#34; class=&#34;relative group&#34;&gt;Conclusion &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#conclusion&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you made it this far, congratulations. You wrote a usable text editor. Now you can see why there are so many text editing applications on the Mac. Adding a text view provides most basic text editing functions so you don’t have to reinvent common behavior. Cocoa’s document architecture handles opening Save and Open panels, reducing the amount of code you have to write. There’s fewer than 20 lines of code to write in this project.&lt;/p&gt;&#xA;&lt;p&gt;The project &lt;a href=&#34;https://github.com/meandmark/RichTextEditor&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;is on GitHub&lt;/a&gt; for you to download if you have trouble building or running the project.&lt;/p&gt;&#xA;&lt;p&gt;If you want to learn more about developing document-based applications, read the &lt;em&gt;Document-Based App Programming Guide for Mac&lt;/em&gt;, which is part of Apple’s documentation.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 9: Subversion Support Deprecated</title>
      <link>https://www.meandmark.com/xcode-9-subversion-support-deprecated/</link>
      <pubDate>Wed, 02 Aug 2017 02:22:09 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-9-subversion-support-deprecated/</guid>
      <description>&lt;p&gt;The Xcode 9 beta release notes say that Xcode’s Subversion integration will be deprecated in a future release. I expect Xcode’s Subversion support to go away in Xcode 10. If you use Xcode’s version control tools with Subversion, your options are to either switch to git or use another Subversion GUI tool.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Instantiating Views from Mac Storyboards</title>
      <link>https://www.meandmark.com/instantiating-views-from-mac-storyboards/</link>
      <pubDate>Tue, 30 May 2017 04:25:33 +0000</pubDate>
      <guid>https://www.meandmark.com/instantiating-views-from-mac-storyboards/</guid>
      <description>&lt;p&gt;This is another post I’m writing as a reference to myself in case I need to deal with this subject in the future. There may be better ways to instantiate views than what I describe here. I’m sharing this information because there’s not much information available on Mac storyboards.&lt;/p&gt;&#xA;&lt;p&gt;Reading the following articles may help you follow along:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://meandmark.com/blog/2017/03/creating-a-simple-mac-application-using-cocoa-swift-and-storyboards/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Creating a Simple Mac Application Using Cocoa, Swift, and Storyboards&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://meandmark.com/blog/2015/02/connecting-menu-items-to-ibactions-in-a-mac-storyboard/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Connecting Menu Items to IBActions in a Mac Storyboard&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;introduction&#34; class=&#34;relative group&#34;&gt;Introduction &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#introduction&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When developing user interfaces for Mac apps, you can normally lay out the whole interface in Interface Builder at design time. But sometime you need to add user interface elements at run time. Many PDF viewers let people add sticky notes to PDF documents. The developer of a PDF viewer would create a text view or custom view for the sticky note in Interface Builder but wait until the user decides to add a sticky note to add the view to the PDF document.&lt;/p&gt;&#xA;&lt;p&gt;Instantiating a view from a storyboard involves the following high level steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a subclass of &lt;code&gt;NSViewController&lt;/code&gt; for your view.&lt;/li&gt;&#xA;&lt;li&gt;Add a new scene to the storyboard for your view controller.&lt;/li&gt;&#xA;&lt;li&gt;Set the class of the new scene’s view controller to your subclass.&lt;/li&gt;&#xA;&lt;li&gt;Add an IBAction to the view controller that will create the view.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;creating-a-view-controller-subclass&#34; class=&#34;relative group&#34;&gt;Creating a View Controller Subclass &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#creating-a-view-controller-subclass&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Storyboard scenes need a view controller. If you’re going to instantiate a view from a storyboard, you need to create a view controller for the view.&lt;/p&gt;&#xA;&lt;p&gt;To add a view controller to your project, choose File &amp;gt; New &amp;gt; File in Xcode. Select Cocoa Class from the list of file templates. Name your class and make it a subclass of &lt;code&gt;NSViewController&lt;/code&gt;. When you’re done, the class should look similar to the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;class StickyNoteViewController: NSViewController {&#xA;    @IBOutlet var textView: NSTextView?&#xA;&#xA;    override func viewDidLoad() {&#xA;        super.viewDidLoad()&#xA;        // Do view setup here.&#xA;    }&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;I decided to stick with the sticky note theme and use a text view as the sticky note. Your class won’t have the @IBOutlet variable. Add an outlet for your view so you can connect it in Interface Builder.&lt;/p&gt;&#xA;&lt;h3 id=&#34;add-a-new-scene&#34; class=&#34;relative group&#34;&gt;Add a New Scene &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-a-new-scene&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Open your storyboard. Drag a view controller from the object library to the storyboard canvas to create a new scene.&lt;/p&gt;&#xA;&lt;p&gt;Add your view to the view controller in the new scene. Configure the view using the attributes inspector. If you created an outlet for the view in your view controller subclass, connect the view to that outlet.&lt;/p&gt;&#xA;&lt;h3 id=&#34;set-the-view-controller-class&#34; class=&#34;relative group&#34;&gt;Set the View Controller Class &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#set-the-view-controller-class&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now that you’ve added the scene, set the view controller class to your subclass. Select the view controller in Interface Builder and open the identity inspector.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/05/CustomClassAndStoryboardID.png&#34; alt=&#34;CustomClassAndStoryboardID&#34; border=&#34;0&#34; width=&#34;258&#34; height=&#34;212&#34; /&gt; &#xA;&lt;p&gt;Enter the name of your view controller subclass in the Class combo box.&lt;/p&gt;&#xA;&lt;p&gt;While you are in the identity inspector, enter a name for the view controller in the Storyboard ID text field. You will need this ID when you load the view controller from the storyboard.&lt;/p&gt;&#xA;&lt;h3 id=&#34;add-an-ibaction-to-create-the-view&#34; class=&#34;relative group&#34;&gt;Add an IBAction to Create the View &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-an-ibaction-to-create-the-view&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now it’s time to instantiate the view. Create an IBAction in the view controller where you’re going to create your view. In the IBAction you’ll instantiate the view.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@IBAction func addStickyNote(_ sender: AnyObject) {&#xA;    if let board = storyboard {&#xA;        let stickyNoteController = board.instantiateController(withIdentifier: &amp;quot;stickyNote&amp;quot;)&#xA;            as! StickyNoteViewController&#xA;        addChildViewController(stickyNoteController)&#xA;        view.addSubview(stickyNoteController.view)&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;What the code does is load the &lt;code&gt;NSViewController&lt;/code&gt; subclass from the storyboard, add the view controller as a child view controller, and add the view as a subview.&lt;/p&gt;&#xA;&lt;p&gt;Don’t forget to add a menu item or a control and connect it to this IBAction.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>RWDevCon 2016 Vault</title>
      <link>https://www.meandmark.com/rwdevcon-2016-vault/</link>
      <pubDate>Wed, 26 Apr 2017 04:05:00 +0000</pubDate>
      <guid>https://www.meandmark.com/rwdevcon-2016-vault/</guid>
      <description>&lt;p&gt;I saw the site &lt;a href=&#34;https://www.raywenderlich.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;raywenderlich.com&lt;/a&gt; made the videos of their RWDevCon 2016 conference freely available.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://store.raywenderlich.com/products/rwdevcon-2016-vault&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;RWDevCon 2016 Vault&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;There are 24 videos to watch along with materials to download so you can follow along with the tutorials in the videos. The videos are a year old and use Swift 2 so you’ll have to convert the code to Swift 3 if you’re using Xcode 8. But the RWDevCon 2016 Vault looks like a great resource for people wanting to learn iOS development, Xcode tips, and Instruments tips.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 8.3: Instruments Display Settings Moved</title>
      <link>https://www.meandmark.com/xcode-8-3-instruments-display-settings-moved/</link>
      <pubDate>Tue, 18 Apr 2017 19:40:59 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-8-3-instruments-display-settings-moved/</guid>
      <description>&lt;p&gt;Prior to Xcode 8.3 the configuration section of the Instruments trace document window had an area for display settings, as you can see in the following image:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/04/InstrumentsCallTreeCheckboxes.png&#34; alt=&#34;InstrumentsCallTreeCheckboxes&#34; border=&#34;0&#34; width=&#34;263&#34; height=&#34;392&#34; /&gt; &#xA;&lt;p&gt;Starting with Xcode 8.3 the display settings area has been removed from the configuration section. You can access settings you configure before starting a trace by choosing File &amp;gt; Recording Options in Instruments. The following image shows the configuration options for the Allocations instrument:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/04/InstrumentsRecordSettings.png&#34; alt=&#34;InstrumentsRecordSettings&#34; border=&#34;0&#34; width=&#34;295&#34; height=&#34;300&#34; /&gt; &#xA;&lt;p&gt;The remaining display settings are at the bottom of the window. The following image shows the bottom of the window for the Allocations instrument:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/04/InstrumentsDisplaySettingsXcode8-3.png&#34; alt=&#34;InstrumentsDisplaySettingsXcode8 3&#34; border=&#34;0&#34; width=&#34;588&#34; height=&#34;17&#34; /&gt; &#xA;&lt;p&gt;Click the Call Tree button to access the Call Tree series of checkboxes.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/04/CallTreeCheckboxes.png&#34; alt=&#34;CallTreeCheckboxes&#34; border=&#34;0&#34; width=&#34;277&#34; height=&#34;123&#34; /&gt;</description>
    </item>
    <item>
      <title>Xcode 8.3: Cocoa Projects Use Storyboards</title>
      <link>https://www.meandmark.com/xcode-8-3-cocoa-projects-use-storyboards/</link>
      <pubDate>Mon, 03 Apr 2017 04:07:10 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-8-3-cocoa-projects-use-storyboards/</guid>
      <description>&lt;p&gt;In Xcode 8.3 Apple removed the Use Storyboards checkbox for new Cocoa application projects. New projects use storyboards. Keep a copy of Xcode 8.2 to create new projects if you prefer using xib files.&lt;/p&gt;&#xA;&lt;p&gt;If you want to use xib files instead of storyboards in Xcode 8.3, you’ll have to remove the storyboard from the project and add a xib file to the project. You will also have to tell Xcode to use your xib file as the main interface file for the project.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select your project from the project navigator to open the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Select the application target from the left side of the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Click the General button at the top of the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Enter the name of the xib file in the Main Interface combo box. Don’t enter the .xib extension.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/04/SetMainInterface.png&#34; alt=&#34;SetMainInterface&#34; border=&#34;0&#34; width=&#34;598&#34; height=&#34;165&#34; /&gt; &#xA;&lt;p&gt;Additional information can be found in the following thread on Apple’s developer forums:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://forums.developer.apple.com/thread/74868&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Did Xcode 8.3 update eliminate the basic AppDelegate project template?&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating a Simple Mac Application Using Cocoa, Swift, and Storyboards</title>
      <link>https://www.meandmark.com/creating-a-simple-mac-application-using-cocoa-swift-and-storyboards/</link>
      <pubDate>Fri, 31 Mar 2017 19:06:35 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-a-simple-mac-application-using-cocoa-swift-and-storyboards/</guid>
      <description>&lt;p&gt;I’ve noticed there aren’t many articles or tutorials online about writing Mac apps in Swift. To help fill the void I’m writing this tutorial that guides you through the creation of a simple Cocoa app in Swift.&lt;/p&gt;&#xA;&lt;p&gt;The app converts temperatures from Celsius to Fahrenheit. Enter a temperature in Celsius, click a Convert button, and the app shows the temperature in Fahrenheit. I can’t think of a simpler app to introduce Cocoa programming.&lt;/p&gt;&#xA;&lt;p&gt;The screenshots in this article are from Xcode 8.3. If you are using a different version of Xcode, some screens may look different.&lt;/p&gt;&#xA;&lt;h3 id=&#34;create-the-project&#34; class=&#34;relative group&#34;&gt;Create the Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-the-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Open Xcode and choose File &amp;gt; New &amp;gt; Project. The New Project Assistant opens. Select Cocoa Application, which is in the macOS section.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/03/NewProjectStep1.png&#34; alt=&#34;NewProjectStep1&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;433&#34; /&gt; &#xA;&lt;p&gt;Click the Next button to move to the next step.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/03/NewProjectStep2.png&#34; alt=&#34;NewProjectStep2&#34; border=&#34;0&#34; width=&#34;598&#34; height=&#34;439&#34; /&gt; &#xA;&lt;p&gt;Enter a name for the project in the Product Name text field. I chose the name &lt;code&gt;TemperatureConverter&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Select None from the Team menu. Teams are used to submit apps to the App Store. This project isn’t going on the App Store.&lt;/p&gt;&#xA;&lt;p&gt;The organization name appears in the copyright notice of new source code files Xcode creates. If you don’t have an organization name, enter your name in the Organization Name text field.&lt;/p&gt;&#xA;&lt;p&gt;The organization identifier is a way to uniquely identify yourself and the app you’re creating for things like preference files. There should be no spaces in the organization identifier. Something like &lt;code&gt;com.YourOrganizationName&lt;/code&gt; should work fine for this project.&lt;/p&gt;&#xA;&lt;p&gt;Choose Swift from the Language menu.&lt;/p&gt;&#xA;&lt;p&gt;Starting with Xcode 8.3 Cocoa application projects use storyboards by default. If you’re using an earlier version of Xcode, you should see a Use Storyboards checkbox. Select the Use Storyboards checkbox.&lt;/p&gt;&#xA;&lt;p&gt;Deselect the Create Document-Based Application and Use Core Data checkboxes. You can also deselect the Include Unit Tests and Include UI Tests checkboxes if you want.&lt;/p&gt;&#xA;&lt;p&gt;Click the Next button to move to the last step of the project creation process. Choose a location to save your project. If you want to put your project under version control, select the Create Git repository checkbox. Click the Create button.&lt;/p&gt;&#xA;&lt;p&gt;When you create the project, the left side of the project window shows all the files in the project. The two files you will be working with in this tutorial are &lt;code&gt;ViewController.swift&lt;/code&gt; and &lt;code&gt;Main.storyboard&lt;/code&gt;. &lt;code&gt;ViewController.swift&lt;/code&gt; contains the source code. &lt;code&gt;Main.storyboard&lt;/code&gt; contains the user interface.&lt;/p&gt;&#xA;&lt;h3 id=&#34;creating-the-user-interface&#34; class=&#34;relative group&#34;&gt;Creating the User Interface &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#creating-the-user-interface&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To create the user interface for this project, you must open &lt;code&gt;Main.storyboard&lt;/code&gt;. Select &lt;code&gt;Main.storyboard&lt;/code&gt; from the left side of the project window to open the storyboard. The initial storyboard Apple provides for a Cocoa application looks similar to the following screenshot:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/03/StoryboardStartingPoint.png&#34; alt=&#34;StoryboardStartingPoint&#34; border=&#34;0&#34; width=&#34;384&#34; height=&#34;600&#34; /&gt; &#xA;&lt;p&gt;Xcode provides a menu bar, a window controller for an empty window, and a view controller for the window’s content view. To build the user interface for this project, you’re going to add the following items to the view controller:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A text field to enter the Celsius temperature&lt;/li&gt;&#xA;&lt;li&gt;A label to show the Fahrenheit temperature&lt;/li&gt;&#xA;&lt;li&gt;A button to perform the temperature conversion&lt;/li&gt;&#xA;&lt;li&gt;Explanatory labels for the text field and Fahrenheit temperature label&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The user interface elements are in Xcode’s object library. Choose View &amp;gt; Utilities &amp;gt; Show Object Library to open the object library, which is in the lower right corner of the project window.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/03/ObjectLibrary.png&#34; alt=&#34;ObjectLibrary&#34; border=&#34;0&#34; width=&#34;257&#34; height=&#34;249&#34; /&gt; &#xA;&lt;p&gt;There is a search field at the bottom of the object library you can use to filter user interface elements. Type &lt;code&gt;Label&lt;/code&gt; to find the label. Type &lt;code&gt;Text Field&lt;/code&gt; to find the text field. Type &lt;code&gt;Button&lt;/code&gt; to find a button.&lt;/p&gt;&#xA;&lt;p&gt;Drag a user interface element from the object library to the view controller. Double-click on a label or button to change its text.&lt;/p&gt;&#xA;&lt;p&gt;When you are finished the view controller should look similar to the following:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/03/UserInterface.png&#34; alt=&#34;UserInterface&#34; border=&#34;0&#34; width=&#34;488&#34; height=&#34;311&#34; /&gt; &#xA;&lt;p&gt;I used a push button for the Convert button.&lt;/p&gt;&#xA;&lt;h3 id=&#34;create-the-outlets&#34; class=&#34;relative group&#34;&gt;Create the Outlets &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-the-outlets&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Select the file &lt;code&gt;ViewController.swift&lt;/code&gt; from the left side of the project window. What you need to do is add outlets for the Celsius text field and the Fahrenheit label so you can access them in your code.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@IBOutlet weak var celsiusTextField: NSTextField!&#xA;@IBOutlet weak var fahrenheitLabel: NSTextField!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Let’s go through the outlet declarations piece by piece.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;@IBOutlet&lt;/code&gt; tells the compiler the variable is an outlet so you can make a connection to it in Interface Builder, which is the part of Xcode you use to design user interfaces.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;weak&lt;/code&gt; says the outlet is a weak reference. If you remove the word &lt;code&gt;weak&lt;/code&gt; the outlet becomes a strong reference. Weak and strong references deal with Cocoa’s memory management. A deeper explanation is beyond the scope of this tutorial.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;var&lt;/code&gt; says the outlet is a variable and not a constant. Outlets must be variables.&lt;/li&gt;&#xA;&lt;li&gt;After the &lt;code&gt;var&lt;/code&gt; is the name of the variable.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;NSTextField&lt;/code&gt; tells the compiler the type of the outlet. The outlets in this tutorial are text fields. Labels are text fields whose values can’t be edited.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The exclamation point after &lt;code&gt;NSTextField&lt;/code&gt; requires more explanation. The exclamation point tells the compiler the outlet is an implicitly unwrapped optional. An optional value may or may not exist. Declaring the two outlets doesn’t mean the text field and label exist in the storyboard. The app won’t know until it launches the storyboard and loads the window and its contents.&lt;/p&gt;&#xA;&lt;p&gt;An implicitly unwrapped optional states the variable is guaranteed to exist. If an implicitly unwrapped optional does not exist and your app accesses it, the app crashes. In your Swift code you should avoid using implicitly unwrapped optionals because they can cause your app to crash. Implicitly unwrapped optionals are OK to use for outlets because the storyboard is going to load. If the text field and label don’t exist, the app isn’t going to work so you might as well crash.&lt;/p&gt;&#xA;&lt;h3 id=&#34;connect-the-outlets&#34; class=&#34;relative group&#34;&gt;Connect the Outlets &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#connect-the-outlets&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now you need to connect the text field and label in the storyboard to the outlets you created. If you don’t make these connections, your app will crash when it runs.&lt;/p&gt;&#xA;&lt;p&gt;Open Xcode’s assistant editor so you can have the files &lt;code&gt;ViewController.swift&lt;/code&gt; and &lt;code&gt;Main.storyboard&lt;/code&gt; open at the same time. Choose View &amp;gt; Assistant Editor &amp;gt; Show Assistant Editor to open the assistant editor. Open &lt;code&gt;ViewController.swift&lt;/code&gt; in one editor and &lt;code&gt;Main.storyboard&lt;/code&gt; in the other editor.&lt;/p&gt;&#xA;&lt;p&gt;Select the Celsius text field in the storyboard. Hold down the Control key and drag it to the &lt;code&gt;celsiusTextField&lt;/code&gt; variable in the source code file. When you reach the variable, it should highlight and there should be an option to connect the outlet. Release the mouse button when it says Connect Outlet.&lt;/p&gt;&#xA;&lt;p&gt;Making connections in Xcode can be frustrating. Sometimes the Connect Outlet option does not appear. Keep trying and eventually you will be able to make the connection.&lt;/p&gt;&#xA;&lt;p&gt;After connecting the Celsius text field, connect the label. Select the label. It should be the one with the value 0, not the one that says Fahrenheit Temperature. Control-drag the label to the &lt;code&gt;fahrenheitLabel&lt;/code&gt; variable. Choose Connect Outlet. When you connect the outlets, the left side of the editor has a connection symbol for the outlets, as you can see in lines 13 and 14.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/03/ConnectionMarks.png&#34; alt=&#34;ConnectionMarks&#34; border=&#34;0&#34; width=&#34;511&#34; height=&#34;48&#34; /&gt; &#xA;&lt;h3 id=&#34;write-the-code&#34; class=&#34;relative group&#34;&gt;Write the Code &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#write-the-code&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now it’s time to start writing code. Open the file &lt;code&gt;ViewController.swift&lt;/code&gt; and add the following two functions:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@IBAction func convertToFahrenheit(_ sender: AnyObject) {&#xA;    if let celsiusTemperature = Float(celsiusTextField.stringValue) {&#xA;        let fahrenheitTemperature = convert(celsius: celsiusTemperature)&#xA;        fahrenheitLabel.stringValue = fahrenheitTemperature.description&#xA;    }&#xA;}&#xA;&#xA;func convert(celsius: Float) -&amp;gt; Float {&#xA;    return ((celsius * 1.8) + 32.0)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Let’s look at the signature of the &lt;code&gt;convertToFahrenheit&lt;/code&gt; function.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;@IBAction&lt;/code&gt; tells the compiler the function is an Interface Builder action so you can connect the Convert button to it.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;func&lt;/code&gt; is the keyword to declare a Swift function.&lt;/li&gt;&#xA;&lt;li&gt;The function takes an argument named &lt;code&gt;sender&lt;/code&gt;, which has type &lt;code&gt;AnyObject&lt;/code&gt;. All Interface Builder actions take a sender as an argument. The _ character before &lt;code&gt;sender&lt;/code&gt; means you don’t have to type &lt;code&gt;sender:&lt;/code&gt; when calling &lt;code&gt;convertToFahrenheit&lt;/code&gt; the way I typed &lt;code&gt;celsius:&lt;/code&gt; when calling the &lt;code&gt;convert&lt;/code&gt; function.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;What complicates the &lt;code&gt;convertToFahrenheit&lt;/code&gt; function is the fact that text fields and labels store strings. You cannot do calculations with strings because strings might not have numeric values. To convert the temperature to Fahrenheit, you need to convert the value of the Celsius text field to a floating-point number. That’s what the first line of code does. The &lt;code&gt;if let&lt;/code&gt; statement allows you to safely handle the situation where there’s no number in the text field. If someone enters &lt;code&gt;XYZ&lt;/code&gt; in the Celsius text field, the function returns without doing anything.&lt;/p&gt;&#xA;&lt;p&gt;The second line calls the function to convert the Celsius temperature to Fahrenheit. The third line sets the Fahrenheit label’s text to the Fahrenheit temperature.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;convert&lt;/code&gt; function takes the Celsius temperature and returns the Fahrenheit temperature using the following formula:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;F = (1.8 * C) + 32&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;connect-the-convert-button&#34; class=&#34;relative group&#34;&gt;Connect the Convert Button &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#connect-the-convert-button&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now the last step is to connect the Convert button so that the conversion occurs when you click the button. Open &lt;code&gt;Main.storyboard&lt;/code&gt;. You should see the object list on the left side of the editor.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/03/ObjectList.png&#34; alt=&#34;ObjectList&#34; border=&#34;0&#34; width=&#34;341&#34; height=&#34;319&#34; /&gt; &#xA;&lt;p&gt;Select the Convert button. Control-drag to the First Responder object in the view controller scene. You won’t be able to connect to the First Responder object in the application scene. When you make the connection, a HUD opens with a long list of actions to choose from. Select &lt;code&gt;convertToFahrenheit&lt;/code&gt;. Now when someone clicks the Convert button, it calls the &lt;code&gt;convertToFahrenheit&lt;/code&gt; function.&lt;/p&gt;&#xA;&lt;h3 id=&#34;turn-off-code-signing&#34; class=&#34;relative group&#34;&gt;Turn Off Code Signing &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#turn-off-code-signing&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode projects are initially set to use code signing so you can submit your apps to the App Store. Code signing requires you to be a member of Apple’s paid developer program. I can’t assume everyone reading this article is a member of Apple’s paid developer program. That’s why I had you choose None from the Team menu when you created the project. Because there is no team you have to turn off code signing for the project to get the project to build.&lt;/p&gt;&#xA;&lt;p&gt;To turn off code signing, perform the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select the project from the project navigator on the left side of the project window to open the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Select the application target from the list of targets on the left side of the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Click the Build Settings button at the top of the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Set the Code Signing Identity build setting to Don’t Code Sign.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/03/TurnOffCodeSigning.png&#34; alt=&#34;TurnOffCodeSigning&#34; border=&#34;0&#34; width=&#34;598&#34; height=&#34;169&#34; /&gt; &#xA;&lt;h3 id=&#34;build-the-project&#34; class=&#34;relative group&#34;&gt;Build the Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#build-the-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;In the upper left corner of the project window is the Run button, which looks like the Play button on a DVD player. Click the Run button to build your project and run it.&lt;/p&gt;&#xA;&lt;p&gt;If you run into problems building the project, make sure there are no typing mistakes in your code. Making a tiny mistake typing the name of a variable or function is enough to prevent the compiler from building your project.&lt;/p&gt;&#xA;&lt;p&gt;If the app crashes when you run it, make sure you connected the outlets. My &lt;a href=&#34;http://meandmark.com/blog/2017/03/finding-where-your-app-crashes-in-xcode/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Finding Where Your App Crashes in Xcode article&lt;/a&gt; can help you locate the cause of the crash.&lt;/p&gt;&#xA;&lt;p&gt;If clicking the Convert button does nothing, make sure you connected the button to the IBAction and make sure you entered a numeric value in the Celsius text field.&lt;/p&gt;&#xA;&lt;p&gt;If all else fails, I have &lt;a href=&#34;https://github.com/meandmark/TemperatureConverter&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;the project on GitHub&lt;/a&gt; for you to download.&lt;/p&gt;&#xA;&lt;h3 id=&#34;where-to-go-from-here&#34; class=&#34;relative group&#34;&gt;Where to Go From Here? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#where-to-go-from-here&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;You could build upon this project by making the conversion from Fahrenheit to Celsius.&lt;/p&gt;&#xA;&lt;p&gt;To learn more about Cocoa programming, you best source is Apple’s documentation, which you can access in Xcode by choosing Help &amp;gt; Documentation and API Reference. I wish I could recommend a book on Mac development, but when I searched Amazon for Cocoa programming books, the last book was published in April 2015 and used Swift 1.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Finding Where Your App Crashes in Xcode</title>
      <link>https://www.meandmark.com/finding-where-your-app-crashes-in-xcode/</link>
      <pubDate>Mon, 20 Mar 2017 18:26:40 +0000</pubDate>
      <guid>https://www.meandmark.com/finding-where-your-app-crashes-in-xcode/</guid>
      <description>&lt;p&gt;As you’re developing an app, it may crash when you run it. When it crashes you want to know where the crash occurs so you can fix the error that’s causing the crash. Set an exception breakpoint in Xcode to find your project crashes.&lt;/p&gt;&#xA;&lt;h3 id=&#34;setting-an-exception-breakpoint&#34; class=&#34;relative group&#34;&gt;Setting an Exception Breakpoint &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#setting-an-exception-breakpoint&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Go to Xcode’s breakpoint navigator by choosing View &amp;gt; Navigators &amp;gt; Show Breakpoint Navigator. At the bottom of the breakpoint navigator is an Add (+) button. Click the Add button and choose Exception Breakpoint. The exception breakpoint is initially set to fire on all exceptions.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/03/ExceptionBreakpoint.png&#34; alt=&#34;ExceptionBreakpoint&#34; border=&#34;0&#34; width=&#34;257&#34; height=&#34;97&#34; /&gt; &#xA;&lt;p&gt;Now when you run your app in Xcode, Xcode will pause the app when it crashes, allowing you to locate the line of code where the crash occurs.&lt;/p&gt;&#xA;&lt;p&gt;One thing to keep in mind with exceptions is they can fire for reasons other than a crash. As an example Xcode throws an exception every time you save with Core Data, even if there are no problems with the save. Disable the exception breakpoint when it annoys you. Enable the exception breakpoint when your app crashes.&lt;/p&gt;&#xA;&lt;h3 id=&#34;sharing-the-breakpoint&#34; class=&#34;relative group&#34;&gt;Sharing the Breakpoint &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#sharing-the-breakpoint&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Setting an exception breakpoint is something you want for most projects. Xcode lets you share breakpoints so you don’t have to create them every time you create a new project. Exception breakpoints and test failure breakpoints are the most common breakpoints to share.&lt;/p&gt;&#xA;&lt;p&gt;There are two ways to share a breakpoint. First, select the breakpoint in the breakpoint navigator, right-click, and choose Share Breakpoint.&lt;/p&gt;&#xA;&lt;p&gt;Second, you can make a user breakpoint that is available for every project in your Mac user account. Select the breakpoint in the breakpoint navigator, right-click, and choose Move Breakpoint To &amp;gt; User.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 8: Core Data Class Generation</title>
      <link>https://www.meandmark.com/xcode-8-core-data-class-generation/</link>
      <pubDate>Wed, 01 Mar 2017 05:02:49 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-8-core-data-class-generation/</guid>
      <description>&lt;p&gt;Xcode 8 adds support for automatically creating classes for your Core Data entities. If you look at Xcode’s data model inspector, you will see a Codegen menu.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/03/Xcode8CoreDataCodeGenMenu.png&#34; alt=&#34;Xcode8CoreDataCodeGenMenu&#34; border=&#34;0&#34; width=&#34;259&#34; height=&#34;207&#34; /&gt; &#xA;&lt;p&gt;The Codegen menu has the following items:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Manual/None, which means Xcode does not generate code files for the entity. This is the same behavior that previous versions of Xcode had. You must create the classes for your entities by choosing Editor &amp;gt; Create NSManagedObject Subclass in Xcode.&lt;/li&gt;&#xA;&lt;li&gt;Class Definition, which means Xcode generates the entity’s class files for you. Xcode does the equivalent of you choosing Editor &amp;gt; Create NSManagedObject Subclass. Class Definition is the default option for new projects.&lt;/li&gt;&#xA;&lt;li&gt;Category/Extension, which means Xcode creates an Objective-C category or Swift class extension for the entity.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you choose Class Definition or Category/Extension for one of your entities, make sure you don’t manually create a &lt;code&gt;NSManagedObject&lt;/code&gt; subclass for that entity. Manually creating the subclass creates duplicate class files, and your project won’t build. Remove the manually created subclass files from the project if you have duplicate files.&lt;/p&gt;&#xA;&lt;h3 id=&#34;where-are-the-files&#34; class=&#34;relative group&#34;&gt;Where Are the Files? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#where-are-the-files&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you choose Class Definition or Category/Extension from the Codegen menu, you’ll notice there are no files for the &lt;code&gt;NSManagedObject&lt;/code&gt; subclasses in your project. Where are the files?&lt;/p&gt;&#xA;&lt;p&gt;Xcode creates the files when you build the project. The files are in your project’s derived data location. Read my &lt;a href=&#34;http://meandmark.com/blog/2015/08/changing-xcodes-build-location/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Changing Xcode’s Build Location&lt;/a&gt; post for more information on the derived data location. You’re not meant to access and edit the Core Data class files Xcode creates. The point of Xcode creating the class files is to automatically update the files when you make changes to the data model.&lt;/p&gt;&#xA;&lt;p&gt;What do you do if you want to add methods to your &lt;code&gt;NSManagedObject&lt;/code&gt; subclasses? Create a new file for your methods. Add either a Swift class extension or an Objective-C category.&lt;/p&gt;&#xA;&lt;h3 id=&#34;which-codegen-option-should-you-use&#34; class=&#34;relative group&#34;&gt;Which Codegen Option Should You Use? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#which-codegen-option-should-you-use&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;In most cases you should use either the manual or class definition codegen options. The advantage of the class definition codegen option is you don’t have to worry about forgetting to change your classes when you change your data model. Xcode keeps the class and data model in sync. The advantage of manually creating your Core Data class files is you can access them in the project window and edit them.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Instruments: Call Tree View Is Your Friend</title>
      <link>https://www.meandmark.com/instruments-call-tree-view-is-your-friend/</link>
      <pubDate>Mon, 23 Jan 2017 20:36:45 +0000</pubDate>
      <guid>https://www.meandmark.com/instruments-call-tree-view-is-your-friend/</guid>
      <description>&lt;p&gt;On Stack Overflow I see the same question constantly from people who use Instruments. Instruments uncovers a problem with their app. The app could have memory leaks. It could use a lot of memory. The people asking the questions want to know how to find the area of their code that is causing the problem. I have answered questions like this multiple times on Stack Overflow. Rather than repeat myself, I will answer it here.&lt;/p&gt;&#xA;&lt;p&gt;If you want to find the problem areas in your code with Instruments, switch to the call tree view. Select the Invert Call Tree and Hide System Libraries checkboxes to show your code in the call tree view. Double-click a function in the call tree view to find problem lines of code. More detailed information on switching to the call tree view can be found in the Allocations Instrument Call Tree section of the following article:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://meandmark.com/blog/2016/02/getting-started-with-instruments/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Getting Started with Instruments&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Limiting Device Orientations in an iOS App</title>
      <link>https://www.meandmark.com/limiting-device-orientations-in-an-ios-app/</link>
      <pubDate>Sun, 08 Jan 2017 23:44:13 +0000</pubDate>
      <guid>https://www.meandmark.com/limiting-device-orientations-in-an-ios-app/</guid>
      <description>&lt;p&gt;I’ve been developing &lt;a href=&#34;http://checksimgames.com/letterminer.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;an iOS Game&lt;/a&gt; that is meant to be played in landscape orientation. I had problems forcing the game to be played in landscape orientation, causing the game to be rejected by Apple the first time I submitted it.&lt;/p&gt;&#xA;&lt;p&gt;Limiting an iOS app’s device orientations is trickier than you would expect. I didn’t find much information about this online so I’m writing about what I learned.&lt;/p&gt;&#xA;&lt;h3 id=&#34;setting-supported-device-orientations&#34; class=&#34;relative group&#34;&gt;Setting Supported Device Orientations &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#setting-supported-device-orientations&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The first step is to set the supported device orientations for your target in Xcode. Select the project from Xcode’s project navigator to open the project editor. Select the target in the project editor.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/01/XcodeDeviceOrientation.png&#34; alt=&#34;XcodeDeviceOrientation&#34; border=&#34;0&#34; width=&#34;570&#34; height=&#34;328&#34; /&gt; &#xA;&lt;p&gt;In the Deployment Info section there’s a series of Device Orientation checkboxes. Select the checkboxes of the device orientations you want to support. My game is meant to be played in landscape orientation so I selected the two landscape checkboxes.&lt;/p&gt;&#xA;&lt;h3 id=&#34;supported-ipad-orientations&#34; class=&#34;relative group&#34;&gt;Supported iPad Orientations &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#supported-ipad-orientations&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you set the supported device orientations for your app and test the app, you’ll notice something. On the iPhone the app will respect your supported device orientations. But on the iPad the app will support all four possible orientations. Why does the iPad do this?&lt;/p&gt;&#xA;&lt;p&gt;The Info.plist file has a separate entry for supported iPad device orientations. Click the Info button at the top of the project editor to access the Info.plist file properties.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2017/01/SupportediPadOrientations.png&#34; alt=&#34;SupportediPadOrientations&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;373&#34; /&gt; &#xA;&lt;p&gt;When you examine the Supported interface orientations (iPad) entry, you will see the iPad initially supports all four device orientations. Remove the items for the orientations you don’t want to support. In my case this means removing the two portrait items.&lt;/p&gt;&#xA;&lt;h3 id=&#34;disabling-ipad-multitasking-support&#34; class=&#34;relative group&#34;&gt;Disabling iPad Multitasking Support &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#disabling-ipad-multitasking-support&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you set the supported iPad orientations and test your app, it should respect your supported device orientations. But when you try to upload your app to the App Store, the app will be rejected because iPad multitasking requires your app to support all four device orientations.&lt;/p&gt;&#xA;&lt;p&gt;The fix is to disable iPad multitasking support for your app. In the Deployment Info section for the target (Look at the first image in this article), there is a Requires full screen checkbox. Select that checkbox to disable iPad multitasking. With iPad multitasking support disabled you can upload your app to the App Store without having to support all four device orientations.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Adding Markers to Text Lists when Pressing the Return Key</title>
      <link>https://www.meandmark.com/adding-markers-to-text-lists-when-pressing-the-return-key/</link>
      <pubDate>Mon, 12 Dec 2016 22:21:45 +0000</pubDate>
      <guid>https://www.meandmark.com/adding-markers-to-text-lists-when-pressing-the-return-key/</guid>
      <description>&lt;p&gt;I tried using Apple’s &lt;code&gt;NSTextList&lt;/code&gt; class for creating ordered and unordered lists in an application I’m developing. I was able to create lists, but when I pressed the Return key inside an unordered list, no bullet was added.&lt;/p&gt;&#xA;&lt;p&gt;Because of this flaw in &lt;code&gt;NSTextList&lt;/code&gt; I decided to implement my own class for lists. But I still needed to insert markers when pressing the Return key inside the list. There is very little information available on how to insert list markers when pressing the Return key so I’m sharing what I’ve learned.&lt;/p&gt;&#xA;&lt;p&gt;Perform the following steps to insert list markers when the Return key is pressed:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a subclass of &lt;code&gt;NSTextView&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Override the function &lt;code&gt;insertNewline&lt;/code&gt; in your &lt;code&gt;NSTextView&lt;/code&gt; subclass. This function gets called when someone presses the Return key.&lt;/li&gt;&#xA;&lt;li&gt;Use the text view’s &lt;code&gt;selectedRange&lt;/code&gt; property to determine if you’re inside a list. The &lt;code&gt;selectedRange&lt;/code&gt; property’s &lt;code&gt;location&lt;/code&gt; field is the text view’s insertion point.&lt;/li&gt;&#xA;&lt;li&gt;If you’re inside a list, add the marker to the text view’s text storage at the insertion point.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The following Swift code shows a simple example of overriding &lt;code&gt;insertNewline&lt;/code&gt; to insert a bullet when someone presses the Return key inside an unordered list:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;override func insertNewline(_ sender: Any?) {&#xA;    // Choose Edit &amp;gt; Emoji &amp;amp; Symbols in Xcode to enter the bullet character.&#xA;    let bullet = &amp;quot;•\t&amp;quot;&#xA;    let bulletToAdd = NSAttributedString(string: bullet)&#xA;    super.insertNewline(sender)&#xA;    if insideAList() {&#xA;        addMarker(marker: bulletToAdd, point: (selectedRange().location))&#xA;    }  &#xA;}&#xA;&#xA;func addMarker(marker: NSAttributedString, point: Int) {&#xA;    textStorage!.insert(marker, at: point)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You’ll notice I didn’t provide the code for the &lt;code&gt;insideAList&lt;/code&gt; function. That code depends on your application and how you store lists in the application. You have to get the ranges for the lists in your document. Check if the text view’s insertion point is in one of the ranges.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>NSTableView Disappearing Text</title>
      <link>https://www.meandmark.com/nstableview-disappearing-text/</link>
      <pubDate>Wed, 23 Nov 2016 05:00:12 +0000</pubDate>
      <guid>https://www.meandmark.com/nstableview-disappearing-text/</guid>
      <description>&lt;p&gt;I was having a problem with disappearing text in a table view in a Mac application I’m developing. Selecting an item in the table view erased that item’s text from the table view. The table view is part of a split view. Dragging the split view’s divider erased the text from every item in the table view.&lt;/p&gt;&#xA;&lt;p&gt;Finding the cause of the disappearing text was difficult. I had other projects with table views in a split view whose text wasn’t erased. I couldn’t see any differences in the projects whose table views kept their text and the project that erased the table view text.&lt;/p&gt;&#xA;&lt;p&gt;I eventually discovered the cause of the disappearing table text: source list highlighting. Changing the table view’s highlighting from source list to regular fixed the issue. I can now drag the split view divider without erasing the text of every item in the table view.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Maintaining NSTextView Insertion Point After Core Data Save</title>
      <link>https://www.meandmark.com/maintaining-nstextview-insertion-point-after-core-data-save/</link>
      <pubDate>Mon, 21 Nov 2016 05:13:34 +0000</pubDate>
      <guid>https://www.meandmark.com/maintaining-nstextview-insertion-point-after-core-data-save/</guid>
      <description>&lt;p&gt;I am working on a Mac journaling application that uses Core Data. The user interface consists of a table view and a text view. The table view contains a list of dates. Selecting a date fills the text view with what was written on that date. Use the text view to write.&lt;/p&gt;&#xA;&lt;p&gt;One problem I had was saving the text. Core Data is set up initially to save a text view or text field’s contents only when leaving the text view or text field. This behavior works fine for a contact form, but not for a journaling application. Core Data would save the text only when I selected a new date in the table view. With this behavior there’s potential for data loss.&lt;/p&gt;&#xA;&lt;p&gt;I wrote some code to autosave the text view’s contents periodically. The saving worked, but every time I saved, the text view lost focus. When the text view lost focus, I had to click in the text view to resume typing. Autosaving provided a miserable typing experience. How could I autosave while allowing someone to keep typing? I had to perform the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Call the &lt;code&gt;NSTextView&lt;/code&gt; function &lt;code&gt;selectedRange&lt;/code&gt; to save where the person was typing during the autosave.&lt;/li&gt;&#xA;&lt;li&gt;Call the &lt;code&gt;NSWindow&lt;/code&gt; function &lt;code&gt;makeFirstResponder&lt;/code&gt; to make the text view the first responder so the text view didn’t lose focus.&lt;/li&gt;&#xA;&lt;li&gt;Call the &lt;code&gt;NSTextView&lt;/code&gt; function &lt;code&gt;setSelectedRange&lt;/code&gt; to set the typing position back to where it was before the autosave.&lt;/li&gt;&#xA;&lt;li&gt;Call the &lt;code&gt;NSText&lt;/code&gt; function &lt;code&gt;scrollRangeToVisible&lt;/code&gt; to make the text view scroll to the point where the person was typing.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Here’s some Swift 3 code.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func updateTextViewAfterAutosave() {&#xA;    let insertionRange = textView.selectedRange()&#xA;    window.makeFirstResponder(textView)&#xA;    textView.setSelectedRange(insertionRange)&#xA;    textView.scrollRangeToVisible(insertionRange)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Make sure you don’t autosave too often. When I used this code to autosave after every change to the text view’s contents, the text view scrolling was visibly jumpy. Autosaving every 30 seconds worked well.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 8: Automation Instrument Removed</title>
      <link>https://www.meandmark.com/xcode-8-automation-instrument-removed/</link>
      <pubDate>Tue, 15 Nov 2016 01:46:11 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-8-automation-instrument-removed/</guid>
      <description>&lt;p&gt;Apple removed the Automation instrument from Instruments in Xcode 8. Use Xcode’s user interface testing to test your iOS app’s user interface.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 8: Address Sanitizer Supports Swift</title>
      <link>https://www.meandmark.com/xcode-8-address-sanitizer-supports-swift/</link>
      <pubDate>Fri, 16 Sep 2016 22:20:48 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-8-address-sanitizer-supports-swift/</guid>
      <description>&lt;p&gt;I wrote about Xcode’s Address Sanitizer in my &lt;a href=&#34;http://meandmark.com/blog/2015/09/xcode-7-address-sanitizer/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 7: Address Sanitizer&lt;/a&gt; post. Apple added Swift support to Address Sanitizer in Xcode 8.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 8: New Project and New File Assistant Changes</title>
      <link>https://www.meandmark.com/xcode-8-new-project-and-new-file-assistant-changes/</link>
      <pubDate>Wed, 14 Sep 2016 22:09:26 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-8-new-project-and-new-file-assistant-changes/</guid>
      <description>&lt;p&gt;Xcode 8 changes the look of the assistant windows for creating new projects and new files. The following screenshot shows the New Project Assistant:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/09/Xcode8NewProjectAssistant.png&#34; alt=&#34;Xcode8NewProjectAssistant&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;433&#34; /&gt; &#xA;&lt;p&gt;The following screenshot shows the New File Assistant:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/09/Xcode8NewFileAssistant..png&#34; alt=&#34;Xcode8NewFileAssistant&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;433&#34; /&gt; &#xA;&lt;p&gt;Select an operating system at the top of the assistant to view the available templates for that operating system. If you look at the New Project Assistant screenshot, you will see a Cross-platform option at the top.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/09/Xcode8CrossPlatformProjects.png&#34; alt=&#34;Xcode8CrossPlatformProjects&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;433&#34; /&gt; &#xA;&lt;p&gt;The external build system project template has moved to the Cross-platform section. There’s also a project template for making a cross-platform SpriteKit game.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Simple Ways to Customize NSSavePanel</title>
      <link>https://www.meandmark.com/simple-ways-to-customize-nssavepanel/</link>
      <pubDate>Thu, 08 Sep 2016 05:00:50 +0000</pubDate>
      <guid>https://www.meandmark.com/simple-ways-to-customize-nssavepanel/</guid>
      <description>&lt;p&gt;Cocoa provides the &lt;code&gt;NSSavePanel&lt;/code&gt; class to open a save panel when the user wants to save a document. Save panels are initially configured for saving. The default button’s name is &lt;strong&gt;Save&lt;/strong&gt;, and the panel’s title is also &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Suppose your application exports documents to various file formats. Exporting is similar to saving so you would open a save panel. When exporting you would like the panel title and the default button’s name to be &lt;strong&gt;Export&lt;/strong&gt; instead of &lt;strong&gt;Save&lt;/strong&gt;. How do you make these changes?&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;NSSavePanel&lt;/code&gt; provides properties to customize the various fields in the panel. The properties you are most likely to change are &lt;code&gt;prompt&lt;/code&gt;, &lt;code&gt;title&lt;/code&gt;, and &lt;code&gt;nameFieldLabel&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;prompt&#34; class=&#34;relative group&#34;&gt;prompt &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#prompt&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The &lt;code&gt;prompt&lt;/code&gt; property stores the default button’s text. To change the button text from &lt;strong&gt;Save&lt;/strong&gt; to &lt;strong&gt;Export&lt;/strong&gt;, add the following Swift code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let savePanel = NSSavePanel()&#xA;savePanel.prompt = &amp;quot;Export&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;title&#34; class=&#34;relative group&#34;&gt;title &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#title&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The &lt;code&gt;title&lt;/code&gt; property stores the name of the panel title. To change the title to &lt;strong&gt;Export&lt;/strong&gt;, add the following Swift code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;savePanel.title = &amp;quot;Export&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;namefieldlabel&#34; class=&#34;relative group&#34;&gt;nameFieldLabel &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#namefieldlabel&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The &lt;code&gt;nameFieldLabel&lt;/code&gt; stores the label for the text field where the user enters the file name. To change the label from &lt;strong&gt;Save As:&lt;/strong&gt; to &lt;strong&gt;Export As:&lt;/strong&gt;, add the following Swift code:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;savePanel.nameFieldLabel = &amp;quot;Export As:&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating PDFs with Core Text and Quartz</title>
      <link>https://www.meandmark.com/creating-pdfs-with-core-text-and-quartz/</link>
      <pubDate>Sun, 28 Aug 2016 04:13:30 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-pdfs-with-core-text-and-quartz/</guid>
      <description>&lt;p&gt;I’m working on a project where I need to create PDF files for long documents. When I searched online for information on Core Text and creating PDF files, I didn’t find much so I’m sharing what I’ve learned. I have not tried creating PDFs on iOS, but most of this material should apply to iOS as Core Text and Quartz are available on iOS.&lt;/p&gt;&#xA;&lt;p&gt;One word of warning about this article: the code samples are for illustration only. If you copy and paste them into Xcode, they probably will not work. If you are looking for code to paste into your projects, stop reading now. This article shows the functions you need to call, but you have to write the code.&lt;/p&gt;&#xA;&lt;p&gt;The code samples are written in Swift 3. If you are using Swift 2, you’ll get syntax errors. Swift 3 is in a state of flux so you might get errors in Swift 3 too. Xcode’s code completion should show you the proper function names and arguments. Pay attention to the data structures you need to know and the functions you need to call. They’re the most important material in this article.&lt;/p&gt;&#xA;&lt;h3 id=&#34;frameworks&#34; class=&#34;relative group&#34;&gt;Frameworks &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#frameworks&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Core Text and Quartz are not part of the Cocoa framework so you have to import them in your code.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;import CoreText&#xA;import Quartz&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;data-structures&#34; class=&#34;relative group&#34;&gt;Data Structures &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#data-structures&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To create PDF files with Core Text and Quartz, you need to know the following data structures: &lt;code&gt;CGContext&lt;/code&gt;, &lt;code&gt;CTFramesetter&lt;/code&gt;, and &lt;code&gt;CTFrame&lt;/code&gt;. &lt;code&gt;CGContext&lt;/code&gt; is a Quartz context (Quartz is also called Core Graphics in Apple’s documentation. That’s where the CG comes from) where you draw the PDF content.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;CTFramesetter&lt;/code&gt; is a Core Text framesetter. You will have at least one framesetter for each page in your PDF. The framesetter’s job is to create a frame. &lt;code&gt;CTFrame&lt;/code&gt; is a Core Text frame. You will draw one or more frames for each page. You need one frame for the main page content. If you want to draw any content in a page header or footer, you must create additional frames. A common reason to create an additional frame is to draw page numbers.&lt;/p&gt;&#xA;&lt;h3 id=&#34;coding-tasks&#34; class=&#34;relative group&#34;&gt;Coding Tasks &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#coding-tasks&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Creating a PDF file involves the following tasks:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a URL for the PDF file.&lt;/li&gt;&#xA;&lt;li&gt;Create a context to draw the PDF content.&lt;/li&gt;&#xA;&lt;li&gt;Create a framesetter.&lt;/li&gt;&#xA;&lt;li&gt;Create a frame.&lt;/li&gt;&#xA;&lt;li&gt;Draw the frame in the context.&lt;/li&gt;&#xA;&lt;li&gt;Repeat Steps 3-5 until you run out of text to draw.&lt;/li&gt;&#xA;&lt;li&gt;Save the PDF file.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h4 id=&#34;create-the-url&#34; class=&#34;relative group&#34;&gt;Create the URL &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-the-url&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Every PDF you create requires a URL for the PDF file. In Mac applications you normally get the URL by opening a Save panel. You can also use the &lt;code&gt;NSURL&lt;/code&gt; class to manually create a URL.&lt;/p&gt;&#xA;&lt;h4 id=&#34;create-the-context&#34; class=&#34;relative group&#34;&gt;Create the Context &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-the-context&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Call the function &lt;code&gt;CGPDFContextCreateWithURL()&lt;/code&gt; to create a context for drawing PDF content. Fortunately in Swift all you have to do is create a &lt;code&gt;CGContext&lt;/code&gt; object. The function to create a &lt;code&gt;CGContext&lt;/code&gt; takes three arguments. The first argument is the URL for the PDF file. The second argument is a media box, which is a rectangle that specifies the PDF bounds. If you pass &lt;code&gt;nil&lt;/code&gt;, Quartz assumes the page size is the standard paper size, 8.5 by 11 inches. The final argument is an optional dictionary that specifies additional information for the PDF context to use when creating the PDF file. Examples of the additional information include the title and author of the document.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let pdfContext = CGContext(fileURL, mediaBox: nil, nil)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you use a custom page rectangle in Swift, you must make the rectangle variable a &lt;code&gt;var&lt;/code&gt; instead of a &lt;code&gt;let&lt;/code&gt; and pass the address of the variable using the &amp;amp; character like you would do in C or Objective-C. The following code uses a 6 by 9 inch page size:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var pageBox = CGRect(x: 0.0, y: 0.0, width: 432.0, height: 648.0)&#xA;let pdfContext = CGContext(fileURL, mediaBox: &amp;amp;pageBox, nil)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Quartz uses points as its unit of measurement. There are 72 points per inch.&lt;/p&gt;&#xA;&lt;h4 id=&#34;create-the-framesetter&#34; class=&#34;relative group&#34;&gt;Create the Framesetter &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-the-framesetter&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Call the function &lt;code&gt;CTFramesetterCreateWithAttributedString()&lt;/code&gt; to create a framesetter. Supply an attributed string containing the text for the PDF.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let framesetter = CTFramesetterCreateWithAttributedString(text)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h4 id=&#34;create-the-frame&#34; class=&#34;relative group&#34;&gt;Create the Frame &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-the-frame&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Core Text has a handy function to determine how much text can fit in a page frame: &lt;code&gt;CTFramesetterSuggestFrameSizeWithConstraints()&lt;/code&gt;. This function takes five arguments. The first argument is the framesetter you created. The second argument is the range of the text being laid out. This range is initially the range of the document text. As you draw pages of text, update the range’s starting location so you don’t draw the same content more than once.&lt;/p&gt;&#xA;&lt;p&gt;The third argument is an optional dictionary of attributes. The fourth argument is the page size. Remember to factor in page margins when calculating the page size. The final argument is the range of text that fits on the page. &lt;code&gt;CTFramesetterSuggestFrameSizeWithConstraints()&lt;/code&gt; returns its result in the final argument.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var pageRange = CFRange()&#xA;CTFramesetterSuggestFrameSizeWithConstraints(framesetter, textRange, nil, pageSize, &amp;amp;pageRange)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Call the function &lt;code&gt;CTFramesetterCreateFrame()&lt;/code&gt; to create the frame. This function takes four arguments. The first argument is the framesetter. The second argument is the range that &lt;code&gt;CTFramesetterSuggestFrameSizeWithConstraints()&lt;/code&gt; returns. The third argument is a path for drawing. You can create a &lt;code&gt;CGPath&lt;/code&gt; from a rectangle and a &lt;code&gt;nil&lt;/code&gt; transform. The final argument is another optional dictionary of attributes. The following code creates a frame for a standard 8.5 by 11 inch page with one inch margins:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let pageRect = CGRect(x: 72.0, y: 72.0, width: 468.0, height: 648.0)&#xA;let framePath = CGPath(rect: pageRect, transform: nil)&#xA;let frame = CTFramesetterCreateFrame(framesetter, pageRange, framePath, nil)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h4 id=&#34;draw-the-page&#34; class=&#34;relative group&#34;&gt;Draw the Page &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#draw-the-page&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Now you can draw the page. Call the function &lt;code&gt;beginPDFPage()&lt;/code&gt; to begin drawing in a PDF page. Call the function &lt;code&gt;CTFrameDraw()&lt;/code&gt; to draw a frame. Supply the frame and the context. Call the function &lt;code&gt;endPDFPage()&lt;/code&gt; to finish drawing.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pdfContext?.beginPDFPage(nil)&#xA;CTFrameDraw(frame, pdfContext?)&#xA;pdfContext?.endPDFPage()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you have multiple frames to draw in a page, add more &lt;code&gt;CTFrameDraw()&lt;/code&gt; calls. Make sure the calls are between the calls to &lt;code&gt;beginPDFPage()&lt;/code&gt; and &lt;code&gt;endPDFPage()&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;save-the-pdf&#34; class=&#34;relative group&#34;&gt;Save the PDF &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#save-the-pdf&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;At this point you have created a PDF. Now you have to save it. Close the PDF context to save the file by calling the function &lt;code&gt;closePDF()&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;pdfContext?.closePDF()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;additional-reading&#34; class=&#34;relative group&#34;&gt;Additional Reading &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#additional-reading&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To learn more about Quartz and Core Text, read &lt;em&gt;Quartz 2D Programming Guide&lt;/em&gt; and &lt;em&gt;Core Text Programming Guide&lt;/em&gt;. Both documents are part of Apple’s documentation. &lt;em&gt;Quartz 2D Programming Guide&lt;/em&gt; will show you how to draw things besides text with Quartz.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Use Xcode Breakpoint Actions to Replace NSLog Statements</title>
      <link>https://www.meandmark.com/use-xcode-breakpoint-actions-to-replace-nslog-statements/</link>
      <pubDate>Mon, 15 Aug 2016 04:02:24 +0000</pubDate>
      <guid>https://www.meandmark.com/use-xcode-breakpoint-actions-to-replace-nslog-statements/</guid>
      <description>&lt;p&gt;Many Mac and iOS developers use &lt;code&gt;NSLog&lt;/code&gt; or Swift &lt;code&gt;print&lt;/code&gt; statements to log debugging information to Xcode’s console. You can eliminate these statements by using Xcode breakpoint actions.&lt;/p&gt;&#xA;&lt;h3 id=&#34;adding-breakpoint-actions&#34; class=&#34;relative group&#34;&gt;Adding Breakpoint Actions &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#adding-breakpoint-actions&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The first step to creating breakpoint actions is to create a breakpoint. Click in the gutter next to a line of code in Xcode’s editor to set a breakpoint at that line of code. Right-click on the breakpoint arrow and choose Edit Breakpoint to open a popover like the following:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/08/BreakpointEditor.png&#34; alt=&#34;BreakpointEditor&#34; border=&#34;0&#34; width=&#34;440&#34; height=&#34;118&#34; /&gt; &#xA;&lt;p&gt;Click the Add Action button to add a breakpoint action. Choose Log Message from the Action menu.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/08/LogBreakpointAction.png&#34; alt=&#34;LogBreakpointAction&#34; border=&#34;0&#34; width=&#34;443&#34; height=&#34;223&#34; /&gt; &#xA;&lt;h3 id=&#34;entering-log-messages&#34; class=&#34;relative group&#34;&gt;Entering Log Messages &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#entering-log-messages&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Enter the message you want to log in the text field. Most text you enter is logged literally. If you type the following message:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Breakpoint reached.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The text &lt;strong&gt;Breakpoint reached.&lt;/strong&gt; is logged. In most cases when you’re logging, you want to log the value of a variable. To log the value of a variable, wrap it in @ characters, such as the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Length: @length@&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If the value of the &lt;code&gt;length&lt;/code&gt; variable is 10, the following message is logged:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Length: 10&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Suppose you have a game where you have a &lt;code&gt;player&lt;/code&gt; object that stores player data. The player has a vector value &lt;code&gt;position&lt;/code&gt;, and you want to know the player’s &lt;code&gt;x&lt;/code&gt; position. You would enter the following text in the text field:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Player X: @player.position.x@&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If the value of &lt;code&gt;x&lt;/code&gt; is 50, the following message is logged:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Player X: 50&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;automatically-continuing&#34; class=&#34;relative group&#34;&gt;Automatically Continuing &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#automatically-continuing&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you looked at the screenshots, you may have noticed a checkbox to automatically continue after evaluating actions. In most cases you should select this checkbox. By selecting the checkbox Xcode logs the message and continues running your application. Deselect the checkbox if you want to step through your code after reaching the breakpoint.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Keep Part of a SpriteKit Scene from Scrolling</title>
      <link>https://www.meandmark.com/keep-part-of-a-spritekit-scene-from-scrolling/</link>
      <pubDate>Mon, 08 Aug 2016 21:33:43 +0000</pubDate>
      <guid>https://www.meandmark.com/keep-part-of-a-spritekit-scene-from-scrolling/</guid>
      <description>&lt;p&gt;I covered the basics of scrolling a SpriteKit scene with a camera node in my &lt;a href=&#34;http://meandmark.com/blog/2015/12/scrolling-a-spritekit-scene-with-skcameranode/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Scrolling a SpriteKit Scene with SKCameraNode&lt;/a&gt; article. But I didn’t cover one thing many games need. Many games use part of the screen to display vital information to the player such as score and health. When you scroll the game world, the player’s score shouldn’t scroll off the screen. How do you keep things like the score from scrolling off the screen?&lt;/p&gt;&#xA;&lt;p&gt;The answer is to make the nodes that shouldn’t scroll child nodes of the camera node. You can set a node’s parent in the scene editor. Select the node, go to the attributes inspector, and choose the camera node from the Parent combo box.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/08/SpriteKitSetParent.png&#34; alt=&#34;SpriteKitSetParent&#34; border=&#34;0&#34; width=&#34;259&#34; height=&#34;104&#34; /&gt; &#xA;&lt;p&gt;Access the nodes in your code by calling &lt;code&gt;childNodeWithName&lt;/code&gt; on the camera node.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;scoreLabel = boardCamera.childNodeWithName(&amp;quot;scoreLabel&amp;quot;) as! SKLabelNode&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Accessing a SpriteKit Scene’s View Controller</title>
      <link>https://www.meandmark.com/accessing-a-spritekit-scenes-view-controller/</link>
      <pubDate>Mon, 11 Jul 2016 04:05:17 +0000</pubDate>
      <guid>https://www.meandmark.com/accessing-a-spritekit-scenes-view-controller/</guid>
      <description>&lt;p&gt;If you’re using Game Center in a SpriteKit game, you present Game Center view controllers to show things like leaderboards and achievements. To present a Game Center view controller, you need to access the SpriteKit scene’s view controller. The good news is accessing the scene’s view controller takes only one line of code. Adding the following line of Swift code in your &lt;code&gt;SKScene&lt;/code&gt; subclass gives you access to the scene’s view controller:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let sceneViewController = self.view?.window?.rootViewController&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Using C&#43;&#43; with Xcode</title>
      <link>https://www.meandmark.com/using-c-with-xcode/</link>
      <pubDate>Tue, 05 Jul 2016 20:08:41 +0000</pubDate>
      <guid>https://www.meandmark.com/using-c-with-xcode/</guid>
      <description>&lt;p&gt;People frequently ask on Mac development forums how to use C++ in Xcode. I have grown tired of answering this question on those forums so I’m going to provide an answer here in the hopes that someone searching on Google will stumble upon this post. Here’s the short answer to the question. Create a command-line tool project in Xcode.&lt;/p&gt;&#xA;&lt;p&gt;If you want detailed step-by-step instructions on how to set up Xcode for learning C++, read my &lt;a href=&#34;http://meandmark.com/blog/2013/11/creating-a-command-line-application-with-xcode/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Creating a Command Line Application with Xcode&lt;/a&gt; article. The article was written for Xcode 5 so the screenshots may look a little different in Xcode 7 and 8, but the concepts still apply.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Authenticating Game Center’s Local Player in a SpriteKit Game in Swift</title>
      <link>https://www.meandmark.com/authenticating-game-centers-local-player-in-a-spritekit-game-in-swift/</link>
      <pubDate>Mon, 06 Jun 2016 19:19:58 +0000</pubDate>
      <guid>https://www.meandmark.com/authenticating-game-centers-local-player-in-a-spritekit-game-in-swift/</guid>
      <description>&lt;p&gt;Authenticating the local player for Game Center in a SpriteKit game requires two steps. The first step is to call the &lt;code&gt;GKLocalPlayer&lt;/code&gt; class method &lt;code&gt;localPlayer&lt;/code&gt;, which gives you access to Game Center’s local player.&lt;/p&gt;&#xA;&lt;p&gt;The second step is to supply a closure for the local player’s &lt;code&gt;authenticateHandler&lt;/code&gt; property. This closure takes two arguments: a view controller and an error. The closure returns &lt;code&gt;Void&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In the closure the first thing to check is whether or not the view controller is nil. If the view controller is not nil, present Game Center’s view controller so the player can login. The next thing to check is if the local player has been authenticated. If the local player has been authenticated, you can start using Game Center. If the player is not authenticated, don’t use Game Center. The following code shows an example of authenticating a local player in a SpriteKit scene in an iOS game using Swift:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func authenticateLocalPlayer() {&#xA;    let localPlayer = GKLocalPlayer.localPlayer()&#xA;    localPlayer.authenticateHandler = {(viewController, error) -&amp;gt; Void in&#xA;        if viewController != nil {&#xA;            // Show the view controller to let the player log in to Game Center.&#xA;            self.view?.window?.rootViewController?.presentViewController&#xA;                (viewController!, animated: true, completion: nil)               &#xA;        }&#xA;        else if localPlayer.authenticated {&#xA;            // You can start using Game Center&#xA;        }&#xA;        else {&#xA;            // Don&#39;t use Game Center&#xA;        }&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For a Mac game you would call the function &lt;code&gt;presentViewControllerAsSheet&lt;/code&gt; instead of &lt;code&gt;presentViewController&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The expression &lt;code&gt;self.view?.window?.rootViewController?&lt;/code&gt; is messy, but that’s what you have to do to access the SpriteKit scene’s view controller. You need to access the scene’s view controller so you can present Game Center’s view controller.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Missing Required Module SwiftShims Error</title>
      <link>https://www.meandmark.com/missing-required-module-swiftshims-problem/</link>
      <pubDate>Fri, 08 Apr 2016 19:20:19 +0000</pubDate>
      <guid>https://www.meandmark.com/missing-required-module-swiftshims-problem/</guid>
      <description>&lt;p&gt;I recently migrated to a new Mac. On the new Mac I’m using an external SSD as the startup disk instead of the internal hard drive. To keep the SSD from filling up with things like photos, music, and iOS apps, I moved my user folder to the internal hard drive.&lt;/p&gt;&#xA;&lt;p&gt;This moving of the user folder away from the startup disk caused problems when I tried to build existing Xcode projects. I would get the following errors:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Missing required module SwiftShims.&#xA;&#xA;PCH was compiled with module cache path OldPath but the path is currently NewPath.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Where &lt;code&gt;OldPath&lt;/code&gt; used my old user folder location and &lt;code&gt;NewPath&lt;/code&gt; used the new location.&lt;/p&gt;&#xA;&lt;p&gt;I first tried to clean the project and rebuild it, but the problem persisted. A &lt;a href=&#34;http://stackoverflow.com/questions/15463179/how-to-fix-pch-error&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;similar question&lt;/a&gt; on Stack Overflow showed many answers. A promising one was to find a SharedPrecompiledHeaders folder and delete it. The problem was I couldn’t find this folder on my computer.&lt;/p&gt;&#xA;&lt;p&gt;The solution for me was to go to my DerivedData folder and delete the ModuleCache folder. I hope this helps someone who has a similar problem.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Saving Game Data with NSCoding in Swift</title>
      <link>https://www.meandmark.com/saving-game-data-with-nscoding-in-swift/</link>
      <pubDate>Wed, 23 Mar 2016 05:10:45 +0000</pubDate>
      <guid>https://www.meandmark.com/saving-game-data-with-nscoding-in-swift/</guid>
      <description>&lt;p&gt;I reached a point in developing &lt;a href=&#34;http://letterminer.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;LetterMiner&lt;/a&gt; where I wanted to save the game when the player quit so they could pick up where they left off. I didn’t find a lot of information online on saving data in SpriteKit games so I’ve decided to share what I’ve learned. I hope it helps other people.&lt;/p&gt;&#xA;&lt;h3 id=&#34;classes&#34; class=&#34;relative group&#34;&gt;Classes &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#classes&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To save data with &lt;code&gt;NSCoding&lt;/code&gt; in Swift, that data must be in Swift classes. Swift structs don’t conform to the &lt;code&gt;NSCoding&lt;/code&gt; protocol. If you want to use Swift structs in your game, create a &lt;code&gt;SaveGame&lt;/code&gt; class with properties for each piece of data you want to save and do all your data reading and writing in that class.&lt;/p&gt;&#xA;&lt;p&gt;The following example shows a simple &lt;code&gt;Player&lt;/code&gt; class that conforms to the &lt;code&gt;NSCoding&lt;/code&gt; protocol:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;class Player: NSObject, NSCoding {&#xA;    var name = &amp;quot;Player 1&amp;quot;&#xA;    var score = 0&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You noticed my &lt;code&gt;Player&lt;/code&gt; class also inherits from &lt;code&gt;NSObject&lt;/code&gt;. &lt;code&gt;NSObject&lt;/code&gt; is the base class for the Cocoa and Cocoa Touch frameworks. If you have a class that is going to work with Apple’s frameworks, it’s usually good to inherit from &lt;code&gt;NSObject&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;writing-data&#34; class=&#34;relative group&#34;&gt;Writing Data &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#writing-data&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To write data the class must implement the method &lt;code&gt;encodeWithCoder&lt;/code&gt;. Call the &lt;code&gt;NSCoder&lt;/code&gt; method &lt;code&gt;encodeObject&lt;/code&gt; to save a piece of data. The following code shows an example of writing data for the &lt;code&gt;Player&lt;/code&gt; class:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func encodeWithCoder(coder: NSCoder) {&#xA;    coder.encodeObject(name, forKey: &amp;quot;name&amp;quot;)&#xA;    coder.encodeObject(score, forKey: &amp;quot;score&amp;quot;)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Swift 3 Code&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func encode(with coder: NSCoder) {&#xA;    coder.encode(name, forKey: &amp;quot;name&amp;quot;)&#xA;    coder.encode(score, forKey: &amp;quot;score&amp;quot;)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Make sure you remember the key you use when writing the data. You must use the same key to read the data.&lt;/p&gt;&#xA;&lt;p&gt;I’ve kept the example simple with one string property and one integer property. You can also write structs, classes, and arrays with the &lt;code&gt;encodeObject&lt;/code&gt; method. &lt;code&gt;NSCoder&lt;/code&gt; also has methods to write primitive data types like integers and floating-point numbers. What I like about &lt;code&gt;encodeObject&lt;/code&gt; is it works on any data type.&lt;/p&gt;&#xA;&lt;h3 id=&#34;reading-data&#34; class=&#34;relative group&#34;&gt;Reading Data &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#reading-data&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To read data the class must implement the &lt;code&gt;initWithCoder&lt;/code&gt; method. Call the &lt;code&gt;NSCoder&lt;/code&gt; method &lt;code&gt;decodeObjectForKey&lt;/code&gt; to read the data. The following code shows an example of reading data for the &lt;code&gt;Player&lt;/code&gt; class:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;required convenience init(coder decoder: NSCoder) {&#xA;    self.init()&#xA;    name = decoder.decodeObjectForKey(&amp;quot;name&amp;quot;) as! String&#xA;    score = decoder.decodeObjectForKey(&amp;quot;score&amp;quot;) as! Int&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Swift 3 Code&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;required convenience init(coder decoder: NSCoder) {&#xA;    self.init()&#xA;    name = decoder.decodeObject(forKey: &amp;quot;name&amp;quot;) as! String&#xA;    score = decoder.decodeInteger(forKey: &amp;quot;score&amp;quot;)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;In Swift the &lt;code&gt;initWithCoder&lt;/code&gt; method is an &lt;code&gt;init&lt;/code&gt; method that takes a coder as an argument.&lt;/p&gt;&#xA;&lt;h3 id=&#34;saving-data-to-a-file&#34; class=&#34;relative group&#34;&gt;Saving Data to a File &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#saving-data-to-a-file&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Saving the data to a file requires the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create an instance of &lt;code&gt;NSMutableData&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Create an instance of &lt;code&gt;NSKeyedArchiver&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Call the &lt;code&gt;NSKeyedArchiver&lt;/code&gt; method &lt;code&gt;encodeObject&lt;/code&gt; to save each piece of data you want to save.&lt;/li&gt;&#xA;&lt;li&gt;Call the &lt;code&gt;NSKeyedArchiver&lt;/code&gt; method &lt;code&gt;finishEncoding&lt;/code&gt; when you’re finished.&lt;/li&gt;&#xA;&lt;li&gt;Call the &lt;code&gt;NSMutableData&lt;/code&gt; method &lt;code&gt;writeToURL&lt;/code&gt; to save the data to a file.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The following code shows an example of saving a game:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var player: Player&#xA;&#xA;func saveGame(notification: NSNotification) {&#xA;    let saveData = NSMutableData()&#xA;    let archiver = NSKeyedArchiver(forWritingWithMutableData: saveData)&#xA;&#xA;    archiver.encodeObject(player.name, forKey: &amp;quot;name&amp;quot;)&#xA;    archiver.encodeObject(player.score, forKey: &amp;quot;score&amp;quot;)&#xA;    archiver.finishEncoding()&#xA;&#xA;    let saveLocation = saveFileLocation()&#xA;    _ = saveData.writeToURL(saveLocation, atomically: true)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Swift 3 Code&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func saveGame(notification: NSNotification) {&#xA;    let saveData = NSMutableData()&#xA;    let archiver = NSKeyedArchiver(forWritingWith: saveData)&#xA;&#xA;    archiver.encode(player.name, forKey: &amp;quot;name&amp;quot;)&#xA;    archiver.encode(player.score, forKey: &amp;quot;score&amp;quot;)&#xA;    archiver.finishEncoding()&#xA;&#xA;    let saveLocation = saveFileLocation()&#xA;    _ = saveData.write(to: saveLocation, atomically: true)&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Your &lt;code&gt;saveGame&lt;/code&gt; method doesn’t have to take a &lt;code&gt;notification&lt;/code&gt; argument. I use the argument because I want my game to save when the player quits the game. The following code lets you register for the notification when the player quits a Mac game:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;NSNotificationCenter.defaultCenter().addObserver(self, selector:&amp;quot;saveGame:&amp;quot;, &#xA;    name:NSApplicationWillTerminateNotification, object:nil)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Swift 3 Code&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;NotificationCenter.default.addObserver(self, &#xA;    selector:#selector(GameScene.saveGame(_:)), &#xA;    name:NSNotification.Name.NSApplicationWillTerminateNotification, object:nil)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The Swift 3 code assumes the &lt;code&gt;saveGame&lt;/code&gt; method is in a &lt;code&gt;GameScene&lt;/code&gt; class. If your &lt;code&gt;saveGame&lt;/code&gt; method is in another class, substitute the name of that class.&lt;/p&gt;&#xA;&lt;p&gt;For an iOS game the notification to register for is &lt;code&gt;UIApplicationDidEnterBackgroundNotification&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Notice the colon at the end of the &lt;code&gt;saveGame:&lt;/code&gt; selector. Don’t forget to add the colon, or you’ll spend a lot of time figuring out why the notification never fires.&lt;/p&gt;&#xA;&lt;p&gt;I will talk about the &lt;code&gt;saveLocation&lt;/code&gt; variable later in the article.&lt;/p&gt;&#xA;&lt;h3 id=&#34;loading-data-from-a-file&#34; class=&#34;relative group&#34;&gt;Loading Data from a File &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#loading-data-from-a-file&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Loading data from a file requires the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create an instance of &lt;code&gt;NSData&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Create an instance of &lt;code&gt;NSKeyedUnarchiver&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Call the &lt;code&gt;NSKeyedUnarchiver&lt;/code&gt; method &lt;code&gt;decodeObjectForKey&lt;/code&gt; to load each piece of data.&lt;/li&gt;&#xA;&lt;li&gt;Call the &lt;code&gt;NSKeyedUnarchiver&lt;/code&gt; method &lt;code&gt;finishDecoding&lt;/code&gt; when you’re finished.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The following example shows an example of loading a saved game:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var player = Player()&#xA;&#xA;func loadGame() {&#xA;    let saveLocation = saveFileLocation()&#xA;    if let saveData = NSData(contentsOfURL: saveLocation) {&#xA;        let unarchiver = NSKeyedUnarchiver(forReadingWithData: saveData)&#xA;        player.name = unarchiver.decodeObjectForKey(&amp;quot;name&amp;quot;) as! String&#xA;        player.score = unarchiver.decodeObjectForKey(&amp;quot;score&amp;quot;) as! Int&#xA;        unarchiver.finishDecoding()&#xA;    }        &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Swift 3 Code&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func loadGame() {&#xA;    let saveLocation = saveFileLocation()&#xA;    if let saveData = try? Data(contentsOf: saveLocation) {&#xA;        let unarchiver = NSKeyedUnarchiver(forReadingWith: saveData)&#xA;        player.name = unarchiver.decodeObject(forKey: &amp;quot;name&amp;quot;) as! String&#xA;        player.score = unarchiver.decodeInteger(forKey: &amp;quot;score&amp;quot;)&#xA;        unarchiver.finishDecoding()&#xA;    }        &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;where-to-save-the-game&#34; class=&#34;relative group&#34;&gt;Where to Save the Game &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#where-to-save-the-game&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Mac games should place saved game files in the Application Support folder. You will have to create a folder with the name of your game in the Application Support folder and place the saved game files in the folder you create. You can also place iOS saved games files in the Application Support folder, but you can place them in the Documents folder if you want.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;NSFileManager&lt;/code&gt; class has methods to find and create directories. Call the &lt;code&gt;URLForDirectory&lt;/code&gt; method to find the Application Support folder. The following code finds the user’s Application Support directory:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;do {&#xA;    let gameSaveDirectory = try fileManager.URLForDirectory(&#xA;        .ApplicationSupportDirectory, inDomain: .UserDomainMask, &#xA;        appropriateForURL: nil, create: true)&#xA;} catch {&#xA;    // Handle any errors here&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Swift 3 Code&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;do {&#xA;    let gameSaveDirectory = try fileManager.url(&#xA;        for: .ApplicationSupportDirectory, in: .UserDomainMask, &#xA;        appropriateFor: nil, create: true)&#xA;} catch {&#xA;    // Handle any errors here&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;URLForDirectory&lt;/code&gt; function throws an error in Swift 2. That’s why the code has to be wrapped in a &lt;code&gt;do&lt;/code&gt; block.&lt;/p&gt;&#xA;&lt;p&gt;At this point you have access to the Application Support directory. The first time you save you must create a directory for your game inside the Application Support folder. Call the &lt;code&gt;createDirectoryAtURL&lt;/code&gt; method to create a directory.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let myGamePath = gameSaveDirectory.URLByAppendingPathComponent(&amp;quot;MyGame&amp;quot;)&#xA;do {&#xA;    // Create a directory to save games the first time we save.&#xA;    try fileManager.createDirectoryAtURL(myGamePath, &#xA;        withIntermediateDirectories: true, attributes: nil)&#xA;} catch {&#xA;    // Handle any errors here     &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Swift 3 Code&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let myGamePath = gameSaveDirectory.appendingPathComponent(&amp;quot;MyGame&amp;quot;)&#xA;do {&#xA;    // Create a directory to save games the first time we save.&#xA;    try fileManager.createDirectory(at: myGamePath, &#xA;        withIntermediateDirectories: true, attributes: nil)    &#xA;&#xA;} catch {&#xA;    // Handle any errors here     &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now you’re in your game’s Application Support folder. The final step is to create a file name for the saved game. The &lt;code&gt;NSURL&lt;/code&gt; method &lt;code&gt;URLByAppendingPathComponent&lt;/code&gt; lets you add the file name to the path you’ve built.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let savePath = myGamePath.URLByAppendingPathComponent(&amp;quot;MySavedGame.savegame&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;&lt;strong&gt;Swift 3 Code&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;let savePath = myGamePath.appendingPathComponent(&amp;quot;MySavedGame.savegame&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now you have a URL you can use to save games and load saved games. In my &lt;code&gt;saveGame&lt;/code&gt; and &lt;code&gt;loadGame&lt;/code&gt; functions I referred to a &lt;code&gt;saveLocation&lt;/code&gt; variable that was the result of calling a function called &lt;code&gt;saveFileLocation&lt;/code&gt;. The &lt;code&gt;savePath&lt;/code&gt; variable is what &lt;code&gt;saveFileLocation&lt;/code&gt; returns.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Time Profiler Instrument</title>
      <link>https://www.meandmark.com/time-profiler-instrument/</link>
      <pubDate>Wed, 17 Feb 2016 22:36:50 +0000</pubDate>
      <guid>https://www.meandmark.com/time-profiler-instrument/</guid>
      <description>&lt;p&gt;In this article I cover the Time Profiler instrument and how to find slow spots in your code with it.&lt;/p&gt;&#xA;&lt;p&gt;I’m using the version of Instruments that ships with Xcode 7. If you are using an earlier version of Xcode, some things may look different and some features may be unavailable. If you are new to Instruments, read my &lt;a href=&#34;http://meandmark.com/blog/2016/02/getting-started-with-instruments/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Getting Started with Instruments&lt;/a&gt; article.&lt;/p&gt;&#xA;&lt;h3 id=&#34;profiling-your-application&#34; class=&#34;relative group&#34;&gt;Profiling Your Application &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#profiling-your-application&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Take the following steps to profile your application with the Time Profiler instrument:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Choose Product &amp;gt; Profile in Xcode to profile your project.&lt;/li&gt;&#xA;&lt;li&gt;A window with a list of templates opens in Instruments.&lt;/li&gt;&#xA;&lt;li&gt;Select the Time Profiler template from the list.&lt;/li&gt;&#xA;&lt;li&gt;Click the Choose button.&lt;/li&gt;&#xA;&lt;li&gt;Click the Record button to start profiling.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;examining-the-results&#34; class=&#34;relative group&#34;&gt;Examining the Results &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#examining-the-results&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you pause profiling the Time Profiler instrument shows the call tree view in the detail view. The call tree view helps to find the slow spots in your code. Going to the display settings and selecting the Invert Call Tree and Hide System Libraries checkboxes makes finding your code in the call tree view easier. The following screenshot shows a typical call tree view when inverting the call tree:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/TimeProfilerCallTree.png&#34; alt=&#34;TimeProfilerCallTree&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;204&#34; /&gt; &#xA;&lt;p&gt;For each function in the call tree view, Instruments tells you the running time in milliseconds and the percentage of running time. The Time Profiler instrument works by recording the call stack every millisecond. The Running Time column shows you the amount of time the function was in the call stack along with the percentage of time the function was in the call stack.&lt;/p&gt;&#xA;&lt;p&gt;The Self column tells you the number of milliseconds the function is at the top of the call stack. When a function is at the top of the call stack, the application was in that function when Instruments recorded the sample. If a function has a high value in the Self column, that function is a prime candidate for optimization.&lt;/p&gt;&#xA;&lt;p&gt;If you look at the screenshot of the call tree view, you’ll notice every function has a value of 0.0 in the Self column. What’s the slowest function in the list? The slowest code path is the second listing, the function &lt;code&gt;Wordlist.load() -&amp;gt; ()&lt;/code&gt;. When you invert the call tree, Instruments shows code paths, sorting them by running time from slowest to fastest.&lt;/p&gt;&#xA;&lt;p&gt;What about the &lt;code&gt;main&lt;/code&gt; listing? It has the highest running time, but the &lt;code&gt;main&lt;/code&gt; function is the starting point of most Mac and iOS applications. It’s going to be on the call stack the whole time your application runs. In most Mac and iOS applications the &lt;code&gt;main&lt;/code&gt; function has little code in it, usually a call to &lt;code&gt;NSApplicationMain&lt;/code&gt; or &lt;code&gt;UIApplicationMain&lt;/code&gt;. There’s not going to be any code for you to optimize in &lt;code&gt;main&lt;/code&gt; so don’t worry about what its listing in the call tree view says.&lt;/p&gt;&#xA;&lt;h3 id=&#34;showing-alternate-graph-data&#34; class=&#34;relative group&#34;&gt;Showing Alternate Graph Data &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#showing-alternate-graph-data&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Initially the Time Profiler graph shows CPU usage. If you move the mouse cursor over the graph timeline, a tooltip pops up that shows the percentage of the CPU used at that moment. The Time Profiler instrument has two other pieces of graph data you can see. You can change the data in the graph using the set of three buttons next to the Add button in the toolbar.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/TimeProfilerGraphSelectionButtons.png&#34; alt=&#34;TimeProfilerGraphSelectionButtons&#34; border=&#34;0&#34; width=&#34;155&#34; height=&#34;45&#34; /&gt; &#xA;&lt;p&gt;Clicking the left button shows the CPU usage for each CPU core.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/TimeProfilerCPUCoreGraph.png&#34; alt=&#34;TimeProfilerCPUCoreGraph&#34; border=&#34;0&#34; width=&#34;598&#34; height=&#34;158&#34; /&gt; &#xA;&lt;p&gt;If you move the mouse cursor over the graph timeline, tooltips pop up showing the percentage of each CPU core being used along with the total CPU usage. The CPU core view lets you see how well your application uses each CPU core. If one CPU core has a high usage percentage and the other cores have a low percentage, that’s a sign of a possible performance problem.&lt;/p&gt;&#xA;&lt;p&gt;Clicking the right button shows the thread data.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/TimeProfilerThreadGraph.png&#34; alt=&#34;TimeProfilerThreadGraph&#34; border=&#34;0&#34; width=&#34;598&#34; height=&#34;158&#34; /&gt; &#xA;&lt;p&gt;The thread data graph has blue dots. Each blue dot represents a sample the Time Profiler instrument took during the trace. Clicking a blue dot opens a popover that shows the call stack for that particular sample.&lt;/p&gt;&#xA;&lt;p&gt;In the screenshots of the CPU core data and thread data, Instruments shows all the cores and threads. If you want to focus on one CPU core or one thread, click the appropriate button above the graph and choose the CPU core or thread you want to see.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/TimeProfilerCPUCoreAndThreadSelector.png&#34; alt=&#34;TimeProfilerCPUCoreAndThreadSelector&#34; border=&#34;0&#34; width=&#34;214&#34; height=&#34;30&#34; /&gt; &#xA;&lt;h3 id=&#34;comparing-call-trees&#34; class=&#34;relative group&#34;&gt;Comparing Call Trees &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#comparing-call-trees&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you profile your application with the Time Profiler instrument multiple times, you can compare the call trees by choosing Instrument &amp;gt; Compare Call Trees. The following screenshot shows what the call tree view looks like when comparing two call trees:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/TimeProfilerCompareCallTrees.png&#34; alt=&#34;TimeProfilerCompareCallTrees&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;325&#34; /&gt; &#xA;&lt;p&gt;Instead of showing the total running time, Instruments shows the difference in running time between the two runs along with a percentage of the difference. Functions with a higher running time have the percentage colored red, and functions with a lower running time have the percentage colored green. The difference in running time is from the perspective of the most recent run.&lt;/p&gt;&#xA;&lt;p&gt;Above the call tree statistics are two menus. The left menu is initially set to Diff, which means Instruments shows the differences between the two call trees. You can also choose Merge, which merges the two call trees in one listing. The right menu lets you choose an Instruments run to compare. You’ll need at least three runs to use the right menu.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Apple removed the Compare Call Trees feature in Xcode 9. The Compare Call Trees menu item is disabled in Xcode 9 and is removed in Xcode 10.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Allocations Instrument: Generations</title>
      <link>https://www.meandmark.com/allocations-instrument-generations/</link>
      <pubDate>Tue, 16 Feb 2016 20:33:48 +0000</pubDate>
      <guid>https://www.meandmark.com/allocations-instrument-generations/</guid>
      <description>&lt;p&gt;I couldn’t cover everything about Instruments in my &lt;a href=&#34;http://meandmark.com/blog/2016/02/getting-started-with-instruments/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Getting Started with Instruments&lt;/a&gt; article. Having gotten the basics out of the way, I can now write shorter, more focused articles on Instruments. This is the first of those articles, showing how to measure heap memory growth using the Allocations instrument.&lt;/p&gt;&#xA;&lt;h3 id=&#34;measuring-heap-memory-growth&#34; class=&#34;relative group&#34;&gt;Measuring Heap Memory Growth &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#measuring-heap-memory-growth&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Measuring heap memory growth with Instruments entails the following high-level steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Start recording with the Allocations instrument.&lt;/li&gt;&#xA;&lt;li&gt;Pause recording.&lt;/li&gt;&#xA;&lt;li&gt;Take a snapshot.&lt;/li&gt;&#xA;&lt;li&gt;Resume recording.&lt;/li&gt;&#xA;&lt;li&gt;Perform the activity in your application whose memory usage you want to measure.&lt;/li&gt;&#xA;&lt;li&gt;Go to Step 2.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Translating these steps to Instruments is mostly straightforward. Click the Record button to start recording. Click the Pause button to pause and resume recording. The only step that could be tough is figuring out how to take a snapshot. To take a snapshot, click the Mark Generation button, which is in the Display Settings section.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/MarkGenerationButton.png&#34; alt=&#34;MarkGenerationButton&#34; border=&#34;0&#34; width=&#34;258&#34; height=&#34;130&#34; /&gt; &#xA;&lt;p&gt;When you click the Mark Generation button, the detail view switches to the Generations section. The Generations section has a listing for each snapshot you’ve taken. When you take a snapshot, Instruments gives it a generic name like Generation A. You can give a snapshot a more meaningful name by selecting it and pressing the Return key.&lt;/p&gt;&#xA;&lt;h3 id=&#34;examining-the-results&#34; class=&#34;relative group&#34;&gt;Examining the Results &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#examining-the-results&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The detail view shows the following information for each snapshot:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A timestamp of when you took the snapshot.&lt;/li&gt;&#xA;&lt;li&gt;Growth, which is the amount of memory allocated since the previous snapshot. For the first snapshot, the previous snapshot is when you started recording.&lt;/li&gt;&#xA;&lt;li&gt;# Persistent, which is the number of memory allocations since the previous snapshot.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The Growth column is the most important column. It tells you the amount of heap growth.&lt;/p&gt;&#xA;&lt;h4 id=&#34;showing-the-call-tree&#34; class=&#34;relative group&#34;&gt;Showing the Call Tree &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#showing-the-call-tree&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;If you move the mouse cursor over the name of a snapshot, a small button with an arrow facing right appears. Clicking that button shows the call tree of memory allocations that occurred during the snapshot period. Use the call tree view to find the areas of your code that allocated the memory.&lt;/p&gt;&#xA;&lt;h4 id=&#34;showing-memory-categories&#34; class=&#34;relative group&#34;&gt;Showing Memory Categories &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#showing-memory-categories&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Next to each snapshot is a disclosure triangle. Clicking the disclosure triangle shows the memory categories in that snapshot. Instruments shows the number of memory allocations and amount of allocated memory for each category.&lt;/p&gt;&#xA;&lt;p&gt;Most memory categories are the names of Apple’s classes and data structures. The prefixes &lt;code&gt;CF&lt;/code&gt;, &lt;code&gt;NS&lt;/code&gt;, and &lt;code&gt;UI&lt;/code&gt; indicate Apple data structures. Virtual memory allocations have the category &lt;code&gt;VM:&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Each memory category has a disclosure triangle next to it. Clicking the disclosure triangle shows each memory allocation in that category. You can see the size of each memory allocation. If you open the extended detail view, you can see the call stack for each memory allocation.&lt;/p&gt;&#xA;&lt;h4 id=&#34;accessing-more-data-on-a-memory-category8217s-allocations&#34; class=&#34;relative group&#34;&gt;Accessing More Data on a Memory Category’s Allocations &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#accessing-more-data-on-a-memory-category8217s-allocations&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Moving the mouse cursor over a memory category makes the small right arrow button appear. Clicking that button shows the following information for each memory allocation in that category:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The memory address.&lt;/li&gt;&#xA;&lt;li&gt;The category, which will be identical for each listing.&lt;/li&gt;&#xA;&lt;li&gt;The timestamp.&lt;/li&gt;&#xA;&lt;li&gt;Live. If there’s a dot in this column, this memory allocation has not been freed, meaning the memory allocation is still alive.&lt;/li&gt;&#xA;&lt;li&gt;The size of the allocation.&lt;/li&gt;&#xA;&lt;li&gt;The library that made the allocation. For memory allocations your application directly makes, the name of your application will be in the Responsible Library column.&lt;/li&gt;&#xA;&lt;li&gt;The function that made the allocation.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;showing-reference-count-histories&#34; class=&#34;relative group&#34;&gt;Showing Reference Count Histories &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#showing-reference-count-histories&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Moving the mouse cursor over a memory address makes the small right arrow button appear. Clicking that button shows the reference count history for that memory address.&lt;/p&gt;&#xA;&lt;h4 id=&#34;one-final-note&#34; class=&#34;relative group&#34;&gt;One Final Note &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#one-final-note&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;What I talked about in the previous two sections doesn’t just apply to the Generations section. If you click in the jump bar and choose Statistics, you can also use the techniques I described in the previous two sections. Click the small right arrow button next to a memory category to get information on every memory allocation in the given category. Click the small right arrow button next to a memory address to examine its reference count history.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Instruments: Locating dSYM Files</title>
      <link>https://www.meandmark.com/instruments-locating-dsym-files/</link>
      <pubDate>Mon, 15 Feb 2016 05:20:59 +0000</pubDate>
      <guid>https://www.meandmark.com/instruments-locating-dsym-files/</guid>
      <description>&lt;p&gt;A dSYM file contains your project’s debugging symbols. If you profile your project in Instruments and see memory addresses instead of function names in the call tree view, the problem may be Instruments not finding your project’s dSYM file.&lt;/p&gt;&#xA;&lt;p&gt;Choose Instrument &amp;gt; Call Tree Data Mining &amp;gt; Locate dSYM to find a dSYM file. An Open panel opens for you to locate your project’s dSYM file.&lt;/p&gt;&#xA;&lt;p&gt;Where is your project’s dSYM file? It’s usually located in the same directory as the application bundle of the release version of your project. Debug builds normally do not have dSYM files. The debugging symbols are inside the application’s executable code. Refer to my &lt;a href=&#34;http://meandmark.com/blog/2015/08/changing-xcodes-build-location/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Changing Xcode’s Build Location&lt;/a&gt; article if you need help finding your project’s application bundle.&lt;/p&gt;&#xA;&lt;h3 id=&#34;xcode-9-update&#34; class=&#34;relative group&#34;&gt;Xcode 9 Update &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#xcode-9-update&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;In Xcode 9 choose File &amp;gt; Symbols to locate the dSYM file. More detailed information can be found in the following article:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://meandmark.com/blog/2017/12/xcode-9-locating-dsym-files-in-instruments/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 9: Locating dSYM Files in Instruments&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Getting Started with Instruments</title>
      <link>https://www.meandmark.com/getting-started-with-instruments/</link>
      <pubDate>Mon, 08 Feb 2016 05:27:21 +0000</pubDate>
      <guid>https://www.meandmark.com/getting-started-with-instruments/</guid>
      <description>&lt;p&gt;Instruments is a performance measurement tool that ships with Xcode. Instruments is a powerful tool, but it can feel intimidating to use. In this article I’ll introduce you to Instruments and show you how to check for memory leaks and measure your application’s memory usage.&lt;/p&gt;&#xA;&lt;p&gt;Remember that Instruments is a complex application. Don’t get discouraged if you don’t understand everything about Instruments after reading this article. It may take reading this article multiple times and using Instruments for a while for everything to sink in.&lt;/p&gt;&#xA;&lt;p&gt;I’m using Xcode 7 in this article. If you’re running an earlier version of Xcode, what you see on your screen may not match my screenshots.&lt;/p&gt;&#xA;&lt;h3 id=&#34;before-you-profile&#34; class=&#34;relative group&#34;&gt;Before You Profile &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#before-you-profile&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Before profiling your application with Instruments, make sure the Generate Debug Symbols build setting is set to Yes in Xcode. If your project does not generate debug symbols, you will see memory addresses in Instruments instead of the names of your application’s functions. To access your project’s build settings,&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select your project from the project navigator on the left side of the project window to open the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Click the Build Settings button at the top of the project editor.&lt;/li&gt;&#xA;&lt;li&gt;The Generate Debug Symbols build setting is in the LLVM Code Generation collection. You can also type &lt;code&gt;Generate Debug Symbols&lt;/code&gt; in the project editor’s search field.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/GenerateDebugSymbols.png&#34; alt=&#34;GenerateDebugSymbols&#34; border=&#34;0&#34; width=&#34;543&#34; height=&#34;133&#34; /&gt; &#xA;&lt;p&gt;If you are profiling an iOS application on an iOS device, connect the device to your Mac.&lt;/p&gt;&#xA;&lt;h3 id=&#34;launching-instruments&#34; class=&#34;relative group&#34;&gt;Launching Instruments &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#launching-instruments&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;In Xcode choose Product &amp;gt; Profile to build your project and profile it in Instruments. When Instruments launches a window opens to choose a profiling template. If you want to follow along with me, choose the Leaks template and click the Choose button. The Leaks template checks your application for memory leaks and measures the application’s memory usage.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/InstrumentsChooseTemplate.png&#34; alt=&#34;InstrumentsChooseTemplate&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;348&#34; /&gt; &#xA;&lt;h3 id=&#34;the-trace-document-window&#34; class=&#34;relative group&#34;&gt;The Trace Document Window &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#the-trace-document-window&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you click the Choose button, an empty trace document window opens.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/InstrumentsTraceDocumentWindow.png&#34; alt=&#34;InstrumentsTraceDocumentWindow&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;430&#34; /&gt; &#xA;&lt;p&gt;Running from top to bottom, the main areas of the trace document window are the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Toolbar&lt;/li&gt;&#xA;&lt;li&gt;Instrument list&lt;/li&gt;&#xA;&lt;li&gt;Jump bar&lt;/li&gt;&#xA;&lt;li&gt;Detail view&lt;/li&gt;&#xA;&lt;li&gt;Configuration section&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For this article the only toolbar items you need to worry about are the buttons to start/stop recording and pause recording on the left side of the toolbar. The toolbar also has controls to choose an application to profile, add an instrument to the trace, and show/hide different parts of the trace document window.&lt;/p&gt;&#xA;&lt;p&gt;The instrument list shows the instruments being used in the trace along with a graph. There’s no graph in the screenshot because I didn’t start recording, but when recording starts, the graph will appear.&lt;/p&gt;&#xA;&lt;p&gt;The jump bar allows you to choose what to show in the detail view. The detail view shows the profiling statistics.&lt;/p&gt;&#xA;&lt;p&gt;The configuration section is to the right of the detail view. It has three sections: record settings, display settings, and extended detail view. The record settings let you configure what the instrument records. The display settings let you configure what the instrument shows in the graph and detail view. What you can configure depends on the instrument. As an example the Leaks instrument has an option to gather the leaked memory so you can see its contents. The extended detail view shows the call stack for most instruments.&lt;/p&gt;&#xA;&lt;h3 id=&#34;profiling-your-application&#34; class=&#34;relative group&#34;&gt;Profiling Your Application &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#profiling-your-application&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now it’s time to start profiling the application. Click the Record button on the left side of the toolbar. Your application will launch. Use your application. When you are finished, you can either click the Pause button or the Stop button.&lt;/p&gt;&#xA;&lt;p&gt;If you want to save what you profiled so you can look at it later, choose File &amp;gt; Save.&lt;/p&gt;&#xA;&lt;h3 id=&#34;reading-the-profiling-data&#34; class=&#34;relative group&#34;&gt;Reading the Profiling Data &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#reading-the-profiling-data&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Once you start recording Instruments fills the detail view with data and creates a graph for each instrument. In this section I want to focus on the graph. If you move the mouse cursor over the timeline above the graphs, Instruments shows a tooltip with a piece of data about the graph, which you can see in the following screenshot:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/InstrumentsGraphTooltip.png&#34; alt=&#34;InstrumentsGraphTooltip&#34; border=&#34;0&#34; width=&#34;116&#34; height=&#34;94&#34; /&gt; &#xA;&lt;p&gt;The tooltip text isn’t real clear in the screenshot, but it says the application is using 13.23 MB of memory and has 94 new memory leaks.&lt;/p&gt;&#xA;&lt;p&gt;You can focus on a specific time interval in the graph by setting an inspection range. Click inside an instrument’s graph and drag to create the inspection range. The inspection range is shaded blue in the following screenshot:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/InstrumentsInspectionRangesXcode7.png&#34; alt=&#34;InstrumentsInspectionRangesXcode7&#34; border=&#34;0&#34; width=&#34;501&#34; height=&#34;94&#34; /&gt; &#xA;&lt;p&gt;When you set an inspection range, the statistics in the detail view change to reflect the time interval in the inspection range. Clicking in the graph outside of the inspection range you set clears the inspection range.&lt;/p&gt;&#xA;&lt;h3 id=&#34;allocations-instrument-results&#34; class=&#34;relative group&#34;&gt;Allocations Instrument Results &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#allocations-instrument-results&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now it’s time to look at data for specific instruments. Let’s start with the Allocations instrument. If you select the Allocations instrument from the instrument list, the detail view shows a summary of the memory allocation data. The most important data is at the top.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/AllocationsInstrumentSummary.png&#34; alt=&#34;AllocationsInstrumentSummary&#34; border=&#34;0&#34; width=&#34;594&#34; height=&#34;48&#34; /&gt; &#xA;&lt;p&gt;To determine how much memory your application is currently using, look at the Persistent Bytes column for the category All Heap Allocations. In the screenshot I’m using 4.71 MB of memory, which is good for a Mac or iOS application. The Allocations instrument does not record OpenGL/ES texture memory. If your application allocates texture memory, your actual memory use will be higher than what Instruments reports.&lt;/p&gt;&#xA;&lt;p&gt;The Allocations instrument has the following columns of data for each memory category:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;# Persistent, which is the number of memory allocations that haven’t been freed yet.&lt;/li&gt;&#xA;&lt;li&gt;Persistent Bytes, which is the amount of allocated memory that hasn’t been freed yet.&lt;/li&gt;&#xA;&lt;li&gt;# Transient, which is the total number of memory allocations that have been freed.&lt;/li&gt;&#xA;&lt;li&gt;Total Bytes, which is the total amount of allocated memory, including freed memory.&lt;/li&gt;&#xA;&lt;li&gt;# Total, which is the total number of memory allocations, including freed memory. The # Total column should equal the sum of the # Persistent and # Transient columns.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Suppose your application makes 20 memory allocations of 1000 bytes and frees the memory for 15 of the allocations. The Allocations instrument would report the following information:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;# Persistent: 5&#xA;Persistent Bytes: 5,000&#xA;# Transient: 15&#xA;Total Bytes: 20,000&#xA;# Total: 20&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;allocations-instrument-call-tree&#34; class=&#34;relative group&#34;&gt;Allocations Instrument Call Tree &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#allocations-instrument-call-tree&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If your application allocates a high amount of memory, the first thing you’ll want to know is where your code is making the big memory allocations. To find where you’re allocating memory, switch to the call tree view. In the jump bar, click on Statistics and choose Call Trees to switch to the call tree view.&lt;/p&gt;&#xA;&lt;p&gt;When you switch to the call tree view, you should configure Instruments to make finding your code easier in the call tree view. Click the middle button at the top of the configuration section to show the display settings. Select the Invert Call Tree and Hide System Libraries checkboxes. Inverting the call tree brings the memory allocating functions to the top. Hiding the system libraries hides Apple’s code, leaving your code in the call tree view.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/InstrumentsCallTreeCheckboxes.png&#34; alt=&#34;InstrumentsCallTreeCheckboxes&#34; border=&#34;0&#34; width=&#34;263&#34; height=&#34;392&#34; /&gt; &#xA;&lt;p&gt;After selecting the checkboxes, the call tree view should show your code. For code you wrote, the icon next to the function name will be a white image of a person on a black background.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/AllocationsInstrumentCallTree.png&#34; alt=&#34;AllocationsInstrumentCallTree&#34; border=&#34;0&#34; width=&#34;598&#34; height=&#34;162&#34; /&gt; &#xA;&lt;p&gt;Option-clicking a disclosure triangle next to a function in the call tree view expands its subtree so you don’t have to be constantly clicking disclosure triangles. Option-clicking again on the expanded disclosure triangle contracts the subtree.&lt;/p&gt;&#xA;&lt;p&gt;For each function in the call tree, the Allocations instrument shows the bytes used and the allocation count. The bytes used is represented both as an amount and a percentage of the total memory allocated. The statistics may be hard to read in the screenshot, but the following is the listing for the second line in the call tree:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;922.92 KB   5.7%    6173&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This line says this particular function and any functions in its subtree allocated 922.92 KB of memory, which is 5.7% of the total allocated memory. This function and any functions in its subtree made 6173 allocations. The subtrees keep Instruments from telling you the exact amount of memory each function allocates. Inverting the call tree reduces the subtree, which makes the listing for a function in an inverted call tree the closest approximation to the amount of memory that function is allocating. If you set an inspection range in the graph, the listing reflects the amount of memory allocated in the inspection range’s time interval.&lt;/p&gt;&#xA;&lt;p&gt;For most Mac and iOS applications, the first listing in the call tree view is the &lt;code&gt;main&lt;/code&gt; function. This function is going to have a high amount of bytes used and allocations. If you don’t invert the call tree, the &lt;code&gt;main&lt;/code&gt; function will show 100% bytes used. That’s because &lt;code&gt;main&lt;/code&gt; is the starting point of your application. Every function in your application will have &lt;code&gt;main&lt;/code&gt; in its call stack so every memory allocation your application makes will have &lt;code&gt;main&lt;/code&gt; in its call stack.&lt;/p&gt;&#xA;&lt;p&gt;When trying to figure out where your application allocates memory, don’t worry about the &lt;code&gt;main&lt;/code&gt; listing. The &lt;code&gt;main&lt;/code&gt; function doesn’t do much in most Mac and iOS applications. There isn’t much you can do in the &lt;code&gt;main&lt;/code&gt; function to reduce your application’s memory usage.&lt;/p&gt;&#xA;&lt;p&gt;Double-clicking a function in the call tree view shows the source view. For the Allocations instrument, the source view shows you the lines of code that allocated the memory along with the percentage of memory allocated. The percentage is relative to the function. If a line of code says 80%, it means that line of code allocated 80% of the memory the function allocated.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/InstrumentsSourceView.png&#34; alt=&#34;InstrumentsSourceView&#34; border=&#34;0&#34; width=&#34;596&#34; height=&#34;137&#34; /&gt; &#xA;&lt;h3 id=&#34;leaks-instrument-results&#34; class=&#34;relative group&#34;&gt;Leaks Instrument Results &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#leaks-instrument-results&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now it’s time to look at the Leaks instrument. The graph will tell you if you have any memory leaks in your application. A memory leak occurs when your application allocates memory and never frees the memory. The following screenshot shows an example of the graph for the Leaks instrument:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/LeaksInstrumentGraph.png&#34; alt=&#34;LeaksInstrumentGraph&#34; border=&#34;0&#34; width=&#34;600&#34; height=&#34;35&#34; /&gt; &#xA;&lt;p&gt;The screenshot shows three checks for memory leaks. In the first check Instruments found new memory leaks so it marks the graph with a red mark with an X in it. In the next two checks, Instruments did not find any new leaks so it marks the graph with a gray mark with a dash in it. If Instruments finds no memory leaks in your application, it marks the graph with a green checkmark.&lt;/p&gt;&#xA;&lt;h3 id=&#34;leaks-instrument-call-tree&#34; class=&#34;relative group&#34;&gt;Leaks Instrument Call Tree &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#leaks-instrument-call-tree&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If Instruments finds memory leaks in your application, the next step is to find where the leaks are occurring in your code. The steps to do this are the same as for the Allocations instrument: switch to the call tree view by using the jump bar and select the Invert Call Tree and Hide System Libraries checkboxes. Selecting the checkboxes will limit the call tree listing to functions you wrote.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2016/02/LeaksInstrumentCallTree.png&#34; alt=&#34;LeaksInstrumentCallTree&#34; border=&#34;0&#34; width=&#34;496&#34; height=&#34;105&#34; /&gt; &#xA;&lt;p&gt;For each function in the call tree listing, Instruments shows the bytes used and the number of leaks. Like the Allocations instrument, the bytes used is represented both as an amount and a percentage, but in the Leaks instrument the percentage represents the percentage of total leaked memory. The statistics may be hard to read in the screenshot, but each function listing has the same data, which you can see below.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;3.56 KB     100%    94&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The listing says there are 94 memory leaks totaling 3.56 KB of memory. The 94 leaks represent 100% of the leaked memory. In my trace the leaked memory is being allocated in one place, the function at the top of the call tree listing. Double-clicking that function shows the lines of code that allocated the leaked memory. Keep in mind that the leaked memory is allocated in one place only in my trace example. Your application may leak memory in multiple places. Double-click any functions in your call tree view to see where the leaked memory is allocated.&lt;/p&gt;&#xA;&lt;p&gt;The fact that a function allocates leaked memory doesn’t necessarily mean that function is responsible for leaking the memory. But it’s a good place to start looking for the source of the leak.&lt;/p&gt;&#xA;&lt;h3 id=&#34;summary&#34; class=&#34;relative group&#34;&gt;Summary &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#summary&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I want to summarize the most important points to take away from this article. These points apply to most instruments, not just the Leaks and Allocations instruments.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Choose Product &amp;gt; Profile in Xcode to profile your application.&lt;/li&gt;&#xA;&lt;li&gt;Use the call tree view to find problem areas in your code.&lt;/li&gt;&#xA;&lt;li&gt;Select the Invert Call Tree and Hide System Libraries checkboxes to find your code in the call tree view.&lt;/li&gt;&#xA;&lt;li&gt;Option-click the disclosure triangles in the call tree view to minimize the amount of clicking you have to do.&lt;/li&gt;&#xA;&lt;li&gt;Double-click a function in the call tree view to see statistics on specific lines of code.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 7: Profiling Unit Tests in Instruments</title>
      <link>https://www.meandmark.com/xcode-7-profiling-unit-tests-in-instruments/</link>
      <pubDate>Tue, 26 Jan 2016 20:48:13 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-7-profiling-unit-tests-in-instruments/</guid>
      <description>&lt;p&gt;I learned about this tip from an Apple engineer on Apple’s developer forums and felt like sharing it here. Xcode 7 lets you profile unit tests in Instruments, using the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Open the test navigator.&lt;/li&gt;&#xA;&lt;li&gt;Right-click on a test or a group of tests in the test navigator.&lt;/li&gt;&#xA;&lt;li&gt;Choose Profile “testMethod”, where testMethod is the name of the unit test or group of tests.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;At this point Instruments will launch. You’ll be able to choose an instrument and profile tests the same way you profile applications in Instruments.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Scrolling a SpriteKit Scene with SKCameraNode</title>
      <link>https://www.meandmark.com/scrolling-a-spritekit-scene-with-skcameranode/</link>
      <pubDate>Wed, 09 Dec 2015 21:10:12 +0000</pubDate>
      <guid>https://www.meandmark.com/scrolling-a-spritekit-scene-with-skcameranode/</guid>
      <description>&lt;p&gt;Apple added the &lt;code&gt;SKCameraNode&lt;/code&gt; class to SpriteKit in iOS 9 and OS X 10.11 to make it easier to scroll and zoom in SpriteKit scenes. This article shows what I’ve learned about scrolling SpriteKit scenes. This article assumes you have created a SpriteKit Xcode project and a scene for the project. This article focuses on iOS, but most of it should apply to Mac games. The main difference is you would substitute mouse dragged events for touches.&lt;/p&gt;&#xA;&lt;p&gt;What you need to do to scroll a SpriteKit scene can be divided into two areas: tasks to perform in the scene file, the &lt;code&gt;.sks&lt;/code&gt; file, and the the coding tasks. In the scene file you must perform the following tasks:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Add a camera to the scene.&lt;/li&gt;&#xA;&lt;li&gt;Name the camera so you can access it in your code.&lt;/li&gt;&#xA;&lt;li&gt;Align the camera with the scene.&lt;/li&gt;&#xA;&lt;li&gt;Make the camera you created the scene’s camera.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The coding tasks you must perform are the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Add a variable for the camera so you can move the camera to scroll the scene.&lt;/li&gt;&#xA;&lt;li&gt;Add event handling code to scroll the scene.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;scene-file-tasks&#34; class=&#34;relative group&#34;&gt;Scene File Tasks &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#scene-file-tasks&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Select the &lt;code&gt;.sks&lt;/code&gt; file in the project navigator to open the scene editor. Find the camera object in the object library.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/12/SpriteKitObjectLibrary.png&#34; alt=&#34;SpriteKitObjectLibrary&#34; border=&#34;0&#34; width=&#34;258&#34; height=&#34;152&#34; /&gt; &#xA;&lt;p&gt;Drag the camera object to the scene to add the camera to the scene.&lt;/p&gt;&#xA;&lt;p&gt;After adding the camera object to the scene, select it so you can name the camera. Go to the attributes inspector and enter a name in the Name text field.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/12/CameraAttributesInspector.png&#34; alt=&#34;CameraAttributesInspector&#34; border=&#34;0&#34; width=&#34;260&#34; height=&#34;173&#34; /&gt; &#xA;&lt;p&gt;Remember the name you gave the camera. You’ll need to know the name when you access the camera in your game code.&lt;/p&gt;&#xA;&lt;p&gt;Now it’s time to align the camera with the scene. Xcode’s scene editor is normally zoomed in too much to see the viewports for the camera and the scene. Use the zoom controls at the bottom of the scene editor to zoom out, click the minus button. You should see a yellow-orange rectangle around the scene and a second rectangle around the camera. These rectangles show the viewports. Select the camera and drag it so its rectangle is on top of the scene’s rectangle so it looks like one rectangle in the scene.&lt;/p&gt;&#xA;&lt;p&gt;Finally you can tell the scene to use the camera you created as the scene’s camera. Select the scene from the jump bar at the top of the scene editor. Choose your camera from the Camera menu in the scene’s attributes inspector.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/12/SceneAttributesInspector.png&#34; alt=&#34;SceneAttributesInspector&#34; border=&#34;0&#34; width=&#34;243&#34; height=&#34;192&#34; /&gt; &#xA;&lt;h3 id=&#34;coding-tasks&#34; class=&#34;relative group&#34;&gt;Coding Tasks &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#coding-tasks&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The first coding task is to add a variable to represent the camera so you can adjust its position when scrolling the scene. The most common place to add this variable is in your &lt;code&gt;GameScene&lt;/code&gt; class. Here’s a Swift example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;var boardCamera = SKCameraNode()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;To access the camera you created in the scene editor, call the scene class’s &lt;code&gt;childNodeWithName&lt;/code&gt; method, supplying the name you gave the camera in the scene editor.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;boardCamera = self.childNodeWithName(&amp;quot;boardCamera&amp;quot;) as! SKCameraNode&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Make sure the name you supply to &lt;code&gt;childNodeWithName&lt;/code&gt; matches the name in the scene editor. An exception will be raised if the names don’t match, and you won’t be able to play your game.&lt;/p&gt;&#xA;&lt;p&gt;You could combine the two lines of code into a single &lt;code&gt;let&lt;/code&gt; statement if you want. I find it difficult to use &lt;code&gt;let&lt;/code&gt; statements for class data members in Swift, which is why I used a &lt;code&gt;var&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h4 id=&#34;scrolling&#34; class=&#34;relative group&#34;&gt;Scrolling &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#scrolling&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;The last task is to scroll the scene based on player input. You must perform the following tasks for iOS:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Find the location of the current touch by calling the &lt;code&gt;UITouch&lt;/code&gt; method &lt;code&gt;locationInNode&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Find the location of the previous touch by calling the &lt;code&gt;UITouch&lt;/code&gt; method &lt;code&gt;previousLocationInNode&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Subtract the previous touch location from the current touch location to determine how far the player dragged.&lt;/li&gt;&#xA;&lt;li&gt;Move the camera by adjusting its position based on the drag distance.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The following code demonstrates scrolling the scene vertically by dragging a finger over the scene:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;override func touchesMoved(touches: Set&amp;lt;UITouch&amp;gt;, withEvent event: UIEvent?) {&#xA;    for touch in touches {&#xA;        let location = touch.locationInNode(self)&#xA;        let previousLocation = touch.previousLocationInNode(self)&#xA;        let deltaY = location.y - previousLocation.y&#xA;        boardCamera.position.y += deltaY&#xA;    }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;If you want to scroll horizontally, calculate &lt;code&gt;deltaX&lt;/code&gt; and use it to adjust the camera’s &lt;code&gt;x&lt;/code&gt; position.&lt;/p&gt;&#xA;&lt;h4 id=&#34;needed-enhancements&#34; class=&#34;relative group&#34;&gt;Needed Enhancements &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#needed-enhancements&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;If you add the &lt;code&gt;touchesMoved&lt;/code&gt; function from the previous section to your game, you’ll notice one big problem. You will be able to scroll the scene, but there’s nothing stopping the player from scrolling past the scene boundaries.&lt;/p&gt;&#xA;&lt;p&gt;What you need to add are variables representing the minimum and maximum values the camera should have for its &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; positions. I can’t tell you what the minimum and maximum values should be because they depend on the size of your scene and the screen size of the device. You’re going to have to experiment and see what minimum and maximum camera values work for your game.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>NSTextView not Scrolling Vertically</title>
      <link>https://www.meandmark.com/nstextview-not-scrolling-vertically/</link>
      <pubDate>Fri, 06 Nov 2015 20:14:51 +0000</pubDate>
      <guid>https://www.meandmark.com/nstextview-not-scrolling-vertically/</guid>
      <description>&lt;p&gt;I had a problem with a text view that would not scroll vertically. The fix was to select the text view in Interface Builder and use the size inspector to make the text view resizable vertically.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/11/ResizeTextView.png&#34; alt=&#34;ResizeTextView&#34; border=&#34;0&#34; width=&#34;249&#34; height=&#34;173&#34; /&gt;</description>
    </item>
    <item>
      <title>Xcode 7: You Can Install Your Apps on an iOS Device for Free</title>
      <link>https://www.meandmark.com/xcode-7-you-can-install-your-apps-on-an-ios-device-for-free/</link>
      <pubDate>Thu, 05 Nov 2015 19:35:02 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-7-you-can-install-your-apps-on-an-ios-device-for-free/</guid>
      <description>&lt;p&gt;A common complaint from people interested in iOS development was having to pay the $99 annual fee to Apple just to put an app they created on their own iOS device. These people should install Xcode 7.&lt;/p&gt;&#xA;&lt;p&gt;Starting with Xcode 7, iOS developers can install their apps on their iOS devices without paying the $99 annual fee. If you want your app on the App Store, you still have to join Apple’s developer program and pay the $99 annual fee. But you can test your apps on an iOS device for free, which is good news for people starting iOS development.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 7: No More Snapshots</title>
      <link>https://www.meandmark.com/xcode-7-no-more-snapshots/</link>
      <pubDate>Mon, 26 Oct 2015 04:58:44 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-7-no-more-snapshots/</guid>
      <description>&lt;p&gt;You can no longer take snapshots of your projects in Xcode 7. Use version control to track changes in your projects.&lt;/p&gt;&#xA;&lt;p&gt;The easiest way to start with version control is to create a new Xcode project. When you are asked where to save the project, there is a checkbox to create a local git repository.&lt;/p&gt;&#xA;&lt;p&gt;If you have an existing project you want to place under version control, start by launching the Terminal application. Navigate to your project’s directory. Run the &lt;code&gt;git init&lt;/code&gt; command to create a git repository for your project and place it under version control.&lt;/p&gt;&#xA;&lt;p&gt;If you need more information on using version control with Xcode, read the version control chapter of &lt;em&gt;Xcode Tools Sensei&lt;/em&gt;, which you can find a link to by reading my post &lt;a href=&#34;http://meandmark.com/blog/2013/09/xcode-5-version-control-changes/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 5: Version Control Changes&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Checking API Availability in Swift 2</title>
      <link>https://www.meandmark.com/checking-api-availability-in-swift-2/</link>
      <pubDate>Mon, 12 Oct 2015 18:20:50 +0000</pubDate>
      <guid>https://www.meandmark.com/checking-api-availability-in-swift-2/</guid>
      <description>&lt;p&gt;When developing Mac and iOS applications, the recommended approach to support older operating systems is to use the most recent SDK and set the deployment target to the earliest operating system your application supports. Until recently the problem with this approach is there was no way to tell at compile time if your code used anything that is not available on older operating systems. You had to run your application on older operating systems to make sure you weren’t using any unavailable technologies, classes, or functions.&lt;/p&gt;&#xA;&lt;p&gt;Life got much easier for Swift developers with the releases of Swift 2 and Xcode 7. Swift 2 provides the &lt;code&gt;#available&lt;/code&gt; and &lt;code&gt;@available&lt;/code&gt; keywords that emit compiler errors if you use an API unsafely.&lt;/p&gt;&#xA;&lt;h3 id=&#34;available&#34; class=&#34;relative group&#34;&gt;#available &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#available&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The &lt;code&gt;#available&lt;/code&gt; keyword works with &lt;code&gt;if&lt;/code&gt; and &lt;code&gt;guard&lt;/code&gt; statements. Supply an operating system version version, and the code inside the &lt;code&gt;if&lt;/code&gt; or &lt;code&gt;guard&lt;/code&gt; block executes only on machines capable of running the code. Suppose you have a Mac application that supports OS X 10.9 to 10.11. You have some code that uses something introduced in OS X 10.11. The code would look something like the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;if #available(OSX 10.11, *) {&#xA;    // Make API call that was introduced in OS X 10.11.&#xA;}&#xA;else {&#xA;    // Code to run on OS X 10.9 and 10.10.&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The asterisk as the second argument to &lt;code&gt;#available&lt;/code&gt; tells the compiler to require the minimum deployment target for other platforms.&lt;/p&gt;&#xA;&lt;p&gt;Things work similarly for iOS. The following code shows how to support an iOS 9 feature while also supporting older iOS versions:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;if #available(iOS 9.0, *) {&#xA;    // Make API call that was introduced in iOS 9.&#xA;}&#xA;else {&#xA;    // Code to run on earlier iOS versions.&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Using &lt;code&gt;#available&lt;/code&gt; with a &lt;code&gt;guard&lt;/code&gt; statement works best with code intended only for newer operating system versions. You can bail out and do nothing on older operating systems. The following is an example for OS X:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;guard #available(OSX 10.11, *) else { return }&#xA;    // Make API call that was introduced in OS X 10.11&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And for iOS:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;guard #available(iOS 9.0, *) else { return }&#xA;    // Make API call that was introduced in iOS 9.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;available-1&#34; class=&#34;relative group&#34;&gt;@available &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#available-1&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The &lt;code&gt;@available&lt;/code&gt; keyword lets you mark a function, method, or class as being available only on certain operating system versions. You supply the same information as &lt;code&gt;#available&lt;/code&gt;: an operating system version and an asterisk. The following code shows how to use &lt;code&gt;@available&lt;/code&gt; in a function:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@available(iOS 8.0, *)&#xA;func myFunctionThatUsesiOS8() {&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;And now a class example:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@available(OSX 10.10, *)&#xA;class MyClass {&#xA;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Mac Storyboard Show Segues Involve Window Controllers</title>
      <link>https://www.meandmark.com/mac-storyboard-show-segues-involve-window-controllers/</link>
      <pubDate>Mon, 12 Oct 2015 02:28:49 +0000</pubDate>
      <guid>https://www.meandmark.com/mac-storyboard-show-segues-involve-window-controllers/</guid>
      <description>&lt;p&gt;I struggled with how to pass data between view controllers in a Mac storyboard show segue so I’m detailing how I solved the problem here. I hope it helps others who have a similar problem.&lt;/p&gt;&#xA;&lt;p&gt;Short version: a show segue involves window controllers, not view controllers. Implement &lt;code&gt;prepareForSegue&lt;/code&gt; in a &lt;code&gt;NSWindowController&lt;/code&gt; subclass.&lt;/p&gt;&#xA;&lt;h3 id=&#34;background&#34; class=&#34;relative group&#34;&gt;Background &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#background&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I’m writing a document-based application that generates PDF files. I want to preview the document’s PDF inside the application. In the storyboard I create a window controller and a view controller for the preview window. In the document window’s toolbar I have a Preview item. I create a segue to show the preview window when the Preview item is clicked. From a user interface perspective, everything works. I click the Preview item in the toolbar, and the preview window opens.&lt;/p&gt;&#xA;&lt;p&gt;The next step is to get the preview window to show a PDF file. In my &lt;code&gt;NSDocument&lt;/code&gt; subclass I have a &lt;code&gt;preview&lt;/code&gt; method that creates a PDF file and returns a URL for that PDF file. In the &lt;code&gt;NSViewController&lt;/code&gt; subclass for the preview window’s view controller, I have a method that accepts a URL as an argument, creates a &lt;code&gt;PDFDocument&lt;/code&gt; object using the supplied URL, and tells the PDF view to use that &lt;code&gt;PDFDocument&lt;/code&gt; object.&lt;/p&gt;&#xA;&lt;p&gt;How do I pass the URL containing the PDF file from my &lt;code&gt;NSDocument&lt;/code&gt; subclass to the preview window’s view controller? Implement &lt;code&gt;prepareForSegue&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-problem&#34; class=&#34;relative group&#34;&gt;The Problem &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#the-problem&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I ran into problems figuring out where to implement &lt;code&gt;prepareForSegue&lt;/code&gt;. My first attempt was to implement it in the preview window’s view controller. The problem was that &lt;code&gt;prepareForSegue&lt;/code&gt; was not being called. I set a breakpoint inside &lt;code&gt;prepareForSegue&lt;/code&gt;, and the breakpoint was never reached.&lt;/p&gt;&#xA;&lt;p&gt;I asked about this on Apple’s developer forums, and someone suggested I implement &lt;code&gt;prepareForSegue&lt;/code&gt; in the document window’s view controller. It was an excellent suggestion, but &lt;code&gt;prepareForSegue&lt;/code&gt; was still not being called. What’s the problem?&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-solution&#34; class=&#34;relative group&#34;&gt;The Solution &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#the-solution&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;After much struggle I learned that the source and destination controllers for a show segue are window controllers, not view controllers. The solution was to create a &lt;code&gt;NSWindowController&lt;/code&gt; subclass for the document window and implement &lt;code&gt;prepareForSegue&lt;/code&gt; there. It worked. &lt;code&gt;prepareForSegue&lt;/code&gt; was being called.&lt;/p&gt;&#xA;&lt;p&gt;In my implementation of &lt;code&gt;prepareForSegue&lt;/code&gt;, I used the &lt;code&gt;contentViewController&lt;/code&gt; property of &lt;code&gt;NSWindowController&lt;/code&gt; to access the document view controller so I could access the document, call its &lt;code&gt;preview&lt;/code&gt; method, and get the URL for the PDF file. I used the segue’s &lt;code&gt;destinationController&lt;/code&gt; property to access the preview window’s window controller. I used the &lt;code&gt;contentViewController&lt;/code&gt; property a second time to access the preview window’s view controller so I could pass the PDF’s URL to it.&lt;/p&gt;&#xA;&lt;h3 id=&#34;before-you-comment&#34; class=&#34;relative group&#34;&gt;Before You Comment &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#before-you-comment&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I have not worked with iOS storyboards. If you ask me a question about them in a comment, I will not reply because I have no answer for you.&lt;/p&gt;&#xA;&lt;p&gt;I am no expert on Mac storyboards. I will do my best to answer any questions about them, but there’s a decent chance the only answer I can provide is “I don’t know”.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating an Xcode Project to Work with GitHub or Bitbucket</title>
      <link>https://www.meandmark.com/creating-an-xcode-project-to-work-with-github-or-bitbucket/</link>
      <pubDate>Wed, 30 Sep 2015 18:48:41 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-an-xcode-project-to-work-with-github-or-bitbucket/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;http://github.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;GitHub&lt;/a&gt; and &lt;a href=&#34;http://bitbucket.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Bitbucket&lt;/a&gt; are two of the most popular sites for storing git repositories online. In this article you’ll learn how to create an Xcode project and have it hosted on GitHub or Bitbucket.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;It may sound obvious, but you must first sign up for an account on GitHub or Bitbucket.&lt;/p&gt;&#xA;&lt;p&gt;Hosting an Xcode project on GitHub or Bitbucket sounds difficult, but it’s really not. Perform the following steps to host a new Xcode project on GitHub or Bitbucket:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Create a new Xcode project by choosing File &amp;gt; New &amp;gt; Project in Xcode.&lt;/li&gt;&#xA;&lt;li&gt;When choosing a location to save the project, select the Create git repository checkbox to create a local git repository for your project on your Mac.&lt;/li&gt;&#xA;&lt;li&gt;Login to GitHub or Bitbucket.&lt;/li&gt;&#xA;&lt;li&gt;Create a new repository.&lt;/li&gt;&#xA;&lt;li&gt;When you create a new repository, GitHub and Bitbucket provide instructions on how to push an existing repository to your newly created repository. This involves running two git commands: &lt;code&gt;git remote add&lt;/code&gt; and &lt;code&gt;git push&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Launch the Terminal application on your Mac.&lt;/li&gt;&#xA;&lt;li&gt;Navigate to your Xcode project’s directory.&lt;/li&gt;&#xA;&lt;li&gt;Run the two git commands. You can copy and paste them from GitHub or Bitbucket.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The &lt;code&gt;git remote add&lt;/code&gt; command makes your newly created GitHub or Bitbucket repository a remote branch of the local repository on your Mac. The &lt;code&gt;git push&lt;/code&gt; command pushes the files under version control from your local repository to the remote repository hosted on GitHub or Bitbucket.&lt;/p&gt;&#xA;&lt;p&gt;Now you can push changes to GitHub or Bitbucket from Xcode by choosing Source Control &amp;gt; Push.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 7: Compare Instruments Call Trees</title>
      <link>https://www.meandmark.com/xcode-7-compare-instruments-call-trees/</link>
      <pubDate>Mon, 28 Sep 2015 23:27:50 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-7-compare-instruments-call-trees/</guid>
      <description>&lt;p&gt;A new feature of Instruments in Xcode 7 is the ability to compare two call trees in the Time Profiler instrument. This article provides a brief introduction on using this feature. Comparing two call trees is also available in the Counters template (it was disabled for me in every other template), but I’m going to focus on the Time Profiler instrument since it’s the more commonly used instrument.&lt;/p&gt;&#xA;&lt;p&gt;To take advantage of comparing two call trees, you must perform at least two profiling runs of your application so you have two call trees to compare. After performing two runs in Instruments, choose Instrument &amp;gt; Compare Call Trees. The detail view should look similar to the following screenshot:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/09/InstrumentsCompareCallTrees.png&#34; alt=&#34;InstrumentsCompareCallTrees&#34; border=&#34;0&#34; width=&#34;599&#34; height=&#34;466&#34; /&gt; &#xA;&lt;p&gt;Instead of showing the total running time, Instruments shows the difference in running time between the two runs along with a percentage of the difference. Functions with a higher running time have the percentage colored red, and functions with a lower running time have the percentage colored green. The difference in running time is from the perspective of the most recent run.&lt;/p&gt;&#xA;&lt;p&gt;Above the call tree statistics are two menus. The left menu is initially set to Diff, which means Instruments shows the differences between the two call trees. You can also choose Merge, which merges the two call trees in one listing. The right menu lets you choose an Instruments run to compare. You’ll need at least three runs to use the right menu.&lt;/p&gt;&#xA;&lt;h3 id=&#34;update&#34; class=&#34;relative group&#34;&gt;UPDATE &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Apple removed the Compare Call Trees feature in Xcode 9. The Compare Call Trees menu item is disabled in Xcode 9 and is removed in Xcode 10.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 7: Address Sanitizer</title>
      <link>https://www.meandmark.com/xcode-7-address-sanitizer/</link>
      <pubDate>Wed, 23 Sep 2015 20:03:14 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-7-address-sanitizer/</guid>
      <description>&lt;p&gt;Xcode 7 adds Address Sanitizer. Address Sanitizer helps find memory corruption problems, such as buffer overflows and using freed memory.&lt;/p&gt;&#xA;&lt;p&gt;Keep in mind that Address Sanitizer works only with C-based languages: C, C++, and Objective-C. If you are coding in Swift, Address Sanitizer will not help you. Also remember that your application runs slower in Address Sanitizer.&lt;/p&gt;&#xA;&lt;h3 id=&#34;turning-on-address-sanitizer&#34; class=&#34;relative group&#34;&gt;Turning on Address Sanitizer &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#turning-on-address-sanitizer&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Address Sanitizer is turned off initially. Use the scheme editor to turn on Address Sanitizer. Open the scheme editor and select the Run step. Click the Diagnostics button at the top of the scheme editor. Select the Enable Address Sanitizer checkbox.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/09/SchemeAddressSanitizer.png&#34; alt=&#34;SchemeAddressSanitizer&#34; border=&#34;0&#34; width=&#34;600&#34; height=&#34;347&#34; /&gt; &#xA;&lt;p&gt;If the Enable Address Sanitizer checkbox is disabled, deselect the Enable Malloc Scribble, Enable Malloc Guard Edges, and Enable Guard Malloc checkboxes.&lt;/p&gt;&#xA;&lt;p&gt;You can also use Address Sanitizer in your unit tests. Select the Test step, click the Diagnostics button, and select the Enable Address Sanitizer checkbox.&lt;/p&gt;&#xA;&lt;p&gt;Rebuild your project to run it in Address Sanitizer.&lt;/p&gt;&#xA;&lt;h3 id=&#34;using-address-sanitizer&#34; class=&#34;relative group&#34;&gt;Using Address Sanitizer &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#using-address-sanitizer&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;After turning on Address Sanitizer and rebuilding your project, run your application. If your application does something to corrupt memory, Xcode will pause your application and display Address Sanitizer’s output in the debug console. It’s similar to what Xcode’s debugger does when your application raises an exception or crashes. I wish I could provide more information, but I use Swift so I can’t take advantage of Address Sanitizer in my code.&lt;/p&gt;&#xA;&lt;h3 id=&#34;additional-information&#34; class=&#34;relative group&#34;&gt;Additional Information &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#additional-information&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To learn more about Address Sanitizer, watch the 2015 WWDC session &lt;a href=&#34;https://developer.apple.com/videos/wwdc/2015/?id=413&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Advanced Debugging and the Address Sanitizer&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 7: Setting Instruments Inspection Ranges</title>
      <link>https://www.meandmark.com/xcode-7-setting-instruments-inspection-ranges/</link>
      <pubDate>Mon, 21 Sep 2015 04:59:49 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-7-setting-instruments-inspection-ranges/</guid>
      <description>&lt;p&gt;In the version of Instruments that comes with Xcode 7, Apple removed the menu items to set inspection ranges that were in the View menu in Instruments 6. To set an inspection range in Instruments 7, click inside an instrument’s graph and drag.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/09/InstrumentsInspectionRangesXcode7.png&#34; alt=&#34;InstrumentsInspectionRangesXcode7&#34; border=&#34;0&#34; width=&#34;501&#34; height=&#34;94&#34; /&gt; &#xA;&lt;p&gt;In the screenshot the inspection range is highlighted in blue. After setting an inspection range, you can adjust it by dragging the inspection range lines, the two dark vertical lines in the screenshot.&lt;/p&gt;&#xA;&lt;p&gt;Instruments provides two ways to clear an inspection range you set. First, click in an instrument’s graph outside the inspection range. Second, choose View &amp;gt; Clear Inspection Range.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 7: Accessing Targets in the Project Editor</title>
      <link>https://www.meandmark.com/xcode-7-accessing-targets-in-the-project-editor/</link>
      <pubDate>Fri, 18 Sep 2015 17:13:14 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-7-accessing-targets-in-the-project-editor/</guid>
      <description>&lt;p&gt;A change in Xcode’s project editor UI I didn’t see in the Xcode 7 betas that I see in the release version is the target list on the left side of the editor is hidden. How do you show the target list?&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/09/Xcode7BaseiOSSDK.png&#34; alt=&#34;Xcode7BaseiOSSDK&#34; border=&#34;0&#34; width=&#34;576&#34; height=&#34;206&#34; /&gt; &#xA;&lt;p&gt;On the left side of the screenshot below the button with four squares and above the word Basic is the button to show and hide the target list. When the target list is hidden, use the menu next to the Show/Hide button to select a target or the project in the project editor.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 7: Code Coverage</title>
      <link>https://www.meandmark.com/xcode-7-code-coverage/</link>
      <pubDate>Wed, 16 Sep 2015 20:33:12 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-7-code-coverage/</guid>
      <description>&lt;p&gt;One of Xcode 7’s new features is measuring your application’s code coverage when running your unit tests. This article shows how to generate code coverage data and read code coverage statistics.&lt;/p&gt;&#xA;&lt;p&gt;For those of you unfamiliar with code coverage, code coverage measures which lines of your application code execute when the application runs. Before shipping your application, your goal should be to cover as much of your code as you can to make sure there are no problems with the code. The ultimate goal is 100% coverage, but that may be not possible for your project. You can run multiple tests to achieve 100% code coverage as running 100% of your code in a single test run is difficult.&lt;/p&gt;&#xA;&lt;h3 id=&#34;turn-on-code-coverage&#34; class=&#34;relative group&#34;&gt;Turn on Code Coverage &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#turn-on-code-coverage&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Initially code coverage is disabled. To turn on code coverage, open the scheme editor, select the Test step, and select the Gather coverage data checkbox.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/09/SchemeCodeCoverage.png&#34; alt=&#34;SchemeCodeCoverage&#34; border=&#34;0&#34; width=&#34;600&#34; height=&#34;126&#34; /&gt; &#xA;&lt;h3 id=&#34;generate-code-coverage-data&#34; class=&#34;relative group&#34;&gt;Generate Code Coverage Data &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#generate-code-coverage-data&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Choose Product &amp;gt; Test to run your unit tests and generate code coverage data.&lt;/p&gt;&#xA;&lt;p&gt;After running the tests Xcode displays code coverage statistics on the right side of the source code editor for each function in your code.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/09/CodeCoverageCounts.png&#34; alt=&#34;CodeCoverageCounts&#34; border=&#34;0&#34; width=&#34;65&#34; height=&#34;378&#34; /&gt; &#xA;&lt;p&gt;If the function was exercised during the test, Xcode highlights the block in gray and shows the number of times it was exercised. The screenshot shows statistics for three functions. The first function was exercised once, and the third function was exercised three times. If a function was not exercised during the test, Xcode highlights the block in red. The second function in the screenshot was not exercised so Xcode displays a 0 on the right side of the editor.&lt;/p&gt;&#xA;&lt;p&gt;Choose Editor &amp;gt; Hide Code Coverage to hide the code coverage data in the editor. Choose Editor &amp;gt; Show Code Coverage to see the code coverage data.&lt;/p&gt;&#xA;&lt;h3 id=&#34;view-your-project8217s-code-coverage&#34; class=&#34;relative group&#34;&gt;View Your Project’s Code Coverage &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#view-your-project8217s-code-coverage&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Use Xcode’s report navigator to view a report summarizing your project’s code coverage. Open the report navigator by choosing View &amp;gt; Navigators &amp;gt; Show Report Navigator or by clicking the rightmost button at the top of the navigator area. Select your test from the report navigator to view test data in Xcode’s editor. Click the Coverage button at the top of the editor to view a code coverage report.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/09/CodeCoverageReport.png&#34; alt=&#34;CodeCoverageReport&#34; border=&#34;0&#34; width=&#34;600&#34; height=&#34;416&#34; /&gt; &#xA;&lt;p&gt;At the top of the code coverage report is the name of your application and a progress bar showing the percentage of code coverage for the project. The amount of blue in the progress bar represents the percentage of code that was exercised during the test. If you look at the screenshot of the report, you can see the project I tested has low code coverage. About 20% of the application code was exercised during this test.&lt;/p&gt;&#xA;&lt;p&gt;Below the application name is a list of each source code file in your project and a progress bar measuring the percentage of code coverage of that file. In the screenshot of the code coverage report, the first two files have 100% code coverage, and the last six files have no code coverage.&lt;/p&gt;&#xA;&lt;p&gt;Next to each file is a disclosure triangle. Click the disclosure triangle to see each function in the file along with its code coverage percentage.&lt;/p&gt;&#xA;&lt;p&gt;If you select the Show Test Bundles checkbox, Xcode will show code coverage percentages for your unit test classes.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Changing Xcode’s Build Location</title>
      <link>https://www.meandmark.com/changing-xcodes-build-location/</link>
      <pubDate>Mon, 17 Aug 2015 18:00:08 +0000</pubDate>
      <guid>https://www.meandmark.com/changing-xcodes-build-location/</guid>
      <description>&lt;p&gt;I covered this topic in the &lt;a href=&#34;http://meandmark.com/blog/2011/04/xcode-4-finding-the-application-you-built/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 4: Finding the Application You Built&lt;/a&gt; post, but I’ve answered this question twice online this week so I’m writing about it again.&lt;/p&gt;&#xA;&lt;p&gt;When you build a project in Xcode, Xcode places the files it creates, such as your application file, in a derived data folder. This derived data folder is Xcode’s build location. The default location of the derived data folder is the following directory:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;/Users/YourUsername/Library/Developer/Xcode/DerivedData&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Xcode creates a folder for your project inside this folder and places the files it creates during the build in that folder. Keep in mind there are more directories to go through to find your application. If you want to find your application, it’s easier to select your application from the Products folder in the project navigator (It’s on the left side of the project window), right-click, and choose Show in Finder.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/08/XcodeShowInFinder.png&#34; alt=&#34;XcodeShowInFinder&#34; border=&#34;0&#34; width=&#34;415&#34; height=&#34;342&#34; /&gt; &#xA;&lt;p&gt;Why does Xcode place the derived data in a central location instead of in a folder inside your project folder? Version control. Version control systems create a repository inside your project folder. The derived data files should not be under version control. Placing your derived data outside the project folder simplifies working with version control.&lt;/p&gt;&#xA;&lt;p&gt;What do you do if you don’t like Xcode’s default derived data location? Change the location. Use Xcode’s Locations preferences to change the derived data location for all future Xcode projects you create.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/08/DerivedDataLocationsPreferences.png&#34; alt=&#34;DerivedDataLocationsPreferences&#34; border=&#34;0&#34; width=&#34;600&#34; height=&#34;166&#34; /&gt; &#xA;&lt;p&gt;The changes you make in Xcode’s Locations preferences do not apply to existing projects. To change the derived data location of a single project, choose File &amp;gt; Project Settings in Xcode.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/08/Xcode6ProjectSettings.png&#34; alt=&#34;Xcode6ProjectSettings&#34; border=&#34;0&#34; width=&#34;600&#34; height=&#34;240&#34; /&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 7: Hiding Code Coverage Data</title>
      <link>https://www.meandmark.com/xcode-7-hiding-code-coverage-data/</link>
      <pubDate>Wed, 15 Jul 2015 04:23:16 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-7-hiding-code-coverage-data/</guid>
      <description>&lt;p&gt;One of Xcode 7’s new features is measuring your project’s code coverage when running unit tests. Go to the scheme editor, select the Test step, and select the Gather coverage data checkbox.&lt;/p&gt;&#xA;&lt;p&gt;After running your unit tests, the Xcode editor will display code coverage data for your source code files. Code that was not exercised will be highlighted in the editor. On the right side of the editor, Xcode displays the number of times each line of code was exercised, an iteration count, when you ran the tests.&lt;/p&gt;&#xA;&lt;p&gt;This code coverage data is nice to see after running unit tests, but the data can be distracting when you go back to writing code. How do you tell Xcode to stop showing the code coverage data in the editor?&lt;/p&gt;&#xA;&lt;p&gt;Use the Editor menu. Choose Editor &amp;gt; Code Coverage &amp;gt; Hide Code Coverage. There is also a menu item in the Code Coverage submenu to hide the iteration counts on the right side of the editor. If you want to see the code coverage data again, choose Editor &amp;gt; Code Coverage &amp;gt; Show Code Coverage.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>NSDocument initWithType in Swift 2</title>
      <link>https://www.meandmark.com/nsdocument-initwithtype-in-swift-2/</link>
      <pubDate>Thu, 09 Jul 2015 18:20:02 +0000</pubDate>
      <guid>https://www.meandmark.com/nsdocument-initwithtype-in-swift-2/</guid>
      <description>&lt;p&gt;I updated my document-based Cocoa application to Swift 2 in Xcode 7 using Xcode’s converter. The converter changed the &lt;code&gt;initWithType&lt;/code&gt; method in my NSDocument subclass to the following:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;convenience init(type typeName: (String!)) {&#xA;    self.init()&#xA;    // Rest of initialization code here&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;After doing the conversion the Swift compiler crashed every time I built the project. I traced the problem to the &lt;code&gt;initWithType&lt;/code&gt; method. I struggled to find a solution as an Internet and Stack Overflow search uncovered no one who had a similar problem. I asked about this on Apple’s paid developer forums, and user LCS provided the solution, which I will share with you.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;convenience init(type typeName: String) throws {&#xA;    self.init()&#xA;    // Rest of initialization code here&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>testable Import</title>
      <link>https://www.meandmark.com/testable-import/</link>
      <pubDate>Tue, 07 Jul 2015 00:12:33 +0000</pubDate>
      <guid>https://www.meandmark.com/testable-import/</guid>
      <description>&lt;p&gt;A new feature added in Xcode 7 to simplify unit testing is the &lt;code&gt;@testable import&lt;/code&gt; statement. Instead of making your application classes members of the unit testing target, which is what you had to do to unit test Swift code in Xcode 6, add the following statement to your unit testing classes:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;@testable import MyApp&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Where &lt;code&gt;MyApp&lt;/code&gt; is the name of your application target.&lt;/p&gt;&#xA;&lt;p&gt;If you get link errors when running your tests, make sure the value of the Product Module Name build setting matches the module name in the &lt;code&gt;@testable import&lt;/code&gt; statement. In my example that would be &lt;code&gt;MyApp&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I was getting link errors in my project because my project name has a space in it so Xcode was using &lt;code&gt;My_App&lt;/code&gt; as the module name in the Product Module Name build setting. &lt;code&gt;My_App&lt;/code&gt; is not the same as &lt;code&gt;MyApp&lt;/code&gt;, causing the link error. Changing the Product Module Name to &lt;code&gt;MyApp&lt;/code&gt; fixed the link error.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 6: Embedding Third-Party Frameworks</title>
      <link>https://www.meandmark.com/xcode-6-embedding-third-party-frameworks/</link>
      <pubDate>Mon, 11 May 2015 18:20:39 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-6-embedding-third-party-frameworks/</guid>
      <description>&lt;p&gt;Xcode 6 simplifies copying third-party frameworks to your application bundle. In previous versions of Xcode you had to add a Copy Files build phase to your application target to copy third-party frameworks and libraries to your application bundle. Xcode 6 adds an Embedded Binaries section to the target editor that you can use to copy binary files, such as frameworks and libraries, to your application bundle.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/05/Embedded-Binaries.png&#34; alt=&#34;Embedded Binaries&#34; border=&#34;0&#34; width=&#34;600&#34; height=&#34;211&#34; /&gt; &#xA;&lt;p&gt;Why would you embed third-party frameworks in your application bundle? You embed third-party frameworks your application relies on so people can use your application without having those frameworks installed on their Mac. For example if you write a game that uses the SDL framework, you should embed the SDL framework in your game so people can play the game without having to manually install the SDL framework on their Mac.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 6: Refactoring Menu Changes</title>
      <link>https://www.meandmark.com/xcode-6-refactoring-menu-changes/</link>
      <pubDate>Thu, 09 Apr 2015 18:20:30 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-6-refactoring-menu-changes/</guid>
      <description>&lt;p&gt;Previous versions of Xcode placed all of the refactoring tools in a Refactor submenu, which you could access by choosing Edit &amp;gt; Refactor. In Xcode 6 Apple split the refactoring tools into two groups. The refactoring tools that apply to an entire project are in the Convert submenu. Choose Edit &amp;gt; Convert to access those tools. The rest of the refactoring tools are in the Refactor submenu.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Connecting Menu Items to IBActions in a Mac Storyboard</title>
      <link>https://www.meandmark.com/connecting-menu-items-to-ibactions-in-a-mac-storyboard/</link>
      <pubDate>Mon, 23 Feb 2015 20:17:16 +0000</pubDate>
      <guid>https://www.meandmark.com/connecting-menu-items-to-ibactions-in-a-mac-storyboard/</guid>
      <description>&lt;p&gt;A common pattern in Mac application development is to create a menu item, create an &lt;code&gt;IBAction&lt;/code&gt; for that item in one of your classes, and connect the menu item to the &lt;code&gt;IBAction&lt;/code&gt;. When the person running your application chooses that menu item, your application performs the &lt;code&gt;IBAction&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;If you’re using storyboards to develop your Mac application, you’re probably placing your &lt;code&gt;IBActions&lt;/code&gt; in your view controllers. When trying to connect a menu item to an &lt;code&gt;IBAction&lt;/code&gt;, your first instinct is to make a connection from the menu item to the view controller containing the &lt;code&gt;IBAction&lt;/code&gt;. But if you make the connection, you’ll see the following HUD:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/02/ActionSegueHUD.png&#34; alt=&#34;ActionSegueHUD&#34; border=&#34;0&#34; width=&#34;90&#34; height=&#34;63&#34; /&gt; &#xA;&lt;p&gt;That’s not what you were expecting to see. How do you connect the menu item so you can wire up your &lt;code&gt;IBAction&lt;/code&gt;? Make the connection from the menu item to the application scene’s First Responder.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2015/02/ApplicationSceneFirstResponder.png&#34; alt=&#34;ApplicationSceneFirstResponder&#34; border=&#34;0&#34; width=&#34;330&#34; height=&#34;229&#34; /&gt; &#xA;&lt;p&gt;When you make the connection to the application scene’s First Responder, the HUD will show a long list of actions instead of segues. Your &lt;code&gt;IBActions&lt;/code&gt; should appear in that list.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Instruments: Why Does the Allocations Instrument Show the Wrong Amount of Memory Usage?</title>
      <link>https://www.meandmark.com/instruments-why-does-the-allocations-instrument-show-the-wrong-amount-of-memory-usage/</link>
      <pubDate>Mon, 26 Jan 2015 18:15:55 +0000</pubDate>
      <guid>https://www.meandmark.com/instruments-why-does-the-allocations-instrument-show-the-wrong-amount-of-memory-usage/</guid>
      <description>&lt;p&gt;I’ve seen this question asked multiple times on Stack Overflow. The person asking the question is using the Allocations instrument to profile the memory usage of an iOS app. The Allocations instrument reports less memory being used than the app is really using. Why isn’t the Allocations instrument reporting the correct amount of memory?&lt;/p&gt;&#xA;&lt;p&gt;The Allocations instrument does not record OpenGL ES texture memory allocations. If your app does anything with images or video, the Allocations instrument will not record the video memory used to store the images or video. The more your app works with images or video, the greater the discrepancy between your app’s actual memory usage and the amount of memory the Allocations instrument says your app is using.&lt;/p&gt;&#xA;&lt;p&gt;How do you get Instruments to report your app’s actual memory usage? The Activity Monitor instrument can be configured to list the amount of physical memory each running app uses. My &lt;a href=&#34;http://meandmark.com/blog/2014/09/xcode-6-instruments-ui-changes/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 6: Instruments UI Changes&lt;/a&gt; post has more information on how to configure an instrument. To dig deeper into your app’s texture memory usage, use the OpenGL ES Analysis instrument.&lt;/p&gt;&#xA;&lt;p&gt;Why use the Allocations instrument? The Allocations instrument can show you the lines of code that are allocating the most memory in your app. If all you care about is the amount of memory your app is using, use the Activity Monitor instrument. When you need more information on your app’s memory usage, use the Allocations instrument.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 6: Setting Instruments Inspection Ranges</title>
      <link>https://www.meandmark.com/xcode-6-setting-instruments-inspection-ranges/</link>
      <pubDate>Wed, 29 Oct 2014 20:16:07 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-6-setting-instruments-inspection-ranges/</guid>
      <description>&lt;p&gt;In Xcode 6 Instruments no longer has toolbar buttons to set inspection ranges. How do you set inspection ranges with Instruments in Xcode 6?&lt;/p&gt;&#xA;&lt;p&gt;Use the View menu. The View menu has items to set the start of an inspection range, set the end of an inspection range, and clear an inspection range.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Sorting a Table View of Core Data Records</title>
      <link>https://www.meandmark.com/sorting-a-table-view-of-core-data-records/</link>
      <pubDate>Wed, 08 Oct 2014 20:54:11 +0000</pubDate>
      <guid>https://www.meandmark.com/sorting-a-table-view-of-core-data-records/</guid>
      <description>&lt;p&gt;In my &lt;a href=&#34;http://meandmark.com/blog/2014/10/binding-a-view-based-table-view-to-a-core-data-entity/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;previous post&lt;/a&gt;, I detailed the steps needed to bind a view-based table view to a Core Data entity. That post is missing one thing: sorting, which I’m going to cover now.&lt;/p&gt;&#xA;&lt;h3 id=&#34;add-an-ordering-attribute-to-the-entity&#34; class=&#34;relative group&#34;&gt;Add an Ordering Attribute to the Entity &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-an-ordering-attribute-to-the-entity&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Core Data does not have built-in support for sorting records. If you want a collection of entities sorted, you must add an attribute to the entity that stores its position in the collection.&lt;/p&gt;&#xA;&lt;h3 id=&#34;write-code-to-create-sort-descriptors&#34; class=&#34;relative group&#34;&gt;Write Code to Create Sort Descriptors &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#write-code-to-create-sort-descriptors&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To sort the table view you first need to bind the array controller’s Sort Descriptors binding. But the array controller needs something to bind to. You must write code to create an array of sort descriptors, &lt;code&gt;NSSortDescriptor&lt;/code&gt;, which you will later bind to the array controller. Supply the name of your entity’s ordering attribute as the sort descriptor’s key. The following code shows how to create the sort descriptors in Swift:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;func chaptersSortDescriptors() -&amp;gt; [NSSortDescriptor!] {&#xA;    return [NSSortDescriptor(key: &amp;quot;order&amp;quot;, ascending: true)]&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;My entity attribute is named &lt;code&gt;order&lt;/code&gt;. Substitute the name of your ordering attribute in your code. You can also use a different method name than &lt;code&gt;chaptersSortDescriptors&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I’m writing a document-based application so I put my sort descriptors method in my &lt;code&gt;NSPersistentDocument&lt;/code&gt; subclass. I have not tried this with a shoebox (non-document-based) application. My best guess is you would place the sort descriptors method in your &lt;code&gt;AppDelegate&lt;/code&gt; file.&lt;/p&gt;&#xA;&lt;h3 id=&#34;bind-the-array-controller8217s-sort-descriptors&#34; class=&#34;relative group&#34;&gt;Bind the Array Controller’s Sort Descriptors &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#bind-the-array-controller8217s-sort-descriptors&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now it’s time to bind the array controller’s Sort Descriptors binding to the method you wrote that creates the array of sort descriptors.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select the array controller from the object list in Interface Builder.&lt;/li&gt;&#xA;&lt;li&gt;Open the bindings inspector.&lt;/li&gt;&#xA;&lt;li&gt;Click the disclosure triangle next to the Sort Descriptors binding.&lt;/li&gt;&#xA;&lt;li&gt;Select the Bind to checkbox.&lt;/li&gt;&#xA;&lt;li&gt;Choose File’s Owner from the menu.&lt;/li&gt;&#xA;&lt;li&gt;In the Model Key Path text field, enter the name of the method you wrote that creates the sort descriptors.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/10/CoreDataArrayControllerSortDescriptorsBinding.png&#34; alt=&#34;CoreDataArrayControllerSortDescriptorsBinding&#34; border=&#34;0&#34; width=&#34;289&#34; height=&#34;232&#34; /&gt; &#xA;&lt;p&gt;For Step 5, I’m not sure if you bind to File’s Owner for a shoebox application. You many need to bind to the application instead of File’s Owner.&lt;/p&gt;&#xA;&lt;h3 id=&#34;bind-the-table-view8217s-sort-descriptors&#34; class=&#34;relative group&#34;&gt;Bind the Table View’s Sort Descriptors &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#bind-the-table-view8217s-sort-descriptors&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The final step is to bind the table view’s Sort Descriptors binding to the array controller’s sort descriptors.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select the table view from the object list in Interface Builder.&lt;/li&gt;&#xA;&lt;li&gt;Open the bindings inspector.&lt;/li&gt;&#xA;&lt;li&gt;Click the disclosure triangle next to the Sort Descriptors binding.&lt;/li&gt;&#xA;&lt;li&gt;Select the Bind to checkbox.&lt;/li&gt;&#xA;&lt;li&gt;Choose the array controller from the menu.&lt;/li&gt;&#xA;&lt;li&gt;In the Controller Key text field, enter &lt;code&gt;sortDescriptors&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/10/CoreDataTableViewSortDescriptorsBinding.png&#34; alt=&#34;CoreDataTableViewSortDescriptorsBinding&#34; border=&#34;0&#34; width=&#34;281&#34; height=&#34;234&#34; /&gt;&#xA;</description>
    </item>
    <item>
      <title>Binding a View-Based Table View to a Core Data Entity</title>
      <link>https://www.meandmark.com/binding-a-view-based-table-view-to-a-core-data-entity/</link>
      <pubDate>Tue, 07 Oct 2014 20:23:28 +0000</pubDate>
      <guid>https://www.meandmark.com/binding-a-view-based-table-view-to-a-core-data-entity/</guid>
      <description>&lt;p&gt;My main reason for writing this post is to have a reference for myself in case I need to bind a view-based table in the future. If this post helps anyone else, that’s a bonus.&lt;/p&gt;&#xA;&lt;h3 id=&#34;set-up-the-array-controller&#34; class=&#34;relative group&#34;&gt;Set up the Array Controller &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#set-up-the-array-controller&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The first step is to create an array controller and configure it to control a Core Data entity.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Add an array controller to the xib file.&lt;/li&gt;&#xA;&lt;li&gt;Select the array controller from the object list and open Interface Builder’s attributes inspector.&lt;/li&gt;&#xA;&lt;li&gt;Choose Entity Name from the Mode menu.&lt;/li&gt;&#xA;&lt;li&gt;Enter your entity name in the Entity Name text field.&lt;/li&gt;&#xA;&lt;li&gt;Select the Prepares Content checkbox.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/10/CoreDataBindingsObjectController.png&#34; alt=&#34;CoreDataBindingsObjectController&#34; border=&#34;0&#34; width=&#34;279&#34; height=&#34;156&#34; /&gt; &#xA;&lt;h3 id=&#34;bind-the-array-controller-to-the-managed-object-context&#34; class=&#34;relative group&#34;&gt;Bind the Array Controller to the Managed Object Context &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#bind-the-array-controller-to-the-managed-object-context&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;After setting up the array controller, you must bind it to your Core Data managed object context.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Open the bindings inspector.&lt;/li&gt;&#xA;&lt;li&gt;Click the disclosure triangle next to the Managed Object Context binding.&lt;/li&gt;&#xA;&lt;li&gt;Select the Bind to checkbox.&lt;/li&gt;&#xA;&lt;li&gt;Choose File’s Owner from the menu.&lt;/li&gt;&#xA;&lt;li&gt;In the Model Key Path text field, enter &lt;code&gt;managedObjectContext&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/10/CoreDataBindingsBindToManagedObjectContext.png&#34; alt=&#34;CoreDataBindingsBindToManagedObjectContext&#34; border=&#34;0&#34; width=&#34;283&#34; height=&#34;215&#34; /&gt; &#xA;&lt;h3 id=&#34;bind-the-table-view&#34; class=&#34;relative group&#34;&gt;Bind the Table View &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#bind-the-table-view&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The table view needs data to display. Bind the table view to the array controller to get the data.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select the table view from the object list.&lt;/li&gt;&#xA;&lt;li&gt;Open the bindings inspector.&lt;/li&gt;&#xA;&lt;li&gt;Click the disclosure triangle next to the Content binding.&lt;/li&gt;&#xA;&lt;li&gt;Select the Bind to checkbox.&lt;/li&gt;&#xA;&lt;li&gt;Choose the array controller from the menu.&lt;/li&gt;&#xA;&lt;li&gt;In the Controller Key text field, enter &lt;code&gt;arrangedObjects&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/10/CoreDataBindingsBindTableView.png&#34; alt=&#34;CoreDataBindingsBindTableView&#34; border=&#34;0&#34; width=&#34;277&#34; height=&#34;212&#34; /&gt; &#xA;&lt;p&gt;If you have problems with the table view selection, use the table column’s Value binding instead of the table view’s Content binding. In the code I’m working on, I have a table view and a text view. Selecting an item from the table view fills the text view with the item’s contents. When I used the table view’s Content binding, the text view’s contents didn’t change when I selected an item in the table view. Using the table column’s Value binding fixed the problem.&lt;/p&gt;&#xA;&lt;h3 id=&#34;bind-the-table-view-cell&#34; class=&#34;relative group&#34;&gt;Bind the Table View Cell &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#bind-the-table-view-cell&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;View-based table views require you to bind the table view cell to display something in the table view.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select the table view cell from the object list. You may find it easier to use the jump bar to locate the table view cell.&lt;/li&gt;&#xA;&lt;li&gt;Open the bindings inspector.&lt;/li&gt;&#xA;&lt;li&gt;Click the disclosure triangle next to the Value binding.&lt;/li&gt;&#xA;&lt;li&gt;Select the Bind to checkbox.&lt;/li&gt;&#xA;&lt;li&gt;Choose Table Cell View from the menu.&lt;/li&gt;&#xA;&lt;li&gt;In the Model Key Path text field, enter &lt;code&gt;objectValue.attribute&lt;/code&gt;, where &lt;code&gt;attribute&lt;/code&gt; is the attribute in your Core Data entity that you want to show in the table view.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/10/CoreDataBindingsBindTableViewCell.png&#34; alt=&#34;CoreDataBindingsBindTableViewCell&#34; border=&#34;0&#34; width=&#34;276&#34; height=&#34;504&#34; /&gt;</description>
    </item>
    <item>
      <title>Xcode 6: No Simulate Document in Interface Builder</title>
      <link>https://www.meandmark.com/xcode-6-no-simulate-document-in-interface-builder/</link>
      <pubDate>Fri, 26 Sep 2014 18:25:57 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-6-no-simulate-document-in-interface-builder/</guid>
      <description>&lt;p&gt;In Xcode 4 and 5 you could test your user interface in Interface Builder by choosing Editor &amp;gt; Simulate Document. Apple removed the Simulate Document menu item in Xcode 6.&lt;/p&gt;&#xA;&lt;p&gt;The workaround is to use the assistant editor. After switching to the assistant editor, click the navigation button in the jump bar, which is to the left of the back and forward buttons. Choose Preview and choose the xib or storyboard file to preview the file in the assistant editor.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/09/Xcode-6-User-Interface-Preview.png&#34; alt=&#34;Xcode 6 User Interface Preview&#34; border=&#34;0&#34; width=&#34;377&#34; height=&#34;235&#34; /&gt; &#xA;&lt;p&gt;I should note that I couldn’t get the preview to show up in the assistant editor. If you have the same problem, I don’t have an answer for you. For more information read the section “Previewing Your Layout for Different Localizations, iOS Devices, and iOS Versions” in Apple’s &lt;em&gt;Interface Builder Help&lt;/em&gt; document, which you can read in Xcode.&lt;/p&gt;&#xA;&lt;h3 id=&#34;update&#34; class=&#34;relative group&#34;&gt;UPDATE &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I figured out how to get the preview to appear. You must open the xib or storyboard file in both assistant editors. Click the navigation button in the second editor (either the bottom or the right editor, depending on how you stack the assistant editors) and choose Preview to get the preview to appear.&lt;/p&gt;&#xA;&lt;p&gt;If you’re using a storyboard for a Mac application, you can preview different parts of your interface by selecting the appropriate controller in the first editor (either the top or the left editor, depending on how you stack the assistant editors). Selecting the Application item in the application scene previews the menu bar. Selecting a window controller previews the window. Selecting a view controller previews the view.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 6: Instruments UI Changes</title>
      <link>https://www.meandmark.com/xcode-6-instruments-ui-changes/</link>
      <pubDate>Tue, 23 Sep 2014 04:09:46 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-6-instruments-ui-changes/</guid>
      <description>&lt;p&gt;Instruments is the developer tool that has the most user interface changes in Xcode 6. This article details the changes I noticed when using the new version of Instruments.&lt;/p&gt;&#xA;&lt;h3 id=&#34;settings-and-configuration&#34; class=&#34;relative group&#34;&gt;Settings and Configuration &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#settings-and-configuration&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The lower right corner of the trace document window contains settings and configuration information.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/09/Instruments-6-Settings.png&#34; alt=&#34;Instruments 6 Settings&#34; border=&#34;0&#34; width=&#34;260&#34; height=&#34;421&#34; /&gt; &#xA;&lt;p&gt;If you look at the screenshot, you will see three buttons at the top. Going from left to right, they are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The Record Settings button, which lets you configure what the instrument records. The screenshot shows the recording options for the Allocations instrument.&lt;/li&gt;&#xA;&lt;li&gt;The Display Settings button, which controls what appears in the detail view. The Call Tree checkboxes and the data mining options are in the Display Settings section.&lt;/li&gt;&#xA;&lt;li&gt;The Extended Detail View button, which shows the extended detail view.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;toolbar-changes&#34; class=&#34;relative group&#34;&gt;Toolbar Changes &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#toolbar-changes&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;On the right side of the toolbar, you should see the following set of buttons:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/09/Instruments-6-Toolbar.png&#34; alt=&#34;Instruments 6 Toolbar&#34; border=&#34;0&#34; width=&#34;139&#34; height=&#34;40&#34; /&gt; &#xA;&lt;p&gt;Click the + button to open the Library, where you can examine all the available instruments. Drag an instrument from the Library to the instrument list to add an instrument to your trace.&lt;/p&gt;&#xA;&lt;p&gt;The group of three buttons works with the Time Profiler instrument and controls what appears in the graph. Clicking the left button shows the CPU strategy, which creates a track pane for each CPU core. The CPU strategy lets you see how well your app uses each core. Clicking the center button shows the Instruments strategy, which looks like every other instrument. Clicking the right button shows the threads strategy, which displays CPU activity for each thread.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Overriding NSDocument’s initWithType Method in Swift</title>
      <link>https://www.meandmark.com/overriding-nsdocuments-initwithtype-method-in-swift/</link>
      <pubDate>Mon, 22 Sep 2014 05:27:19 +0000</pubDate>
      <guid>https://www.meandmark.com/overriding-nsdocuments-initwithtype-method-in-swift/</guid>
      <description>&lt;p&gt;I struggled briefly with overriding NSDocument’s &lt;code&gt;initWithType:&lt;/code&gt; method in Swift so I’m sharing my code. Hopefully this example will help others.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;convenience init(type typeName: String!, error outError: NSErrorPointer) {&#xA;    self.init()&#xA;&#xA;    // Place your initialization code here.&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 6 Is Available</title>
      <link>https://www.meandmark.com/xcode-6-is-available/</link>
      <pubDate>Fri, 19 Sep 2014 19:56:34 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-6-is-available/</guid>
      <description>&lt;p&gt;Xcode 6 is now available to download from the Mac App Store. Be on the lookout for Xcode 6 posts on this blog. They’ll be tagged &lt;strong&gt;xcode 6&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;There will be fewer Xcode 6 posts than Xcode 5 posts. The main reason is Xcode 6 does not have many user interface changes from Xcode 5. Fewer changes means fewer posts explaining what changed and where to find things in Xcode 6. Instruments is the tool that has the most user interface changes.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Multiple Xcode Versions on One Mac</title>
      <link>https://www.meandmark.com/multiple-xcode-versions-on-one-mac/</link>
      <pubDate>Fri, 19 Sep 2014 01:15:15 +0000</pubDate>
      <guid>https://www.meandmark.com/multiple-xcode-versions-on-one-mac/</guid>
      <description>&lt;p&gt;With the recent release of Xcode 6.0, some of you may be wondering if you can have both Xcode 5 and 6 installed on your Mac. The answer is &lt;strong&gt;yes&lt;/strong&gt;. You can have both Xcode 5 and 6 installed on one machine.&lt;/p&gt;&#xA;&lt;p&gt;Before you install a second version of Xcode, you should rename the version of Xcode you have on your Mac. When you install Xcode from the Mac App Store, Apple installs it in your Applications folder and gives it the name &lt;strong&gt;Xcode&lt;/strong&gt;. If you have Xcode 5.1 installed and don’t rename it, the Mac App Store will overwrite your Xcode 5.1 installation with Xcode 6.0. Rename your Xcode 5.1 installation to something like &lt;strong&gt;Xcode 5&lt;/strong&gt; before installing Xcode 6, and you’ll have both versions on your Mac.&lt;/p&gt;&#xA;&lt;h3 id=&#34;note&#34; class=&#34;relative group&#34;&gt;Note &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#note&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;This post applies only to Xcode 4.3 and later. Earlier versions of Xcode used an installer that overwrote any existing versions of Xcode installed on that machine.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Swift: Go Through Array in Reverse Order</title>
      <link>https://www.meandmark.com/swift-go-through-array-in-reverse-order/</link>
      <pubDate>Wed, 23 Jul 2014 19:26:00 +0000</pubDate>
      <guid>https://www.meandmark.com/swift-go-through-array-in-reverse-order/</guid>
      <description>&lt;p&gt;In Swift you would use the following &lt;strong&gt;for&lt;/strong&gt; statement to go through each element in an array when you need to access the current index inside the &lt;strong&gt;for&lt;/strong&gt; loop: &lt;/p&gt;&#xA;&lt;pre&gt;for index in 0..&amp;lt;listItems.count&lt;/pre&gt;&#xA;&lt;p&gt;How do you go through the array in reverse order? Use the &lt;strong&gt;reverse&lt;/strong&gt; keyword.&lt;/p&gt;&#xA;&lt;pre&gt;for index in reverse(0..&amp;lt;listItems.count)&lt;/pre&gt;</description>
    </item>
    <item>
      <title>An Introduction to Swift Unit Testing</title>
      <link>https://www.meandmark.com/an-introduction-to-swift-unit-testing/</link>
      <pubDate>Fri, 18 Jul 2014 00:03:05 +0000</pubDate>
      <guid>https://www.meandmark.com/an-introduction-to-swift-unit-testing/</guid>
      <description>&lt;p&gt;This article shows you how to get started unit testing Swift code in Xcode with XCTest. If you’ve written Objective-C unit tests using XCTest or OCUnit, you should be able to smoothly transition to Swift after reading the article. But Objective-C unit testing experience isn’t required to read this article.&lt;/p&gt;&#xA;&lt;p&gt;Because Xcode 6 is currently in beta, I can’t show any screenshots due to Apple’s non-disclosure agreement. When Xcode 6 is officially released, I may update this article with screenshots.&lt;/p&gt;&#xA;&lt;h3 id=&#34;create-a-unit-test-target&#34; class=&#34;relative group&#34;&gt;Create a Unit Test Target &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-a-unit-test-target&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Your XCode project needs a unit test target in order to run unit tests. The easiest way to create a Swift unit test target is to create a new project. If you create a Cocoa application project or an iOS application project that uses Swift, Xcode includes a unit test target for the project.&lt;/p&gt;&#xA;&lt;p&gt;If you’re converting an existing Objective-C project to Swift, you must manually add a Swift unit test target.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Choose File &amp;gt; New &amp;gt; Target.&lt;/li&gt;&#xA;&lt;li&gt;Select Other under iOS or OS X on the left side of the New Target Assistant.&lt;/li&gt;&#xA;&lt;li&gt;Select Cocoa Testing Bundle from the list of targets.&lt;/li&gt;&#xA;&lt;li&gt;Click the Next button.&lt;/li&gt;&#xA;&lt;li&gt;Enter the name of the target in the Product Name text field.&lt;/li&gt;&#xA;&lt;li&gt;Choose Swift from the Language menu.&lt;/li&gt;&#xA;&lt;li&gt;Click the Finish button.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;add-a-unit-test-class&#34; class=&#34;relative group&#34;&gt;Add a Unit Test Class &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-a-unit-test-class&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When it creates a unit test target, Xcode includes a unit test class. You can get through this article with the class Xcode supplies, but eventually you’ll need to add a unit test class to your project.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Choose File &amp;gt; New &amp;gt; File.&lt;/li&gt;&#xA;&lt;li&gt;Select Source under iOS or OS X on the left side of the New File Assistant.&lt;/li&gt;&#xA;&lt;li&gt;Select Test Case Class from the list of files.&lt;/li&gt;&#xA;&lt;li&gt;Click the Next button.&lt;/li&gt;&#xA;&lt;li&gt;Enter the name of your class in the Class text field.&lt;/li&gt;&#xA;&lt;li&gt;Choose Swift from the Language menu.&lt;/li&gt;&#xA;&lt;li&gt;Click the Next button.&lt;/li&gt;&#xA;&lt;li&gt;Choose a location to save the file.&lt;/li&gt;&#xA;&lt;li&gt;Make sure the class is a member of the unit test target, not the application target.&lt;/li&gt;&#xA;&lt;li&gt;Click the Create button.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;anatomy-of-a-unit-test-class&#34; class=&#34;relative group&#34;&gt;Anatomy of a Unit Test Class &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#anatomy-of-a-unit-test-class&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you create a unit test class, it initially looks similar to the following code:&lt;/p&gt;&#xA;&lt;pre&gt;import Cocoa&#xA;import XCTest&lt;/pre&gt;&#xA;&lt;pre&gt;class MyTests: XCTestCase {&#xA;&#x9;&#xA;&#x9;override func setUp() {&#xA;&#x9;&#x9;super.setUp()&#xA;&#x9;&#x9;// Put setup code here. This method is called before the invocation of each test method in the class.&#xA;&#x9;}&#xA;       &#xA;&#x9;override func tearDown() {&#xA;&#x9;&#x9;// Put teardown code here. This method is called after the invocation of each test method in the class.&#xA;&#x9;&#x9;super.tearDown()&#xA;&#x9;}&#xA;&#xA;&#x9;func testExample() {&#xA;&#x9;&#x9;// This is an example of a functional test case.&#xA;&#x9;&#x9;XCTAssert(true, &#34;Pass&#34;)&#xA;&#x9;}&#xA;&#xA;&#x9;func testPerformanceExample(){&#xA;&#x9;&#x9;// This is an example of a performance test case.&#xA;&#x9;&#x9;self.measureBlock() {&#xA;&#x9;&#x9;&#x9;// Put the code you want to measure the time of here.&#xA;&#x9;&#x9;}&#xA;&#x9;}&#xA;}&lt;/pre&gt;&#xA;&lt;p&gt;The code starts by importing the Swift modules that are needed to run the tests. XCTest is the framework for unit testing Swift code. I created a Mac application so my example imports the Cocoa framework. If you have an iOS project your unit test class will import the Cocoa Touch framework.&lt;/p&gt;&#xA;&lt;p&gt;Next comes the class declaration. I named my class MyTests, which inherits from XCTestCase. Swift unit test classes inherit from XCTestCase.&lt;/p&gt;&#xA;&lt;p&gt;Finally come the test methods.There are four methods initially.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The &lt;strong&gt;setUp&lt;/strong&gt; method gets called before each test runs. If you have initialization code you call before running each test, place the code in the &lt;strong&gt;setUp&lt;/strong&gt; method so you don’t have to repeat the code in each test.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;strong&gt;tearDown&lt;/strong&gt; method gets called after each test runs. If you run any cleanup code after running each test, place that code in the &lt;strong&gt;tearDown&lt;/strong&gt; method so you don’t have to repeat the code in each test.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;strong&gt;testExample&lt;/strong&gt; method provides an example of a test method. You can remove this method if you want.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;strong&gt;testPerformanceExample&lt;/strong&gt; method provides an example of a performance test case, which measures how long a task takes to complete. You can remove this method if you want.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;test-methods&#34; class=&#34;relative group&#34;&gt;Test Methods &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#test-methods&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;After creating your unit test class, you can move on to writing test methods. A Swift test method has the following conditions:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It must begin with the word &lt;strong&gt;test&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;It takes no arguments.&lt;/li&gt;&#xA;&lt;li&gt;It returns no value.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The following code shows an example of declaring a test method:&lt;/p&gt;&#xA;&lt;pre&gt;func testDoSomething() {&#xA;&#xA;}&lt;/pre&gt;&#xA;&lt;h3 id=&#34;assertions&#34; class=&#34;relative group&#34;&gt;Assertions &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#assertions&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Each test method needs an assertion, which determines whether or not the test passes. XCTest assertions start with &lt;strong&gt;XCTAssert&lt;/strong&gt;. If you start typing &lt;strong&gt;XCTAssert&lt;/strong&gt;, Xcode’s code completion should show you a list of all the available assertions, but the following are the most widely-used assertions:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;XCTAssertNotNil&lt;/strong&gt; asserts a variable is not nil.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;XCTAssertTrue&lt;/strong&gt; asserts a condition is true.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;XCTAssertFalse&lt;/strong&gt; asserts a condition is false.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;XCTAssertEqual&lt;/strong&gt; asserts two values are equal.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;XCTAssertEqualObjects&lt;/strong&gt; asserts two objects are equal.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;XCTAssertEqualWithAccuracy&lt;/strong&gt; asserts two floating-point values are equal.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;XCTest assertions take two or more arguments. The first arguments depend on the assertion. &lt;strong&gt;XCTAssertTrue&lt;/strong&gt; and &lt;strong&gt;XCTAssertFalse&lt;/strong&gt; take a condition as the first argument. The &lt;strong&gt;XCTAssertEqual&lt;/strong&gt; assertions take two arguments at the start: the two items you’re checking are equal. After the assertion testing arguments comes the error message, which is a string. Xcode displays the error message if the assertion fails. If you want to show the value of a variable in the error message, place the variable name in parentheses in the error message, prefixed by a backslash character.&lt;/p&gt;&#xA;&lt;pre&gt;\(variableName)&lt;/pre&gt;&#xA;&lt;p&gt;The following code shows an example of an assertion involving a variable named length:&lt;/p&gt;&#xA;&lt;pre&gt;XCTAssertTrue(length == 12, “The length should have been 12. Actual length: \(length)&#34;)&lt;/pre&gt;&#xA;&lt;h3 id=&#34;running-your-tests&#34; class=&#34;relative group&#34;&gt;Running Your Tests &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#running-your-tests&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode provides multiple ways to run your tests.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Choose Product &amp;gt; Test.&lt;/li&gt;&#xA;&lt;li&gt;Run them from the editor. There is a small button in the gutter next to the unit test class and each test method. Click the button to run the tests.&lt;/li&gt;&#xA;&lt;li&gt;Run them from the test navigator. Choose View &amp;gt; Navigators &amp;gt; Show Test Navigator to show the test navigator.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Running the tests from the editor or the test navigator gives you more control over what tests are run. But the Xcode 6 betas run every Swift test, even if you tell Xcode to run only one test. Hopefully this will be fixed by the time Xcode 6 is released.&lt;/p&gt;&#xA;&lt;h3 id=&#34;a-test-method-example&#34; class=&#34;relative group&#34;&gt;A Test Method Example &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#a-test-method-example&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you’ve written unit tests in Xcode before, you know enough now to unit test your Swift code. For those of you new to unit testing, I’m providing a sample test method that tests the result of multiplying two negative numbers.&lt;/p&gt;&#xA;&lt;pre&gt;func testMultiplyingTwoNegativeNumbersYieldsAPositiveValue() {&#xA;&#x9;let x = -6&#xA;&#x9;let y = -4&#xA;&#x9;let product = x * y &#xA;&#xA;&#x9;XCTAssertTrue(product &amp;gt; 0, &#34;Multiplying two negative numbers should yield a positive number. Product: \(product)&#34;)&#xA;}&lt;/pre&gt;&#xA;&lt;p&gt;The test is simple. Give two variables negative values and multiply them. Assert the product is greater than 0.&lt;/p&gt;&#xA;&lt;p&gt;If you paste the code into your unit test class and run the test, it should pass. If you want to check the error message, change the condition of the assertion from the product being greater than zero to being less than zero.&lt;/p&gt;&#xA;&lt;h3 id=&#34;more-information&#34; class=&#34;relative group&#34;&gt;More Information &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#more-information&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;You can learn more about unit testing in Xcode and Swift by watching the &lt;em&gt;Testing in Xcode 6&lt;/em&gt; session from Apple’s &lt;a href=&#34;https://developer.apple.com/videos/wwdc/2014/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;WWDC 2014 Session Videos&lt;/a&gt;. Apple also has multiple sessions on Swift programming that you should also watch to learn more about Swift.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating a Save Panel Completion Handler with a Closure in Swift</title>
      <link>https://www.meandmark.com/creating-a-save-panel-completion-handler-with-a-closure-in-swift/</link>
      <pubDate>Tue, 15 Jul 2014 21:31:06 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-a-save-panel-completion-handler-with-a-closure-in-swift/</guid>
      <description>&lt;p&gt;Swift is hot now. I figured I should share some of what I learned converting some Objective-C code to Swift.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-example&#34; class=&#34;relative group&#34;&gt;The Example &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#the-example&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The example in this article is a method to export data to a file. The example opens a save panel and calls the save panel’s completion handler. The completion handler checks if the user clicked the Save button. If the Save button was clicked, get the URL that represents the file location. Use that URL to export the data to the file. This example should serve as a guide to using Swift closures in your code.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-code&#34; class=&#34;relative group&#34;&gt;The Code &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#the-code&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Here’s the code.&lt;/p&gt;&#xA;&lt;pre&gt;@IBAction func export(sender: AnyObject) {&#xA;&#x9;let savePanel = NSSavePanel()       &#xA;&#x9;savePanel.beginWithCompletionHandler { (result: Int) -&amp;gt; Void in           &#xA;&#x9;&#x9;if result == NSFileHandlingPanelOKButton {               &#xA;&#x9;&#x9;&#x9;let exportedFileURL = savePanel.URL               &#xA;&#x9;&#x9;&#x9;// Save the data. What you do depends on your app.&#xA;&#x9;&#x9;&#x9;// Don&#39;t just paste this code in your app as your app&#xA;&#x9;&#x9;&#x9;// probably doesn&#39;t have a createPDF() method.                                &#x9;&#x9;&#x9;self.createPDF(exportedFileURL)&#xA;&#x9;&#x9;}&#xA;&#x9;} // End block   &#xA;}&lt;/pre&gt;&#xA;&lt;p&gt;Let’s look at the first line.&lt;/p&gt;&#xA;&lt;pre&gt;@IBAction func export(sender: AnyObject)&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;strong&gt;@IBAction&lt;/strong&gt; specifies that this method is an Interface Builder action. I made the method an Interface Builder action so I could call the method from the application’s user interface and make connections in Interface Builder. Interface Builder actions take a sender as an argument. If you don’t need your method to be an Interface Builder action, you can remove the &lt;strong&gt;@IBAction&lt;/strong&gt; and replace the &lt;strong&gt;sender&lt;/strong&gt; argument.&lt;/p&gt;&#xA;&lt;p&gt;Now let’s look at the second line.&lt;/p&gt;&#xA;&lt;pre&gt;let savePanel = NSSavePanel()&lt;/pre&gt;&#xA;&lt;p&gt;This line opens a generic save panel. You may want to customize your save panel to replace the Save button with an Export button or add a menu that lets you choose an export file format. But I’m keeping things simple here.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-completion-handler&#34; class=&#34;relative group&#34;&gt;The Completion Handler &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#the-completion-handler&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The third line is the most complicated line in the method.&lt;/p&gt;&#xA;&lt;pre&gt;savePanel.beginWithCompletionHandler { (result: Int) -&amp;gt; Void in&lt;/pre&gt;&#xA;&lt;p&gt;It calls NSSavePanel’s &lt;strong&gt;beginWithCompletionHandler&lt;/strong&gt; method, which waits for the user to finish interacting with the save panel, either by clicking the Save button or the Cancel button. When the Save or Cancel button gets clicked, the completion handler gets called. The completion handler is a closure, which is the Swift equivalent of an Objective-C block.&lt;/p&gt;&#xA;&lt;p&gt;Declaring a closure differs from declaring a function on where you place the arguments and return value. In a function you place the arguments and return value before the &lt;strong&gt;{&lt;/strong&gt;. In a closure you place the arguments and return value after the &lt;strong&gt;{&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In a Swift closure, the arguments come before &lt;strong&gt;-&amp;gt;&lt;/strong&gt;, and the return value after &lt;strong&gt;-&amp;gt;&lt;/strong&gt;. The closure in this example takes one argument: an integer named &lt;strong&gt;result&lt;/strong&gt;. The closure doesn’t return a value. Use &lt;strong&gt;Void&lt;/strong&gt; as the return value when a closure doesn’t return a value. Use the &lt;strong&gt;in&lt;/strong&gt; keyword to finish declaring the closure.&lt;/p&gt;&#xA;&lt;p&gt;After declaring the closure, writing the code is relatively simple. Write your code and add a closing &lt;strong&gt;}&lt;/strong&gt; to complete the closure. My example is pretty simple.&lt;/p&gt;&#xA;&lt;pre&gt;if result == NSFileHandlingPanelOKButton {               &#xA;&#x9;let exportedFileURL = savePanel.URL&#xA;}&lt;/pre&gt;&#xA;&lt;p&gt;All the code does is check if the user clicked the Save (OK) button. If so, get the file location URL from the save panel. The file location URL represents where the user wants to save the data. Use the URL to write the exported data to a file. How you write the data depends on your application and is beyond the scope of this article.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Supporting Earlier Versions of OS X and iOS</title>
      <link>https://www.meandmark.com/supporting-earlier-versions-of-os-x-and-ios/</link>
      <pubDate>Wed, 23 Apr 2014 20:04:54 +0000</pubDate>
      <guid>https://www.meandmark.com/supporting-earlier-versions-of-os-x-and-ios/</guid>
      <description>&lt;p&gt;Recently I’ve seen a lot of questions on Stack Overflow from people having problems getting their applications to run on earlier versions of OS X and iOS. I wrote about this topic years ago, but Apple has added more things to check in Xcode so I’m revisiting the topic.&lt;/p&gt;&#xA;&lt;h3 id=&#34;deployment-target&#34; class=&#34;relative group&#34;&gt;Deployment Target &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#deployment-target&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The deployment target is the earliest version of OS X or iOS that can run your application. When you create a new Xcode project, the deployment target is the most recent SDK version. If you’re using Xcode 5 the deployment target will be OS X 10.9 or iOS 7. To get your application to run on earlier OS versions you must change the deployment target.&lt;/p&gt;&#xA;&lt;p&gt;Select your project from the project navigator to open the project editor. Select the project from the left side of the project editor. Click the Info button at the top of the project editor. From there you can set the deployment target.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/04/Set-Deployment-Target.png&#34; alt=&#34;Set Deployment Target&#34; width=&#34;557&#34; height=&#34;146&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Keep in mind that for your application to run on earlier OS versions, the application can’t rely on technologies or functions introduced in later OS versions. If you create a SpriteKit game, the game won’t run on anything earlier than OS X 10.9 or iOS 7. Setting the deployment target of a SpriteKit game to iOS 5 isn’t going to magically make your game run on a device running iOS 5.&lt;/p&gt;&#xA;&lt;p&gt;Unfortunately, Xcode won’t tell you when you’re making method calls that won’t run on earlier OS versions. There is an application called &lt;a href=&#34;http://www.deploymateapp.com/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Deploymate&lt;/a&gt; that can run these checks for you. Deploymate isn’t free, but there is a demo to try.&lt;/p&gt;&#xA;&lt;p&gt;Many people think they need a specific SDK to support earlier OS versions. For example, they think they need to build their application with the iOS 6 SDK to get their application to run on iOS 6. This is not true. The SDK specifies the newest features your application can access; using the iOS 7 SDK lets you take advantage of iOS 7 features. The deployment target determines the earliest version of OS X or iOS that can run your application. You can build your iOS application with the iOS 7 SDK and have it run on iOS 6. In most cases, you should use the newest SDK. Set the deployment target to the earliest OS version you want to support.&lt;/p&gt;&#xA;&lt;h3 id=&#34;auto-layout&#34; class=&#34;relative group&#34;&gt;Auto Layout &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#auto-layout&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you create a new Cocoa or iOS application project in Xcode, the project’s xib and storyboard files use auto layout. Apple introduced auto layout in OS X 10.7 and iOS 6. If you want your application to run on earlier versions of OS X and iOS, you must turn off auto layout for your xib and storyboard files. Select a xib file or storyboard file from the project navigator. Open the file inspector by choosing View &amp;gt; Utilities &amp;gt; Show File Inspector. Deselect the Use Auto Layout checkbox.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/04/Use-Autolayout.png&#34; alt=&#34;Use Autolayout&#34; width=&#34;245&#34; height=&#34;115&#34; border=&#34;0&#34; /&gt; &#xA;&lt;h3 id=&#34;base-internationalization&#34; class=&#34;relative group&#34;&gt;Base Internationalization &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#base-internationalization&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you create a new Cocoa or iOS application project in Xcode 5, the project uses base internationalization. Base internationalization makes translating your application to other spoken languages easier. Apple added base internationalization in OS X 10.8 and iOS 7. If you set your deployment target to an earlier OS version, you’ll get a warning when you build your project, and your application won’t launch on machines running the earlier OS version.&lt;/p&gt;&#xA;&lt;p&gt;To support earlier OS versions, you must turn off base internationalization. The steps for turning off base internationalization in Xcode are similar to setting the deployment target. Deselect the Use Base Internationalization checkbox.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/04/Base-Internationalization.png&#34; alt=&#34;Base Internationalization&#34; width=&#34;600&#34; height=&#34;258&#34; border=&#34;0&#34; /&gt;  &lt;/p&gt;&#xA;&lt;p&gt;I recommend backing up your project or taking a snapshot before turning off base internationalization. Turning off base internationalization may delete your project’s xib files.&lt;/p&gt;&#xA;&lt;h3 id=&#34;architectures&#34; class=&#34;relative group&#34;&gt;Architectures &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#architectures&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Newly created Cocoa application projects are configured to build 64-bit Intel applications. Depending on the OS versions you’re supporting, you might need to build a 32-bit version of your application. You’ll need a 32-bit version to support OS X 10.4 and 10.5, and possibly 10.6.&lt;/p&gt;&#xA;&lt;p&gt;Set the Architectures build setting to Universal to build both 32 and 64-bit versions of your Mac application.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Loading Windows from Nib Files</title>
      <link>https://www.meandmark.com/loading-windows-from-nib-files/</link>
      <pubDate>Tue, 18 Mar 2014 05:54:38 +0000</pubDate>
      <guid>https://www.meandmark.com/loading-windows-from-nib-files/</guid>
      <description>&lt;p&gt;This post summarizes what I learned when I wrote some code to load a PDF preview window from an external nib file. I’m sharing what I learned in case someone else runs into problems loading windows from external nib/xib files.&lt;/p&gt;&#xA;&lt;p&gt;Short answer: NSWindowController is your friend. Call &lt;strong&gt;initWithWindowNibName:&lt;/strong&gt; to load the window. Call &lt;strong&gt;showWindow:&lt;/strong&gt; to show the window.&lt;/p&gt;&#xA;&lt;h3 id=&#34;subclassing-nswindowcontroller&#34; class=&#34;relative group&#34;&gt;Subclassing NSWindowController &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#subclassing-nswindowcontroller&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;You don’t have to subclass NSWindowController to load a window from a nib, but subclassing NSWindowController makes it easier to access the views and controls in the window. To create a subclass of NSWindowController, choose File &amp;gt; New &amp;gt; File in Xcode.&lt;/p&gt;&#xA;&lt;p&gt;If you subclass NSWindowController and want to create outlets and actions in Interface Builder, make sure you set the class of the xib’s File’s Owner to your NSWindowController subclass.&lt;/p&gt;&#xA;&lt;h3 id=&#34;loading-the-window&#34; class=&#34;relative group&#34;&gt;&lt;span style=&#34;font-size: 1.17em;&#34;&gt;Loading the Window&lt;/span&gt; &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#loading-the-window&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To load the window from the nib file, call NSWindowController’s &lt;strong&gt;initWithWindowNibName:&lt;/strong&gt; method. Supply the name of the nib file, minus the .nib file extension. The following code loads a window from a nib file named Preview.nib:&lt;/p&gt;&#xA;&lt;pre&gt;NSWindowController* previewWindow;&#xA;previewWindow = [[NSWindowController alloc] initWithWindowNibName:@&#34;Preview&#34;];&lt;/pre&gt;&#xA;&lt;p&gt;In this example I used NSWindowController. If you subclass NSWindowController, substitute the name of your subclass.&lt;/p&gt;&#xA;&lt;h3 id=&#34;showing-the-window&#34; class=&#34;relative group&#34;&gt;Showing the Window &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#showing-the-window&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;After loading the window, call NSWindowController’s &lt;strong&gt;showWindow:&lt;/strong&gt; method to show the window. You can pass the object sending the message, but in most cases you can just pass nil, as in the following code:&lt;/p&gt;&#xA;&lt;pre&gt;[previewWindow showWindow:nil];&lt;/pre&gt;&#xA;&lt;p&gt;You must show the window before you can access the window’s views and controls. The views and controls are nil until you show the window.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Quick Look Variable Viewing</title>
      <link>https://www.meandmark.com/xcode-5-quick-look-variable-viewing/</link>
      <pubDate>Thu, 13 Mar 2014 19:49:09 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-quick-look-variable-viewing/</guid>
      <description>&lt;p&gt;I missed a new feature in Xcode 5’s debugger: Quick Look support to display variables. To Quick Look a variable, select the variable and click the Quick Look button at the bottom of the variables view. The Quick Look button looks like an eye.&lt;/p&gt;&#xA;&lt;p&gt;Keith Harrison writes more about Xcode’s Quick Look support, including adding Quick Look support for your data types, in the following post:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://useyourloaf.com/blog/2014/03/12/xcode-debugger-quick-look.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode Debugger Quick Look&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Base Internationalization</title>
      <link>https://www.meandmark.com/base-internationalization/</link>
      <pubDate>Thu, 23 Jan 2014 01:26:11 +0000</pubDate>
      <guid>https://www.meandmark.com/base-internationalization/</guid>
      <description>&lt;p&gt;Having answered multiple questions on Stack Overflow from people getting errors when they change their Xcode project’s deployment target to OS X 10.6, it seems time to explain the cause of these errors: base internationalization.&lt;/p&gt;&#xA;&lt;p&gt;When you create a new Cocoa application project in Xcode 5 (base internationalization was added in Xcode 4.4, but I don’t know the specific version when base internationalization became the default option), the project has support for base internationalization. Base internationalization make localizing your application to other spoken languages easier.&lt;/p&gt;&#xA;&lt;p&gt;Suppose you want to have three versions of your application: English, French, and Spanish. Without base internationalization you would need three copies of each xib file: English, French, and Spanish. With base internationalization, there is one copy of each xib file, a base xib, and three strings files: English, French, and Spanish.&lt;/p&gt;&#xA;&lt;p&gt;Since the strings file is just a text file, you can give the strings file to the person translating your application, and they can translate the text of your user interface without having to edit any xib files. The combination of base internationalization and auto layout simplifies creating user interfaces that support multiple spoken languages.&lt;/p&gt;&#xA;&lt;p&gt;At this point you may be wondering what’s the downside of base internationalization. Apple added support for base internationalization in OS X 10.8. If your project uses base internationalization, it will not run in OS X 10.6 and 10.7. Creating a new Cocoa application project and changing the deployment target to OS X 10.6 or 10.7 is going to cause problems for people running 10.6 or 10.7.&lt;/p&gt;&#xA;&lt;p&gt;If you want to support OS X 10.6 and 10.7 in your Cocoa project, you must turn off base internationalization. Select your project from the project navigator to open the project editor. Select the project from the left side of the project editor. Click the Info button at the top of the project editor. Deselect the Use Base Internationalization checkbox.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/01/Base-Internationalization-Setting.png&#34; alt=&#34;Base Internationalization Setting&#34; width=&#34;516&#34; height=&#34;163&#34; border=&#34;0&#34; /&gt;  &lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Instruments: Heap Allocations and Anonymous VM</title>
      <link>https://www.meandmark.com/instruments-heap-allocations-and-anonymous-vm/</link>
      <pubDate>Mon, 06 Jan 2014 21:25:36 +0000</pubDate>
      <guid>https://www.meandmark.com/instruments-heap-allocations-and-anonymous-vm/</guid>
      <description>&lt;p&gt;One change to the Allocations instrument in Instruments 5, which comes with Xcode 5, is that the allocation summary lists the heap allocations and the amount of anonymous VM, which you can see in the following screenshot:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2014/01/Instruments-Anonymous-VM.png&#34; alt=&#34;Instruments Anonymous VM&#34; width=&#34;600&#34; height=&#34;51&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Should you focus on the Live Bytes column for heap allocations or anonymous VM? Focus on the heap allocations because your app has more control over heap allocations. Most of the memory allocations your app makes are heap allocations.&lt;/p&gt;&#xA;&lt;p&gt;The VM in anonymous VM stands for virtual memory. When your app launches, the operating system reserves a block of virtual memory for your application. This block is usually much larger than the amount of memory your app needs. When your app allocates memory, the operating system allocates the memory from the block it reserved.&lt;/p&gt;&#xA;&lt;p&gt;Remember the second sentence in the previous paragraph. The operating system determines the size of the virtual memory block, not your app. That’s why you should focus on the heap allocations instead of anonymous VM. Your app has no control over the size of the anonymous VM.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Setting the Current Working Directory for Xcode Command-Line Projects</title>
      <link>https://www.meandmark.com/setting-the-current-working-directory-for-xcode-command-line-projects/</link>
      <pubDate>Wed, 11 Dec 2013 20:03:04 +0000</pubDate>
      <guid>https://www.meandmark.com/setting-the-current-working-directory-for-xcode-command-line-projects/</guid>
      <description>&lt;p&gt;A common problem for people using Xcode to write command-line C and C++ programs is not being able to read files. Their code to open the file uses a relative path to the file, such as the following code:&lt;/p&gt;&#xA;&lt;pre&gt;ifstream testFile;&#xA;testFile.open(“TestFile.txt”);&lt;/pre&gt;&#xA;&lt;p&gt;The code fails because the program can’t find the file TestFile.txt. The program looks only in the current directory for TestFile.txt. If it doesn’t find the file there, it stops looking, and your program fails to open the file.&lt;/p&gt;&#xA;&lt;p&gt;If you’re using Xcode 4 or 5, you can set the current working directory for your project from the scheme editor. You can access the scheme editor from the project window toolbar. If you look at the following screenshot:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/12/Xcode-5-Access-Scheme-Menu.png&#34; alt=&#34;Xcode 5 Access Scheme Menu&#34; width=&#34;318&#34; height=&#34;50&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;You can open the scheme editor by clicking MyFirstProject and choosing Edit Scheme. Your project will most likely have a different name than MyFirstProject.&lt;/p&gt;&#xA;&lt;p&gt;On the left side of the scheme editor is a list of steps. Select the Run step. Click the Options button to access the area of the scheme editor where you can set the current working directory.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/12/Xcode-5-Current-Working-Directory.png&#34; alt=&#34;Xcode 5 Current Working Directory&#34; width=&#34;600&#34; height=&#34;410&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Select the Use custom working directory: checkbox to tell Xcode to use a custom working directory for your project. You can either enter the working directory path in the text field or click the Folder icon to choose the working directory.&lt;/p&gt;&#xA;&lt;p&gt;After setting the custom working directory, build your project. Place the files you want to read in that directory, run your project, and your file reading experience should go much smoother.&lt;/p&gt;&#xA;&lt;h3 id=&#34;note-to-mac-and-ios-developers&#34; class=&#34;relative group&#34;&gt;Note to Mac and iOS Developers &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#note-to-mac-and-ios-developers&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Setting a custom working directory is something only command-line tool projects should use. If you’re writing a Mac or iOS app with a GUI, you should load files using Cocoa’s NSBundle class or Core Foundation’s CFBundle functions.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Create NSURL for Temporary File</title>
      <link>https://www.meandmark.com/create-nsurl-for-temporary-file/</link>
      <pubDate>Tue, 03 Dec 2013 20:30:32 +0000</pubDate>
      <guid>https://www.meandmark.com/create-nsurl-for-temporary-file/</guid>
      <description>&lt;p&gt;I was recently working on some code that previews a PDF file. I had written a method to create the PDF that takes an NSURL object as an argument. I wanted to call that method to preview the PDF file, supplying an NSURL object for a temporary file. How do you create an NSURL object for a temporary file?&lt;/p&gt;&#xA;&lt;p&gt;Call NSURL’s fileURLWithPath: method. To create the path for the URL, call the function NSTemporaryDirectory(), which returns the path to the user temporary directory. Then call NSString’s stringByAppendingPathComponent: method, supplying the name of the temporary file. The following code creates an NSURL object for a temporary file named TempPreview.pdf:&lt;/p&gt;&#xA;&lt;pre&gt;NSURL* previewURL = [NSURL fileURLWithPath:&#xA;    [NSTemporaryDirectory() stringByAppendingPathComponent:@&#34;TempPreview.pdf&#34;]];&lt;/pre&gt;</description>
    </item>
    <item>
      <title>Xcode 5: New Derived Data Options</title>
      <link>https://www.meandmark.com/xcode-5-new-derived-data-options/</link>
      <pubDate>Mon, 02 Dec 2013 21:04:39 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-new-derived-data-options/</guid>
      <description>&lt;p&gt;Xcode 5 provides additional ways for you to customize where Xcode places its derived data, such as the application you’re building. If you go to Xcode’s Locations preferences and click the Advanced button below the Derived Data text field, a sheet similar to the following should open:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/12/Xcode-5-Derived-Data-Prefs.png&#34; alt=&#34;Xcode 5 Derived Data Prefs&#34; width=&#34;590&#34; height=&#34;399&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;The new options are Unique, Shared Folder, and Legacy. Choosing Unique places the derived data in a unique subfolder of Xcode’s derived data location. Choosing Shared Folder places the derived data in a shared subfolder of Xcode’s derived data location. Choosing Legacy lets you specify a different derived data location for each target in your project. Use the Build Products Path build setting to specify the build path for each target in your project.&lt;/p&gt;&#xA;&lt;p&gt;Choosing File &amp;gt; Project Settings and clicking the Advanced button lets you customize the derived data location for a single project.&lt;/p&gt;&#xA;&lt;p&gt;Related post: &lt;a href=&#34;http://meandmark.com/blog/2011/04/xcode-4-finding-the-application-you-built&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 4: Finding the Application You Built&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating a Command Line Application with Xcode</title>
      <link>https://www.meandmark.com/creating-a-command-line-application-with-xcode/</link>
      <pubDate>Fri, 29 Nov 2013 18:49:56 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-a-command-line-application-with-xcode/</guid>
      <description>&lt;p&gt;When learning a programming language, you generally start by writing command-line programs so you can focus on learning the language. If you’re learning C, C++, or Objective-C, you can use Xcode to write and run your programs. In this article you’ll learn how to setup Xcode to create command-line applications. Short answer: create a command-line tool project.&lt;/p&gt;&#xA;&lt;p&gt;The instructions for this article are for Xcode 5, but they should also apply to Xcode 4 with minor changes. If you have an older version of Xcode, you can find an article that creates a command-line application in Xcode 2 and 3 in the &lt;a href=&#34;http://www.meandmark.com/articles.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Articles section&lt;/a&gt; of my website in the section Xcode Articles.&lt;/p&gt;&#xA;&lt;h3 id=&#34;create-the-project&#34; class=&#34;relative group&#34;&gt;Create the Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-the-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Every program you create in Xcode requires a project, even a program with only one source file. So let’s start by creating a new project. In Xcode choose File &amp;gt; New &amp;gt; Project. The New Project Assistant opens. On the left side of the assistant is a list of project categories. Select Application in the OS X section to see a list of Mac application project templates. Select the Command Line Tool template, as you can see in the following screenshot:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; alt=&#34;Command Line Tool Project Step 1&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/11/Command-Line-Tool-Project-Step-1.png&#34; width=&#34;600&#34; height=&#34;408&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Click the Next button to move to the next step.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; alt=&#34;Command LIne Tool Project Step 2&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/11/Command-LIne-Tool-Project-Step-2.png&#34; width=&#34;600&#34; height=&#34;408&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Enter the name of the project in the Product Name text field. The name of the project is also the name of the program you’re creating. Enter an organization name in the Organization Name text field. You can enter your name if you are not part of an organization. You don’t have to worry about the company identifier for a command-line program, but the company identifier generally takes the following form:&lt;/p&gt;&#xA;&lt;pre&gt;com.CompanyName&lt;/pre&gt;&#xA;&lt;p&gt;Use the Type menu to choose the language. I chose C++, but you can also choose C or Objective-C. Choose Foundation to create a command-line Objective-C program.&lt;/p&gt;&#xA;&lt;p&gt;Click the Next button to move to the last step, which is to choose a location to save your project. Click the Create button to create the project. At the bottom of the Save panel, you should see an option to create a local git repository for your project.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; alt=&#34;Create Git Repo&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/11/Create-Git-Repo.png&#34; width=&#34;576&#34; height=&#34;175&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;You don’t need to create a git repository for this project so you can deselect the Create git repository checkbox.&lt;/p&gt;&#xA;&lt;h3 id=&#34;editing-source-code&#34; class=&#34;relative group&#34;&gt;Editing Source Code &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#editing-source-code&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now that you’ve created the project, the next step is to start editing source code. On the left side of the project window is the project navigator, which lists all the files in your project.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; alt=&#34;Project Navigator&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/11/Project-Navigator.png&#34; width=&#34;258&#34; height=&#34;151&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Select the main file to open it in Xcode’s file. In the screenshot the main file is named main.cpp because I created a C++ project. If you chose a different language, your main file will have a different file extension. You should see the following code in the main file:&lt;/p&gt;&#xA;&lt;pre&gt;int main(int argc, const char * argv[]){&#xA;    // insert code here...   &#xA;    std::cout &amp;lt;&amp;lt; &#34;Hello, World!\n&#34;;&#xA;    return 0;&#xA;}&lt;/pre&gt;&#xA;&lt;p&gt;If you have a C or Objective-C project, the code will look a little different, but the code does the same thing: display the message &lt;strong&gt;Hello, World!&lt;/strong&gt; in the console. Let’s change the message. Change the following string:&lt;/p&gt;&#xA;&lt;pre&gt;&#34;Hello, World!\n&#34;&lt;/pre&gt;&#xA;&lt;p&gt;To the following:&lt;/p&gt;&#xA;&lt;pre&gt;“This is my first Xcode project.\n&#34;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;running-the-project&#34; class=&#34;relative group&#34;&gt;Running the Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#running-the-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Click the Play button at the top of the project window to build and run your project. The output of the program should appear in the debug console at the bottom of the project window.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; alt=&#34;Debug Console&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/11/Debug-Console.png&#34; width=&#34;600&#34; height=&#34;93&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;If you don’t see the debug console, choose View &amp;gt; Debug Area &amp;gt; Activate Console to show the console.&lt;/p&gt;&#xA;&lt;h3 id=&#34;wheres-the-application&#34; class=&#34;relative group&#34;&gt;Where’s the Application? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#wheres-the-application&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Click the disclosure triangle next to the Products folder in the project navigator to show the application you built. Select the application, right-click, and choose Show in Finder. Doing this will show your application in the Finder so you can run the application outside of Xcode.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Showing More Text in the Issue Navigator</title>
      <link>https://www.meandmark.com/xcode-5-showing-more-text-in-the-issue-navigator/</link>
      <pubDate>Wed, 20 Nov 2013 20:39:33 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-showing-more-text-in-the-issue-navigator/</guid>
      <description>&lt;p&gt;Xcode 5 lets you control how many of lines of text appear in the issue navigator for errors, warnings, and static analyzer issues. Go to Xcode’s General preferences and use the Issue Navigator Detail menu to choose how many lines of text to show. Xcode can show 1-10 lines of text for each issue in the issue navigator.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/11/Xcode-5-Issue-Navigator-Prefs.png&#34; alt=&#34;Xcode 5 Issue Navigator Prefs&#34; width=&#34;600&#34; height=&#34;271&#34; border=&#34;0&#34; /&gt;</description>
    </item>
    <item>
      <title>Xcode 5: Modules</title>
      <link>https://www.meandmark.com/xcode-5-modules/</link>
      <pubDate>Mon, 28 Oct 2013 17:54:24 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-modules/</guid>
      <description>&lt;p&gt;A new compiler feature in Xcode 5 is modules. Modules simplify importing header files and linking frameworks. They also can build your project faster, working similarly to precompiled headers. &lt;/p&gt;&#xA;&lt;h3 id=&#34;prerequisites&#34; class=&#34;relative group&#34;&gt;Prerequisites &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#prerequisites&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To use modules you must be using either the Mac OS X 10.9 SDK or the iOS 7 SDK. Modules do not work with earlier SDKs. Module support is currently limited to C and Objective-C code.&lt;/p&gt;&#xA;&lt;h3 id=&#34;build-settings&#34; class=&#34;relative group&#34;&gt;Build Settings &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#build-settings&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode has two build settings for modules. If you want to use modules in your Xcode project, you must set the Enable Modules (C and Objective C) build setting to Yes. Setting the Link Frameworks Automatically build setting to Yes keeps you from having to manually add frameworks to your Xcode project.&lt;/p&gt;&#xA;&lt;h3 id=&#34;importing-headers&#34; class=&#34;relative group&#34;&gt;Importing Headers &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#importing-headers&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To import a framework’s header files, use the @import statement and supply the name of the framework. The following example imports the header files from the Cocoa framework:&lt;/p&gt;&#xA;&lt;pre&gt;@import Cocoa;&lt;/pre&gt;&#xA;&lt;p&gt;To import a single header file from a framework, add a period to the framework and supply the name of the header file. The following example imports the header file AudioHardware.h from the Core Audio framework:&lt;/p&gt;&#xA;&lt;pre&gt;@import CoreAudio.AudioHardware;&lt;/pre&gt;&#xA;&lt;p&gt;Currently you can use @import only with Apple’s frameworks.&lt;/p&gt;&#xA;&lt;h3 id=&#34;using-modules-with-existing-import-code&#34; class=&#34;relative group&#34;&gt;Using Modules with Existing Import Code &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#using-modules-with-existing-import-code&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you have existing code that uses #import or #include to include headers, you can support modules without changing your code. Set the Enable Modules build setting to Yes, and Xcode will use modules to build your project.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Auto Layout Buttons</title>
      <link>https://www.meandmark.com/xcode-5-auto-layout-buttons/</link>
      <pubDate>Tue, 15 Oct 2013 19:48:14 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-auto-layout-buttons/</guid>
      <description>&lt;p&gt;If you open a xib file or storyboard in Xcode 5, you should see the following set of buttons at the bottom of the canvas:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/10/Xcode-5-Autolayout-Buttons.png&#34; alt=&#34;Xcode 5 Autolayout Buttons&#34; width=&#34;137&#34; height=&#34;27&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;These buttons allow you to perform common auto layout tasks. The buttons running from left to right are the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Align&lt;/li&gt;&#xA;&lt;li&gt;Pin&lt;/li&gt;&#xA;&lt;li&gt;Resolve Auto Layout Issues&lt;/li&gt;&#xA;&lt;li&gt;Resizing Behavior&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you see three buttons instead of four, you must convert your xib file to the new xib file format introduced in Xcode 5. The Resolve Auto Layout Issues button is new in Xcode 5 and requires the new xib file format. Read my &lt;a href=&#34;http://meandmark.com/blog/2013/09/xcode-5-new-xib-file-format/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 5: New Xib File Format&lt;/a&gt; post for instructions on converting a xib file to the new format.&lt;/p&gt;&#xA;&lt;p&gt;If you don’t see any of the four buttons, your project is not using auto layout. To turn on auto layout, open the file inspector and select the Use autolayout checkbox&lt;/p&gt;&#xA;&lt;h3 id=&#34;align&#34; class=&#34;relative group&#34;&gt;Align &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#align&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Use the Align button to add alignment constraints. In most cases you’ll be aligning multiple UI elements, but you can also align a single UI element with its containing view.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/10/Xcode-5-Alignment-Constraints.png&#34; alt=&#34;Xcode 5 Alignment Constraints&#34; width=&#34;300&#34; height=&#34;289&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Select a checkbox to add a constraint. Use the Update Frames to specify the frames where the newly added constraints apply. Click the Add Constraints button to finish adding the constraints.&lt;/p&gt;&#xA;&lt;h3 id=&#34;pin&#34; class=&#34;relative group&#34;&gt;Pin &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#pin&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Use the Pin button to add spacing, width, and height constraints.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/10/Xcode-5-Pin-Constraints.png&#34; alt=&#34;Xcode 5 Pin Constraints&#34; width=&#34;260&#34; height=&#34;323&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;In the top section of the screenshot you can see four struts, which are between the small white square and the four text fields with the values 7, 11, 394, and 7. Clicking a strut pins the UI element to its nearest neighbor on that side. In the screenshot I’m pinning the UI element to its nearest neighbor on the top and left.&lt;/p&gt;&#xA;&lt;h3 id=&#34;resolve-auto-layout-issues&#34; class=&#34;relative group&#34;&gt;Resolve Auto Layout Issues &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#resolve-auto-layout-issues&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When working with auto layout in Xcode 4, Interface Builder created constraints for you. Xcode 5 gives you more control over constraints, but with this control comes more opportunity to make mistakes. Use the Resolve Auto Layout Issues button to fix your mistakes.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/10/Xcode-5-Resolve-Autolayout-Issues.png&#34; alt=&#34;Xcode 5 Resolve Autolayout Issues&#34; width=&#34;322&#34; height=&#34;204&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Clicking the Resolve Auto Layout Issues button opens a menu where you can update constraints, add missing constraints, reset to suggested constraints, or clear all constraints.&lt;/p&gt;&#xA;&lt;h3 id=&#34;resizing-behavior&#34; class=&#34;relative group&#34;&gt;Resizing Behavior &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#resizing-behavior&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Use the Resizing Behavior button to specify which views to apply the constraints when resizing a view.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/10/Xcode-5-Autolayout-Resizing.png&#34; alt=&#34;Xcode 5 Autolayout Resizing&#34; width=&#34;306&#34; height=&#34;60&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt; As you can see in the screenshot, you can apply the constraints to the view’s siblings and ancestors or to its descendants.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Organizer Changes</title>
      <link>https://www.meandmark.com/xcode-5-organizer-changes/</link>
      <pubDate>Mon, 14 Oct 2013 17:16:19 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-organizer-changes/</guid>
      <description>&lt;p&gt;Apple did not make a lot of changes to the Organizer in Xcode 5, but you can read about them here.&lt;/p&gt;&#xA;&lt;h3 id=&#34;no-repositories-and-documentation-sections&#34; class=&#34;relative group&#34;&gt;No Repositories and Documentation Sections &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#no-repositories-and-documentation-sections&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;There are no Repositories and Documentation buttons at the top of the Organizer. More information on accessing repositories and documentation in Xcode 5 can be found in the following posts:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://meandmark.com/blog/2013/09/xcode-5-version-control-changes/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 5: Version Control Changes&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://meandmark.com/blog/2013/09/xcode-5-reading-documentation/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 5: Reading Documentation&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;devices-section-changes&#34; class=&#34;relative group&#34;&gt;Devices Section Changes &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#devices-section-changes&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;There is a Re-Symbolicate button at the bottom of the Organizer to symbolicate crash logs so you can determine where the crash occurs in your code. Select a crash log and click the Re-Symbolicate button to symbolicate the crash log.&lt;/p&gt;&#xA;&lt;p&gt;The Library section on the left no longer has the Provisioning Profiles and Software Images items.&lt;/p&gt;&#xA;&lt;h3 id=&#34;no-organizer-button-in-the-project-window-toolbar&#34; class=&#34;relative group&#34;&gt;No Organizer Button in the Project Window Toolbar &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#no-organizer-button-in-the-project-window-toolbar&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 5 removed the Organizer button in the project window’s toolbar. Choose Window &amp;gt; Organizer to open the Organizer.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Showing Quick Help Documentation for Your Code</title>
      <link>https://www.meandmark.com/xcode-5-showing-quick-help-documentation-for-your-code/</link>
      <pubDate>Thu, 10 Oct 2013 19:18:12 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-showing-quick-help-documentation-for-your-code/</guid>
      <description>&lt;p&gt;Normally I don’t link to other blogs, but the following post shows how to get Xcode to show Quick Help documentation for the properties and methods you write, covering almost everything I would have covered in an original post:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://confusatory.org/post/63488534619/documentation-in-xcode-5&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Documentation in Xcode 5&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Generating documentation for properties is especially simple. Add an extra slash to a single-line comment or add an extra asterisk to a multi-line comment. Generating documentation for methods is more complicated since you have to document parameters and return values.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: New File Templates</title>
      <link>https://www.meandmark.com/xcode-5-new-file-templates/</link>
      <pubDate>Wed, 09 Oct 2013 18:30:35 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-new-file-templates/</guid>
      <description>&lt;p&gt;Xcode 5 adds two new file templates to the Resources group under both iOS and Mac OS X. They are an asset catalog and a SpriteKit particle file. An asset catalog packages your project’s assets (examples are application icons, document icons, and launch images) in one place. Asset catalogs make it easier to support both retina and non-retina displays. New Cocoa and iOS projects include an asset catalog. Use the asset catalog template to add an asset catalog to projects created in earlier versions of Xcode.&lt;/p&gt;&#xA;&lt;p&gt;The SpriteKit particle file template provides a starting point for creating particle effects for SpriteKit games. An example of using particle effects is having an object explode when you shoot it in a game. If you add a SpriteKit particle file to your project, you will be asked to choose a particle template. Xcode provides the following particle templates: bokeh, fire, fireflies, magic, rain, smoke, snow, and spark.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Blame for Line</title>
      <link>https://www.meandmark.com/xcode-5-blame-for-line/</link>
      <pubDate>Tue, 08 Oct 2013 20:08:01 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-blame-for-line/</guid>
      <description>&lt;p&gt;Xcode 5 adds a new blame for line feature that lets you see who changed a line of code without having to switch to the version editor. Click on a line of code in the standard editor or one of the editors in the assistant editor. Right-click and choose Show Blame for Line. A popover like the following screenshot will open:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/10/Xcode-5-Blame-in-Line.png&#34; alt=&#34;Xcode 5 Blame in Line&#34; width=&#34;364&#34; height=&#34;114&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;The popover tells you who made the last change to the line, when they made the change, the commit where they made the change (71dfc02528bf in the screenshot), and the commit message. The popover also provides buttons to show the files modified during the commit, open the file in the blame view, and open the file in the comparison view.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Getting OCMock to Work with XCTest</title>
      <link>https://www.meandmark.com/getting-ocmock-to-work-with-xctest/</link>
      <pubDate>Mon, 07 Oct 2013 17:19:56 +0000</pubDate>
      <guid>https://www.meandmark.com/getting-ocmock-to-work-with-xctest/</guid>
      <description>&lt;p&gt;XCTest does not currently have built-in support for mock objects so you’ll need an external framework like &lt;a href=&#34;http://ocmock.org/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;OCMock&lt;/a&gt; for mock object support. OCMock versions 2.2 and later work with XCTest. I had only one problem getting OCMock to work with XCTest. When I ran my tests, I would get a warning saying that the test target did not finish. The cause of the warning is Xcode being unable to find the OCMock framework. The fix for this warning is to copy the OCMock framework to the products directory, using the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Add a Copy Files build phase to the unit testing target. Choose Editor &amp;gt; Add Build Phase &amp;gt; Add Copy Files Build Phase.&lt;/li&gt;&#xA;&lt;li&gt;Add the OCMock framework to the Copy Files build phase.&lt;/li&gt;&#xA;&lt;li&gt;Set the copy destination to the Products Directory.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/10/OCMock-Copy-Files-Build-Phase.png&#34; alt=&#34;OCMock Copy Files Build Phase&#34; width=&#34;445&#34; height=&#34;205&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Copying the OCMock framework to the products directory should be enough to run your XCTest tests that use OCMock.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Instruments Heapshot Analysis Change</title>
      <link>https://www.meandmark.com/xcode-5-instruments-heapshot-analysis-change/</link>
      <pubDate>Fri, 04 Oct 2013 17:21:02 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-instruments-heapshot-analysis-change/</guid>
      <description>&lt;p&gt;Xcode 5 has a naming change for the Allocations instrument in Instruments. The Heapshot Analysis section has been renamed Generations.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: New iOS Projects Use Storyboards</title>
      <link>https://www.meandmark.com/xcode-5-new-ios-projects-use-storyboards/</link>
      <pubDate>Wed, 02 Oct 2013 18:11:13 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-new-ios-projects-use-storyboards/</guid>
      <description>&lt;p&gt;If you create a new iOS application project in Xcode 5, you will notice there is no checkbox to use storyboards. There is no checkbox because all iOS application project templates (except the Empty Application template) include storyboards. Those of you who prefer xib files to storyboards should use the Empty Application template and add an Application xib file to the project.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Unit Testing Changes</title>
      <link>https://www.meandmark.com/xcode-5-unit-testing-changes/</link>
      <pubDate>Mon, 30 Sep 2013 17:14:25 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-unit-testing-changes/</guid>
      <description>&lt;p&gt;One of the biggest areas of change in Xcode 5 involves unit testing. This post details those changes.&lt;/p&gt;&#xA;&lt;h3 id=&#34;test-navigator&#34; class=&#34;relative group&#34;&gt;Test Navigator &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#test-navigator&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 5 adds a test navigator to the available navigators on the left side of the project window. You can see an example of the test navigator in the following screenshot:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/09/Xcode-5-Test-Navigator.png&#34; alt=&#34;Xcode 5 Test Navigator&#34; width=&#34;351&#34; height=&#34;238&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;The test navigator has one listing for each unit test class in your test target. Click the disclosure triangle next to a test class to see the tests for that class. Selecting a test class opens that class in Xcode’s editor. Selecting a test takes you to the selected test in Xcode’s editor.&lt;/p&gt;&#xA;&lt;p&gt;The test navigator lets you control what tests are run. Selecting the unit testing target, a test class, or an individual test makes a Play button appear next to the selected item in the project navigator (where the green checkmarks are in the screenshot). Click the Play button to run tests. Clicking the Play button for the unit testing target runs all the tests. Clicking the Play button for a test class runs all the tests for that class. Clicking the Play button for an individual test runs one test. If a test passes, it has a green checkmark next to it. Failing tests have a red X next to them.&lt;/p&gt;&#xA;&lt;p&gt;Xcode 5 also allows you to run tests from the editor. Look at the following screenshot for the start of a unit test:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/09/Xcode-5-Test-From-Editor.png&#34; alt=&#34;Xcode 5 Test From Editor&#34; width=&#34;293&#34; height=&#34;20&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Notice the diamond next to line 52 in the screenshot. Click the diamond to run the test. Running unit tests from the editor helps when you have a failing test. Click the diamond to rerun the failing test without having to run the whole test suite.&lt;/p&gt;&#xA;&lt;h3 id=&#34;new-projects-include-a-unit-testing-target&#34; class=&#34;relative group&#34;&gt;New Projects Include a Unit Testing Target &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#new-projects-include-a-unit-testing-target&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you create a new Cocoa or iOS application project in Xcode 5, you will notice there is no checkbox to include a unit testing target. New Cocoa and iOS application projects automatically include a unit testing target.&lt;/p&gt;&#xA;&lt;p&gt;If you don’t unit test your code, you can delete the unit testing target. Select the project from the project navigator to open the project editor. Select the unit testing target from the target list on the left side of the project editor. Right-click and choose Delete.&lt;/p&gt;&#xA;&lt;h3 id=&#34;xctest&#34; class=&#34;relative group&#34;&gt;XCTest &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#xctest&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 5 introduces a new unit testing framework for Cocoa and Cocoa Touch applications, XCTest. If you used OCUnit in Xcode 4, you should have little trouble using XCTest because OCUnit and XCTest are very similar. The biggest difference is that XCTest assertions start with XCTAssert instead of STAssert. Another change I noticed is that XCTest has no equivalent to the assertions STAssertTrueNoThrow and STAssertFalseNoThrow. If you haven’t used OCUnit, you can read my &lt;a href=&#34;http://meandmark.com/blog/2012/05/introduction-to-unit-testing-with-ocunit/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Introduction to Unit Testing with OCUnit&lt;/a&gt; post to learn more about OCUnit. When reading that post, keep in mind that XCTest test classes do not have a header file.&lt;/p&gt;&#xA;&lt;p&gt;Xcode 5 supports both XCTest and OCUnit, but XCTest is the future of Objective-C unit testing for Mac OS X and iOS. New projects use XCTest. If you are adding a unit testing target to an existing project, I recommend using XCTest unless you need to run unit tests in Xcode 4.&lt;/p&gt;&#xA;&lt;p&gt;If you get a linker error when running your tests that looks similar to the following message:&lt;/p&gt;&#xA;&lt;pre&gt;Undefined symbols for architecture x86_64:&#xA;&#34;_OBJC_CLASS_$_YourClass&#34;&#xA;ld: symbol(s) not found for architecture x86_64&#xA;clang: error: linker command failed with exit code 1 (use -v to see invocation)&lt;/pre&gt;&#xA;&lt;p&gt;Where YourClass is one of the application classes you’re testing, you’ll need to make the application class a member of the unit testing target. Select the .m file from the project navigator. Go to the file inspector. Select the checkbox for the unit testing target in the Target Membership section.&lt;/p&gt;&#xA;&lt;h3 id=&#34;xctest-refactoring-tool&#34; class=&#34;relative group&#34;&gt;XCTest Refactoring Tool &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#xctest-refactoring-tool&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 5 includes a refactoring tool to convert your OCUnit unit tests to XCTest. Choose Edit &amp;gt; Refactor &amp;gt; Convert to XCTest. The refactoring tool converts your OCUnit test target to XCTest and converts your test classes and tests to XCTest.&lt;/p&gt;&#xA;&lt;p&gt;I recommend backing up your project before running the refactoring tool. I had a problem with the beta versions of Xcode 5 where the test navigator showed zero tests after running the refactoring tool, and my tests didn’t run. The problem was fixed in the release version, but I still had the problem in one project. My workaround was to perform the following steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Restore the backup.&lt;/li&gt;&#xA;&lt;li&gt;Delete the old unit testing target from the project.&lt;/li&gt;&#xA;&lt;li&gt;Remove the unit test classes from the project. Remove the file references from the project. Don’t move the files to the Trash.&lt;/li&gt;&#xA;&lt;li&gt;Add a new XCTest target to the project.&lt;/li&gt;&#xA;&lt;li&gt;Add the unit test classes back to the project.&lt;/li&gt;&#xA;&lt;li&gt;Run the refactoring tool.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;assistant-editor&#34; class=&#34;relative group&#34;&gt;Assistant Editor &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#assistant-editor&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The assistant editor in Xcode 5 places your tests and the application code being tested side by side. I haven’t been able to verify this feature, but it is mentioned in the &lt;em&gt;What’s New in Xcode&lt;/em&gt; document (In Xcode choose Help &amp;gt; What’s New In Xcode) in the Testing section.&lt;/p&gt;&#xA;&lt;p&gt;Why haven’t I been able to verify this feature? Xcode 5 crashes a lot when I switch to the assistant editor. When Xcode doesn’t crash, selecting a test from the test navigator doesn’t update the assistant editor with the code being tested. Hopefully you’ll have more success with the assistant editor than I have.&lt;/p&gt;&#xA;&lt;h3 id=&#34;test-after-build&#34; class=&#34;relative group&#34;&gt;Test After Build &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#test-after-build&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 4 had a Test After Build build setting that ran your unit tests after building your projects. Xcode 5 does not support this build setting. If your project sets Test After Build to YES, you should set it to NO, or you will get errors when running tests or running the XCTest refactoring tool.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Project Editor Changes</title>
      <link>https://www.meandmark.com/xcode-5-project-editor-changes/</link>
      <pubDate>Fri, 27 Sep 2013 17:52:59 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-project-editor-changes/</guid>
      <description>&lt;p&gt;I’ve indirectly mentioned changes to the project editor in two previous posts. To keep from repeating myself, I’ve decided to write about the changes to the project editor.&lt;/p&gt;&#xA;&lt;h3 id=&#34;no-buttons-at-the-bottom-of-the-project-editor&#34; class=&#34;relative group&#34;&gt;No Buttons at the Bottom of the Project Editor &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#no-buttons-at-the-bottom-of-the-project-editor&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 5 removed buttons at the bottom of the project editor for doing things like adding build phases and build rules to a target. Use the Editor menu to perform these tasks. When you’re in the project editor, the Editor menu has items to perform the following tasks:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Add a target.&lt;/li&gt;&#xA;&lt;li&gt;Duplicate a build configuration.&lt;/li&gt;&#xA;&lt;li&gt;Add a localization.&lt;/li&gt;&#xA;&lt;li&gt;Add a build setting, conditional or user-defined.&lt;/li&gt;&#xA;&lt;li&gt;Add a build phase to a target.&lt;/li&gt;&#xA;&lt;li&gt;Add a build rule to a target.&lt;/li&gt;&#xA;&lt;li&gt;Validate project settings.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;target-capabilities-section&#34; class=&#34;relative group&#34;&gt;Target Capabilities Section &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#target-capabilities-section&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Cocoa and iOS application targets have a Capabilities section in Xcode 5. Use the Capabilities section to enable and configure support for iCloud, Game Center, keychain sharing, and app sandboxing (Mac only. All iOS apps are sandboxed).&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: New Xib File Format</title>
      <link>https://www.meandmark.com/xcode-5-new-xib-file-format/</link>
      <pubDate>Thu, 26 Sep 2013 17:56:33 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-new-xib-file-format/</guid>
      <description>&lt;p&gt;Xcode 5 introduces a new xib file format that works better with version control. New Xcode 5 projects use the new file format. If you have an existing project, selecting the xib file from the project navigator should prompt you with an alert asking if you want to upgrade the xib file to the new format. If you don’t get the alert, you can switch to the new file format by opening the xib file’s file inspector and choosing 5.0 from the Opens in menu.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/09/Xcode5-Use-New-Xib-File-Format.png&#34; alt=&#34;Xcode5 Use New Xib File Format&#34; width=&#34;245&#34; height=&#34;114&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Xib files that use the new file format will not open in Xcode 4. Choose 4.6 from the Opens in menu if you need to open the xib file in Xcode 4.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Reading Documentation</title>
      <link>https://www.meandmark.com/xcode-5-reading-documentation/</link>
      <pubDate>Wed, 25 Sep 2013 18:28:37 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-reading-documentation/</guid>
      <description>&lt;h3 id=&#34;update-october-22-2013&#34; class=&#34;relative group&#34;&gt;Update: October 22, 2013 &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update-october-22-2013&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Apple made some changes to the documentation viewer in Xcode 5.0.1. I have updated the post for Xcode 5.0.1.&lt;/p&gt;&#xA;&lt;h3 id=&#34;documentation-window&#34; class=&#34;relative group&#34;&gt;Documentation Window &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#documentation-window&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;In Xcode 5 the documentation viewer has been moved from the Organizer to its own window. Choose Help &amp;gt; Documentation and API Reference to open the documentation window.&lt;/p&gt;&#xA;&lt;p&gt;The documentation window has three main sections. On the left side is the documentation browser/bookmark list. Use the buttons at the top to switch from the documentation browser to the bookmark list and back again.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/10/Xcode-5-Documentation-Browser.png&#34; alt=&#34;Xcode 5 Documentation Browser&#34; width=&#34;325&#34; height=&#34;82&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;The right side shows the documentation. Right-click on the documentation and choose Add Bookmark to add the current document to the bookmark list. Some documents have a gray bookmark icon next to each section, which you can see in the following screenshot: &lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/10/Documentation-Bookmark-Icon.png&#34; alt=&#34;Documentation Bookmark Icon&#34; width=&#34;411&#34; height=&#34;48&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Click the bookmark icon to add a bookmark for that section of the document. The bookmark icon will turn red after clicking the icon. Use drag and drop to rearrange the items in the bookmark list.&lt;/p&gt;&#xA;&lt;p&gt;Between the bookmark list and the documentation is the table of contents for the document you’re reading. Selecting an item from the table of contents takes you to that section of the document. At the top of the documentation window is a text field for searching. To the left of the text field are buttons to show and hide the bookmark list and table of contents. The Editor menu in the menu bar has items to zoom the text.&lt;/p&gt;&#xA;&lt;h3 id=&#34;searching-documentation&#34; class=&#34;relative group&#34;&gt;Searching Documentation &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#searching-documentation&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Use the text field at the top of the documentation window to search the documentation. As you type a search term, a sheet opens with a list of search results separated into the following categories: Top Hit, API Reference, Guides, and Sample Code. Select a search result to go to the documentation for the search result. At the bottom of the sheet is an item called Show All Results. Choosing this option shows all the search results in the documentation viewer.&lt;/p&gt;&#xA;&lt;p&gt; &lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/09/Xcode-5-Documentation-Search-Results.png&#34; alt=&#34;Xcode 5 Documentation Search Results&#34; width=&#34;360&#34; height=&#34;300&#34; border=&#34;0&#34; /&gt;&lt;/p&gt;&#xA;&lt;p&gt; &lt;/p&gt;&#xA;&lt;p&gt;On the left side of the search field is a magnifying glass that lets you control the documentation sets to search.&lt;/p&gt;&#xA;&lt;h3 id=&#34;sharing-documentation&#34; class=&#34;relative group&#34;&gt;Sharing Documentation &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#sharing-documentation&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To the right of the search field is the Share button. Click the Share button to bookmark the current document, read the current document in Safari, or read the PDF version of the current document.&lt;/p&gt;&#xA;&lt;h3 id=&#34;tabs&#34; class=&#34;relative group&#34;&gt;Tabs &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#tabs&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 5’s documentation window supports tabs. Choose View &amp;gt; Show Tab Bar to show the tab bar. Click the + button to add a tab. You can also open documents in a new tab by right-clicking a bookmark or a link in the documentation and choosing Open in New Tab.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-apple-removed&#34; class=&#34;relative group&#34;&gt;What Apple Removed &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#what-apple-removed&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 5 removed support for installing third-party documentation sets. I haven’t tried installing third-party documentation sets, but the Xcode 5 release notes say you can manually install documentation sets by copying them to the following directory:&lt;/p&gt;&#xA;&lt;pre&gt;~/Library/Developer/Shared/Documentation/DocSets&lt;/pre&gt;</description>
    </item>
    <item>
      <title>Xcode 5: Adding Conditional and User-Defined Build Settings</title>
      <link>https://www.meandmark.com/xcode-5-adding-conditional-and-user-defined-build-settings/</link>
      <pubDate>Tue, 24 Sep 2013 18:33:05 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-adding-conditional-and-user-defined-build-settings/</guid>
      <description>&lt;p&gt;If you look at your project’s build settings in Xcode 5, you will see there is no button at the bottom of the project editor to add conditional and user-defined build settings. How do you add conditional and user-defined build settings in Xcode 5?&lt;/p&gt;&#xA;&lt;p&gt;Choose Editor &amp;gt; Add Build Setting. The Add Build Setting menu item has submenus to add conditional and user-defined build settings. You must be viewing your project’s build settings in the project editor or the menu items to add build settings will be disabled.&lt;/p&gt;&#xA;&lt;p&gt;If you are new to Xcode and don’t know how to access your project’s build settings, read the following post:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://meandmark.com/blog/2011/03/xcode-4-accessing-build-settings/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 4: Accessing Build Settings&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Accessing build settings didn’t change in Xcode 5.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Version Control Changes</title>
      <link>https://www.meandmark.com/xcode-5-version-control-changes/</link>
      <pubDate>Mon, 23 Sep 2013 18:20:20 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-version-control-changes/</guid>
      <description>&lt;p&gt;This post covers the changes in version control support in Xcode 5. If you need more detailed information on Xcode’s version control features, read the version control chapter of my Xcode book, which you can download at the &lt;a href=&#34;http://www.meandmark.com/xcodebook.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;book’s site&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;version-control-features-removed-from-organizer&#34; class=&#34;relative group&#34;&gt;Version Control Features Removed from Organizer &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#version-control-features-removed-from-organizer&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you open the Organizer in Xcode 5, you’ll notice there is no Repositories button at the top of the window. Where did the version control features go?&lt;/p&gt;&#xA;&lt;h3 id=&#34;use-the-source-control-menu-to-perform-most-version-control-tasks&#34; class=&#34;relative group&#34;&gt;Use the Source Control Menu to Perform Most Version Control Tasks &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#use-the-source-control-menu-to-perform-most-version-control-tasks&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 5 adds a Source Control menu to the menu bar. The Source Control menu has menu items to perform most version control tasks, including committing changes, creating branches, switching branches, merging, pushing, pulling, and checking the version control history of your project.&lt;/p&gt;&#xA;&lt;h3 id=&#34;commit-and-push&#34; class=&#34;relative group&#34;&gt;Commit and Push &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#commit-and-push&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 5 allows you to push your changes to a remote repository when you commit. Do a commit, and a sheet opens for you to enter a commit message. In the lower left corner of the sheet is a Push to remote: checkbox. Select that checkbox, choose a remote branch, and click the Commit button to push your changes to a remote repository.&lt;/p&gt;&#xA;&lt;h3 id=&#34;use-xcode8217s-accounts-preferences-to-add-existing-repositories&#34; class=&#34;relative group&#34;&gt;Use Xcode’s Accounts Preferences to Add Existing Repositories &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#use-xcode8217s-accounts-preferences-to-add-existing-repositories&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode’s Accounts preferences show your repositories. Click the + button to add an existing repository.&lt;/p&gt;&#xA;&lt;h3 id=&#34;accessing-the-version-editor8217s-blame-and-log-views&#34; class=&#34;relative group&#34;&gt;Accessing the Version Editor’s Blame and Log Views &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#accessing-the-version-editor8217s-blame-and-log-views&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 5 removed the buttons at the bottom of the version editor to switch to the blame and log views. The version editor button in the toolbar has a menu to switch to the blame or log view. You can also switch views by choosing View &amp;gt; Version Editor and choosing the appropriate submenu.&lt;/p&gt;&#xA;&lt;h3 id=&#34;disabling-xcode8217s-source-control&#34; class=&#34;relative group&#34;&gt;Disabling Xcode’s Source Control &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#disabling-xcode8217s-source-control&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Those of you who use the command line or a third-party app for version control will appreciate this feature. Xcode 5 allows you to disable its source control tracking. Open Xcode’s Source Control preferences and deselect the Enable Source Control checkbox.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Breakpoints Button</title>
      <link>https://www.meandmark.com/xcode-5-breakpoints-button/</link>
      <pubDate>Fri, 20 Sep 2013 19:02:37 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-breakpoints-button/</guid>
      <description>&lt;p&gt;Xcode 4 had a Breakpoints button in the toolbar to toggle running and debugging your project. But there is no Breakpoints button in Xcode 5’s project window toolbar. Where did the Breakpoints button go?&lt;/p&gt;&#xA;&lt;p&gt;It moved to the debug bar, as you can see in the following screenshot:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/09/Xcode-5-Debug-Bar.png&#34; alt=&#34;Xcode 5 Debug Bar&#34; width=&#34;187&#34; height=&#34;22&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;The Breakpoints button is the blue button in the screenshot. Click it to toggle running and debugging your project. The Breakpoints button is blue for debugging and gray for running.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5: Adding Build Phases</title>
      <link>https://www.meandmark.com/xcode-5-adding-build-phases/</link>
      <pubDate>Thu, 19 Sep 2013 18:00:04 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-adding-build-phases/</guid>
      <description>&lt;p&gt;If you open the project editor in Xcode 5, you will notice there is no button to add a build phase to a target. Choose Editor &amp;gt; Add Build Phase to add a build phase to a target.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 5 Is Available</title>
      <link>https://www.meandmark.com/xcode-5-is-available/</link>
      <pubDate>Thu, 19 Sep 2013 02:55:23 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-5-is-available/</guid>
      <description>&lt;p&gt;Xcode 5 is now available to download from the Mac App Store. This news means I can write about Xcode 5 now. I won’t be updating &lt;a href=&#34;http://www.meandmark.com/xcodebook.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;the book&lt;/a&gt; for Xcode 5, but I will be writing posts on this blog about what’s new and what’s changed in Xcode 5 over the new few weeks. These posts will be tagged xcode 5.&lt;/p&gt;&#xA;&lt;p&gt;I don’t have a second Mac to use as a continuous integration server, and I don’t have Mac OS X Server so I can’t use the continuous integration bots that were added in Xcode 5. You’ll have to look elsewhere for information on using bots. One place to start is with Apple’s &lt;em&gt;Xcode Continuous Integration Guide&lt;/em&gt;, which is part of the Xcode documentation.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating an OpenGL Context in SDL 2</title>
      <link>https://www.meandmark.com/creating-an-opengl-context-in-sdl2/</link>
      <pubDate>Tue, 18 Jun 2013 18:52:11 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-an-opengl-context-in-sdl2/</guid>
      <description>&lt;p&gt;SDL 2.0 has been released, which changes the way you create OpenGL contexts. This post details the changes so you can convert your old SDL/OpenGL code to SDL 2. If you are new to SDL and OpenGL, you should also read my &lt;a href=&#34;http://www.meandmark.com/sdlopenglpart1.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;SDL and OpenGL article&lt;/a&gt;, as that article covers some topics that aren’t covered here, such as initializing SDL.&lt;/p&gt;&#xA;&lt;h3 id=&#34;data-types&#34; class=&#34;relative group&#34;&gt;Data Types &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#data-types&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To create an OpenGL context with SDL 2, you need to be aware of two new SDL data types: SDL_Window and SDL_GLContext. As the type names indicate, SDL_WIndow is a window, and SDL_GLContext is an OpenGL context. To create an OpenGL context with SDL 2, you must create a window, then create a context. The code to do this comes later, but for now, what you need to know is that your game needs variables to store the window and OpenGL context.&lt;/p&gt;&#xA;&lt;pre&gt;SDL_Window* mainWindow;&#xA;SDL_GLContext mainGLContext;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;window-flags&#34; class=&#34;relative group&#34;&gt;Window Flags &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#window-flags&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you create an SDL window, you must supply flags that describe the type of window you want to create. The following are common flags to use:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;SDL_WINDOW_OPENGL creates an OpenGL window. This flag is mandatory if you want to use OpenGL with SDL 2.&lt;/li&gt;&#xA;&lt;li&gt;SDL_WINDOW_FULLSCREEN creates a fullscreen window.&lt;/li&gt;&#xA;&lt;li&gt;SDL_WINDOW_RESIZABLE creates a resizable window.&lt;/li&gt;&#xA;&lt;li&gt;SDL_WINDOW_SHOWN makes the window visible when the game loads.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Use the bitwise OR operator (|) to combine multiple flags.&lt;/p&gt;&#xA;&lt;h3 id=&#34;creating-the-window-and-opengl-context&#34; class=&#34;relative group&#34;&gt;Creating the Window and OpenGL Context &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#creating-the-window-and-opengl-context&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Call the function SDL_CreateWindow() to create a window. The function takes the following arguments:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The window title.&lt;/li&gt;&#xA;&lt;li&gt;The x position of the window.&lt;/li&gt;&#xA;&lt;li&gt;The y position of the window. If you don’t need the window to be in a specific position, you can supply the value SDL_WINDOWPOS_UNDEFINED for the x and y position.&lt;/li&gt;&#xA;&lt;li&gt;The width of the window.&lt;/li&gt;&#xA;&lt;li&gt;The height of the window.&lt;/li&gt;&#xA;&lt;li&gt;The window flags that I covered in the previous section.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;After creating the window, call the function SDL_GL_CreateContext() to create the OpenGL context. Supply the SDL window you created by calling SDL_CreateWindow(). The following code creates a 1024 by 768 pixel window and OpenGL context:&lt;/p&gt;&#xA;&lt;pre&gt;Uint32 flags = SDL_WINDOW_SHOWN|SDL_WINDOW_OPENGL;&#xA;int width = 1024;&#xA;int height = 768;&#xA;&#xA;mainWindow = SDL_CreateWindow(&#34;SDL2 OpenGL Example&#34;, SDL_WINDOWPOS_UNDEFINED,&#xA;&#x9;SDL_WINDOWPOS_UNDEFINED, width, height, flags);&#xA;mainGLContext = SDL_GL_CreateContext(mainWindow);&lt;/pre&gt;&#xA;&lt;h3 id=&#34;double-buffering&#34; class=&#34;relative group&#34;&gt;Double Buffering &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#double-buffering&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Most OpenGL games use double buffered drawing. When using double buffering, OpenGL erases the old scene and draws the new scene offscreen so the player doesn’t see the erasing and redrawing. After drawing the scene offscreen, swap the buffers to make the newly drawn scene appear on the screen. Call the function SDL_GL_SwapWindow() in your scene drawing code to swap the buffers in SDL 2, supplying the SDL window you created.&lt;/p&gt;&#xA;&lt;pre&gt;SDL_GL_SwapWindow(mainWindow);&lt;/pre&gt;&#xA;&lt;h3 id=&#34;cleaning-up&#34; class=&#34;relative group&#34;&gt;Cleaning Up &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#cleaning-up&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Call the function SDL_GL_DeleteContext() to delete the OpenGL context you created. Call the function SDL_DestroyWindow() to destroy the SDL window you created.&lt;/p&gt;&#xA;&lt;pre&gt;SDL_GL_DeleteContext(mainGLContext);&#xA;SDL_DestroyWindow(mainWindow);&lt;/pre&gt;&#xA;&lt;h3 id=&#34;source-code&#34; class=&#34;relative group&#34;&gt;Source Code &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#source-code&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I have a small sample program &lt;a href=&#34;https://github.com/meandmark/SDLOpenGLIntro/tree/sdl2&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;on Github&lt;/a&gt; that creates an OpenGL context and draws a rectangle. Look at the sdl2 branch for the SDL 2 code.&lt;/p&gt;&#xA;&lt;p&gt; &lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode Ebook Now Free</title>
      <link>https://www.meandmark.com/xcode-ebook-now-free/</link>
      <pubDate>Tue, 28 May 2013 18:43:55 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-ebook-now-free/</guid>
      <description>&lt;p&gt;The electronic version of &lt;a href=&#34;http://www.meandmark.com/xcodebook.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode Tools Sensei&lt;/a&gt; is now free to download. Why am I doing this?&lt;/p&gt;&#xA;&lt;p&gt;WWDC is coming soon, which most likely means Apple will be showcasing a new version of Xcode to the people at the conference. With my eye surgery reducing my computer time, I’m not sure when I would be able to update the book for the new version of Xcode. Instead of stringing you along for months on whether or not I would be able to update the book, I decided to make the electronic version of the book free so everyone could have access to current information on Xcode 4 while it’s still current.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Site Redesign</title>
      <link>https://www.meandmark.com/site-redesign/</link>
      <pubDate>Wed, 15 May 2013 19:23:46 +0000</pubDate>
      <guid>https://www.meandmark.com/site-redesign/</guid>
      <description>&lt;p&gt;I rebuilt &lt;a href=&#34;http://www.meandmark.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;my site&lt;/a&gt; using the &lt;a href=&#34;http://twitter.github.io/bootstrap/index.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Twitter Bootstrap framework&lt;/a&gt;. Code listings should be easier to read now, and the site should be easier to read on tablets and smartphones.&lt;/p&gt;&#xA;&lt;p&gt;The downside is that the blog currently does not match the new look of the rest of the site. I had a WordPress theme that came close to matching the look of the site, but it had two problems. First, going to the blog froze the browser when I tested it on Internet Explorer 7. Second, I couldn’t submit comments, even when I was logged in as the administrator of this blog. So for now I’m using one of the default WordPress themes.&lt;/p&gt;&#xA;&lt;h3 id=&#34;update-may-21&#34; class=&#34;relative group&#34;&gt;Update (May 21) &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update-may-21&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I created a custom WordPress theme that looks similar to the rest of my site, including the navbar. The theme is bare bones, but it supports the most common actions. Plus, it doesn’t have the problems I had with the other theme. I can load the blog in Internet Explorer 7. I can submit comments using Safari, Chrome, Firefox, and Camino on Mac OS X, Internet Explorer 7 and Firefox on Vista, Internet Explorer 10 on Windows 8, and Firefox on Linux Mint.&lt;/p&gt;&#xA;&lt;p&gt;The theme is still a work in progress. The two biggest problems are the following: First, some multi-line code listings show up as a series of one-line code blocks instead of one large block. Second, if you’re signed in to WordPress, there is some whitespace above the navbar when viewing the blog.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Detached Retina</title>
      <link>https://www.meandmark.com/detached-retina/</link>
      <pubDate>Sun, 03 Feb 2013 19:40:08 +0000</pubDate>
      <guid>https://www.meandmark.com/detached-retina/</guid>
      <description>&lt;p&gt;I have a detached retina in my right eye. I’m having surgery for it this week. The surgery will reduce my computer time for the next several weeks, which means it will take longer than normal for me to reply to emails, approve blog comments from first-time commenters, and reply to blog comments.&lt;/p&gt;&#xA;&lt;p&gt;I will either remove or update this post when things return to normal.&lt;/p&gt;&#xA;&lt;h3 id=&#34;update-april-25&#34; class=&#34;relative group&#34;&gt;Update (April 25) &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update-april-25&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Things haven’t returned to normal yet, but my condition has improved enough that I can check my email at least once a day and I can be on the computer for 30-45 minutes at a time. I should be able to reply to emails and deal with blog comments within 24 hours. I’ll post another update when things return to normal.&lt;/p&gt;&#xA;&lt;p&gt;At this point I’ve recovered from the surgery. All that’s left is for the vision to return in my right eye. The vision is returning, slowly but surely.&lt;/p&gt;&#xA;&lt;h3 id=&#34;update-june-26&#34; class=&#34;relative group&#34;&gt;Update (June 26) &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update-june-26&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;My condition has improved to the point that I can reply to emails and deal with blog comments like I did before the surgery.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4.6</title>
      <link>https://www.meandmark.com/xcode-4-6/</link>
      <pubDate>Sun, 03 Feb 2013 19:30:10 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-6/</guid>
      <description>&lt;p&gt;Xcode 4.6 is out. After using it for a few days and reading the release notes, I didn’t notice anything in the update that affected the content in the book much. The biggest changes are the following: the debugger can now show the contents of NSArray and NSDictionary objects, LLDB adds support for temporary breakpoints, and the static analyzer can find more problems in your code.&lt;/p&gt;&#xA;&lt;p&gt;If you are using LLVM GCC as your compiler or GDB as your debugger, keep in mind that Xcode 4.6 is the last major version that will include LLVM GCC and GDB. That’s Apple’s way of telling you to migrate your projects to LLVM and LLDB.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>GL_QUADS Replacement</title>
      <link>https://www.meandmark.com/gl_quads-replacement/</link>
      <pubDate>Thu, 24 Jan 2013 20:45:08 +0000</pubDate>
      <guid>https://www.meandmark.com/gl_quads-replacement/</guid>
      <description>&lt;p&gt;When writing a 2D game in OpenGL, you generally draw texture-mapped quads. The most straightforward way to draw a texture-mapped quad with vertex arrays is to supply GL_QUADS as the first argument to glDrawArrays(). But GL_QUADS is not available on OpenGL ES so if you want to port your game to mobile devices you can’t use GL_QUADS. Also, GL_QUADS was deprecated in OpenGL 3 so using GL_QUADS is not wise if you’re writing a new OpenGL application. What is the replacement for GL_QUADS?&lt;/p&gt;&#xA;&lt;p&gt;The simplest replacement is to use GL_TRIANGLES. If you look at the following figure:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2013/01/Quad-Example1.png&#34; alt=&#34;Quad Example&#34; width=&#34;256&#34; height=&#34;256&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;You can see that drawing a line from A to D (or from B to C) splits the rectangle into two triangles. Add the vertices for the two triangles and use GL_TRIANGLES to draw the quad.&lt;/p&gt;&#xA;&lt;p&gt;The downside of using GL_TRIANGLES is that it requires six vertices to draw a quad instead of four. How you order the vertices is up to you, but the following order works for me:&lt;/p&gt;&#xA;&lt;p&gt;Vertex 1: C (lower left)&lt;/p&gt;&#xA;&lt;p&gt;Vertex 2: A (upper left)&lt;/p&gt;&#xA;&lt;p&gt;Vertex 3: D (lower right)&lt;/p&gt;&#xA;&lt;p&gt;Vertex 4: D (lower right)&lt;/p&gt;&#xA;&lt;p&gt;Vertex 5: B (upper right)&lt;/p&gt;&#xA;&lt;p&gt;Vertex 6: A (upper left)&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>CocoaPods</title>
      <link>https://www.meandmark.com/cocoapods/</link>
      <pubDate>Wed, 16 Jan 2013 20:56:30 +0000</pubDate>
      <guid>https://www.meandmark.com/cocoapods/</guid>
      <description>&lt;p&gt;I recently attended a &lt;a href=&#34;http://www.meetup.com/Cleveland-CocoaHeads/events/98186482/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Cocoaheads meeting&lt;/a&gt; where I was introduced to &lt;a href=&#34;http://cocoapods.org/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;CocoaPods&lt;/a&gt;. Since many of the people who read this blog develop Mac and iOS software, I figured I should share what I learned. Keep in mind I haven’t used CocoaPods yet so I can’t answer any questions on the technical details. Go to the &lt;a href=&#34;http://cocoapods.org/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;CocoaPods&lt;/a&gt; site to learn more.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-is-cocoapods&#34; class=&#34;relative group&#34;&gt;What Is CocoaPods? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#what-is-cocoapods&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;CocoaPods is a library dependency manager, which is a fancy way of saying it manages the libraries your app uses. If you’ve ever programmed in Ruby, you can think of CocoaPods as the Objective-C equivalent of Ruby gems.&lt;/p&gt;&#xA;&lt;p&gt;Why should you care about CocoaPods? If your app uses third-party libraries and frameworks (anything other than Apple’s frameworks), CocoaPods makes working with those libraries and frameworks easier. Using third-party libraries without CocoaPods involves either cloning online repositories or downloading and installing the libraries manually. Both of these approaches make updating more difficult.&lt;/p&gt;&#xA;&lt;h3 id=&#34;using-cocoapods-with-your-xcode-project&#34; class=&#34;relative group&#34;&gt;Using CocoaPods with Your Xcode Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#using-cocoapods-with-your-xcode-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To use CocoaPods with an Xcode project you must create a pod file and add it to your project. The pod file is a text file named Podfile that contains the libraries your project is going to use. The following example from the CocoaPods site shows a simple pod file for an iOS app:&lt;/p&gt;&#xA;&lt;pre&gt;platform :ios&lt;br /&gt;pod &#39;JSONKit&#39;, &#39;~&amp;gt; 1.4&#39;&lt;br /&gt;pod &#39;Reachability&#39;, &#39;~&amp;gt; 3.0.0&#39;&lt;/pre&gt;&#xA;&lt;p&gt;In this example the project depends on version 1.4 of the JSONKit library and version 3.0.0 of the Reachability library.&lt;/p&gt;&#xA;&lt;p&gt;After creating the pod file, run the following command to install the dependencies:&lt;/p&gt;&#xA;&lt;pre&gt;pod install&lt;/pre&gt;&#xA;&lt;p&gt;Running the pod install command creates an Xcode workspace for your project that contains the dependencies. Open the workspace (not the project) to work on your project. In the Cocoaheads meeting I attended, the example used the Facebook SDK. Running the pod install command added the Facebook SDK to the workspace without having to install the SDK. Very cool. If you use open source libraries and frameworks in your Mac and iOS apps, you should check out CocoaPods.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode Print Book Updated for Xcode 4.5</title>
      <link>https://www.meandmark.com/xcode-print-book-updated-for-xcode-4-5/</link>
      <pubDate>Mon, 29 Oct 2012 17:45:12 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-print-book-updated-for-xcode-4-5/</guid>
      <description>&lt;p&gt;The print version of my Xcode book has been updated for Xcode 4.5. You can buy it directly from the &lt;a style=&#34;font-family: &#39;Lucida Grande&#39;;&#34; href=&#34;http://www.meandmark.com/xcodebook.html&#34;&gt;book’s website&lt;/a&gt;. It is also available on Amazon, Amazon UK, and Amazon Europe.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode Ebook Updated for Xcode 4.5</title>
      <link>https://www.meandmark.com/xcode-ebook-updated-for-xcode-4-5/</link>
      <pubDate>Mon, 01 Oct 2012 17:50:47 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-ebook-updated-for-xcode-4-5/</guid>
      <description>&lt;p&gt;&lt;span style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;I have updated the electronic version of my Xcode book for Xcode 4.5 and iOS 6. If you bought the electronic version of the Second Edition (the Xcode 4 version) and signed up for the mailing list, you should get an email with a link to download the updated version. Go to the &lt;/span&gt;&lt;a style=&#34;font-family: &#39;Lucida Grande&#39;;&#34; href=&#34;http://www.meandmark.com/xcodebook.html&#34;&gt;book’s website&lt;/a&gt;&lt;span style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt; to buy the electronic version and to view an updated table of contents, introduction, and first chapter.&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;The print version’s a few weeks away from being released. I have to update the index for the new material in the book, and that takes time.&lt;/span&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4.5 Changes</title>
      <link>https://www.meandmark.com/xcode-4-5-changes/</link>
      <pubDate>Thu, 20 Sep 2012 19:10:03 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-5-changes/</guid>
      <description>&lt;p&gt;Xcode 4.5 is now available at the Mac App Store. This post provides a brief explanation of the changes I noticed in Xcode 4.5 that affect the material in the book. Most of the changes in Xcode 4.5 apply to iOS projects.&lt;/p&gt;&#xA;&lt;h3 id=&#34;auto-layout&#34; class=&#34;relative group&#34;&gt;Auto Layout &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#auto-layout&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 4.5 adds support for auto layout to iOS applications. New projects have auto layout enabled. If you don’t want to use auto layout, open the file inspector and deselect the Use Autolayout checkbox.&lt;/p&gt;&#xA;&lt;p&gt;When using auto layout, the lower right corner of the canvas has three buttons. The left button aligns items. It is the equivalent of choosing Editor &amp;gt; Align. The center button pins items. It is the equivalent of choosing Editor &amp;gt; Pin. The right button lets you control how constraints are applied when resizing views.&lt;/p&gt;&#xA;&lt;h3 id=&#34;interface-builder&#34; class=&#34;relative group&#34;&gt;Interface Builder &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#interface-builder&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The Objects and Controllers section of the Object Library has a collection view controller. Adding a collection view controller also adds a collection view to the xib file. The Data Views section of the Object Library has a collection view, a collection view cell, and a collection reusable view.&lt;/p&gt;&#xA;&lt;p&gt;Modal segues in storyboards have an Animates checkbox that lets you determine if modal segues should be animated.&lt;/p&gt;&#xA;&lt;h3 id=&#34;target-summary&#34; class=&#34;relative group&#34;&gt;Target Summary &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#target-summary&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The target summary for iOS projects has a Status Bar section that lets you control the appearance of the status bar. &lt;/p&gt;&#xA;&lt;p&gt;The iCloud Containers table is now called Ubiquity Containers.&lt;/p&gt;&#xA;&lt;p&gt;There is a Maps Integration section for iOS projects. It controls what modes of transportation to use when generating directions.&lt;/p&gt;&#xA;&lt;h3 id=&#34;deployment-targets&#34; class=&#34;relative group&#34;&gt;Deployment Targets &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#deployment-targets&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The earliest deployment target for iOS projects is iOS 4.3.&lt;/p&gt;&#xA;&lt;h3 id=&#34;architectures&#34; class=&#34;relative group&#34;&gt;Architectures &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#architectures&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode standard configuration for iOS projects is to build for armv7 and armv7s, which the iPhone 5 uses. You cannot build for armv6 with Xcode 4.5.&lt;/p&gt;&#xA;&lt;h3 id=&#34;organizer&#34; class=&#34;relative group&#34;&gt;Organizer &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#organizer&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you click the Devices button at the top of the Organizer and select the Device Logs section, the bottom of the Organizer has buttons to import, export, and resymbolicate a crash log.&lt;/p&gt;&#xA;&lt;p&gt;There is now a Teams section on the left side of the Organizer if you click the Devices button. The Teams section replaces the Developer Profile item. &lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Changing a Project’s Class Prefix</title>
      <link>https://www.meandmark.com/xcode-4-changing-a-projects-class-prefix/</link>
      <pubDate>Thu, 13 Sep 2012 18:53:16 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-changing-a-projects-class-prefix/</guid>
      <description>&lt;p&gt;When you create a Cocoa or iOS application project, the New Project Assistant has a Class Prefix text field that lets you assign a prefix to class files you create. An example of a prefix is the NS prefix in Cocoa classes. But there are situations where you may need to change the prefix. You make a mistake entering the prefix, or you don’t create a prefix when creating the project, but decide later you want one. How do you change the prefix after creating the project?&lt;/p&gt;&#xA;&lt;p&gt;You can change the class prefix by selecting the project from the project navigator and opening the file inspector.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/09/ClassPrefix.png&#34; alt=&#34;ClassPrefix&#34; width=&#34;256&#34; height=&#34;92&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;I know the Class Prefix field exists in Xcode 4.4. I’m not sure if it exists in Xcode 4.2 and 4.3. The Class Prefix applies only to Objective-C classes. If you enter a class prefix and add a C++ class to the project, Xcode ignores the class prefix you entered.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4.4: Editing 3D Scenes</title>
      <link>https://www.meandmark.com/xcode-4-4-editing-3d-scenes/</link>
      <pubDate>Thu, 06 Sep 2012 19:03:57 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-4-editing-3d-scenes/</guid>
      <description>&lt;p&gt;One of the new features in Xcode 4.4 involves viewing and editing 3D scenes in Xcode. This feature didn’t fit into any of the book’s chapters so I’m providing an introduction to Xcode’s scene editor here.&lt;/p&gt;&#xA;&lt;p&gt;You must be running Mac OS X 10.8 or later to edit scenes. Mac OS X 10.7 users can only view 3D scenes.&lt;/p&gt;&#xA;&lt;h3 id=&#34;preliminary-details&#34; class=&#34;relative group&#34;&gt;Preliminary Details &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#preliminary-details&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To edit a 3D scene you must create the scene in a 3D modeling program. In the 3D modeling program export the file as a COLLADA file, which has the extension .dae. Add the COLLADA file to your project. Select the COLLADA file in the project navigator to view and edit the file in Xcode.&lt;/p&gt;&#xA;&lt;h3 id=&#34;scene-editor&#34; class=&#34;relative group&#34;&gt;Scene Editor &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#scene-editor&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/09/3D-Scene-Editor.png&#34; alt=&#34;3D Scene Editor&#34; width=&#34;600&#34; height=&#34;305&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;As you can see in the screenshot, the scene editor is similar to Interface Builder’s object list and canvas. On the left side of the editor is the entities list and the scene graph list that contain the objects in the scene. On the right side is the viewport, which shows the scene. Selecting an object from the scene graph list highlights it in the viewport. Clicking on an object in the viewport, holding the mouse button down, and moving the mouse rotates the object so you can view it at different angles. At the bottom is the animation preview controller, which lets you play animations.&lt;/p&gt;&#xA;&lt;p&gt;If you want to edit the scene, you should have the utilities view open. Xcode has three inspectors for 3D scenes: node inspector, attributes inspector, and material inspector.&lt;/p&gt;&#xA;&lt;h3 id=&#34;entities-list&#34; class=&#34;relative group&#34;&gt;Entities List &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#entities-list&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The entities list has the following folders:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Geometries&lt;/li&gt;&#xA;&lt;li&gt;Materials&lt;/li&gt;&#xA;&lt;li&gt;Cameras&lt;/li&gt;&#xA;&lt;li&gt;Lights&lt;/li&gt;&#xA;&lt;li&gt;Animations (animation frames)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Click the disclosure triangle next to a folder to examine and edit individual items. There will be no disclosure triangle next to a folder if it has no items.&lt;/p&gt;&#xA;&lt;h3 id=&#34;node-inspector&#34; class=&#34;relative group&#34;&gt;Node Inspector &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#node-inspector&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To use the node inspector you must select an element from the scene graph list. Use the node inspector to position, rotate, and scale the element. The node inspector also lets you set a scene graph element’s opacity, visibility, and rendering order.&lt;/p&gt;&#xA;&lt;h3 id=&#34;attributes-inspector&#34; class=&#34;relative group&#34;&gt;Attributes Inspector &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#attributes-inspector&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Like Interface Builder’s attributes inspector, what you can set in the attributes inspector depends on the entity you select. For a camera the attributes inspector lets you set the projection, the field of view, and the near and far clipping planes. For a geometric object the attributes inspector tells you the number of vertices and polygons. For a light the attributes inspector lets you specify the type of light, the color of the light, and its attenuation. Animation frames and materials do not use the attributes inspector, as far as I can tell.&lt;/p&gt;&#xA;&lt;h3 id=&#34;material-inspector&#34; class=&#34;relative group&#34;&gt;Material Inspector &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#material-inspector&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Select a material from the entities list to use the material inspector. Use the material inspector to set a material’s transparency, shininess, lighting model, and visibility. Some materials have a Properties section in the material inspector, which you can see in the following screenshot:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/09/Material-Properties.png&#34; alt=&#34;Material Properties&#34; width=&#34;256&#34; height=&#34;230&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Each property has two buttons on the right side. The color button is initially selected, as you can see in the screenshot. Click the color well next to a property to set the color for the property. Clicking the other button allows you to set filters, wrapping modes, and a UV channel for the property. It also allows you to set an image for a property. Click the color well. An Open panel opens. Select an image file and click the Choose button.&lt;/p&gt;&#xA;&lt;h3 id=&#34;additional-information&#34; class=&#34;relative group&#34;&gt;Additional Information &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#additional-information&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode’s 3D scene editing works with the Scene Kit framework. Read the &lt;em&gt;Scene Kit Programming Guide&lt;/em&gt; and &lt;em&gt;Scene Kit Framework Reference&lt;/em&gt; to learn more about Scene Kit. Both documents are part of Apple’s Mac documentation.&lt;/p&gt;&#xA;&lt;p&gt;Jeff LaMarche has written &lt;a href=&#34;http://iphonedevelopment.blogspot.com/2012/08/an-introduction-to-scenekit.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;an article introducing Scene Kit&lt;/a&gt; that should help anyone interested in learning Scene Kit.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode Ebook Updated for Xcode 4.4</title>
      <link>https://www.meandmark.com/xcode-ebook-updated-for-xcode-4-4/</link>
      <pubDate>Tue, 04 Sep 2012 23:19:31 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-ebook-updated-for-xcode-4-4/</guid>
      <description>&lt;p&gt;I have updated the electronic version of my Xcode book for Xcode 4.4 and Mountain Lion. If you bought the electronic version of the Second Edition (the Xcode 4 version) and signed up for the mailing list, you should get an email with a link to download the updated version. Go to the &lt;a href=&#34;http://www.meandmark.com/xcodebook.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;book’s website&lt;/a&gt; to buy the electronic version and to view an updated table of contents, introduction, and first chapter.&lt;/p&gt;&#xA;&lt;p&gt;I will not be updating the print version for Xcode 4.4. I feel Xcode 4.5 will be released before I can update the print version so I may as well wait for Xcode 4.5 to come out. Those of you who bought the print version can find a document on the &lt;a href=&#34;http://www.meandmark.com/xcodebook.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;book’s website&lt;/a&gt; that describes the changes I made when I updated the book for Xcode 4.4.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Generating Code Coverage Files with LLVM</title>
      <link>https://www.meandmark.com/xcode-4-generating-code-coverage-files-with-llvm/</link>
      <pubDate>Fri, 24 Aug 2012 18:22:34 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-generating-code-coverage-files-with-llvm/</guid>
      <description>&lt;p&gt;With Apple transitioning from GCC to LLVM, one thing that was lost was support for code coverage, which measures how much of your code executed when running. But I discovered in a thread on Apple paid developer forums that LLVM now has code coverage support. Setting up Xcode to generate code coverage files is easier than it was in GCC.&lt;/p&gt;&#xA;&lt;p&gt;Code coverage file generation from LLVM is currently available only for Mac applications.&lt;/p&gt;&#xA;&lt;h3 id=&#34;setting-up-xcode-for-code-coverage&#34; class=&#34;relative group&#34;&gt;Setting up Xcode for Code Coverage &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#setting-up-xcode-for-code-coverage&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To generate code coverage files, you must set the following Xcode build settings to Yes: Generate Test Coverage Files and Instrument Program Flow. These build settings are in the Code Generation collection. You must also generate debug symbols, which you can ensure by running with the Debug build configuration.&lt;/p&gt;&#xA;&lt;h3 id=&#34;creating-and-finding-the-code-coverage-files&#34; class=&#34;relative group&#34;&gt;Creating and Finding the Code Coverage Files &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#creating-and-finding-the-code-coverage-files&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Build the project and run your application to generate the code coverage files. Finding the code coverage files is tricky because they’re buried inside your build folder. You can find them in the following location:&lt;/p&gt;&#xA;&lt;pre&gt;DerivedData/ProjectName/Build/Intermediates/ProjectName.build/Debug/ProjectName.build/Objects-normal/x86_64&lt;/pre&gt;&#xA;&lt;p&gt;Where DerivedData is the location of your derived data folder, Debug is the build configuration, and x86_64 is the architecture. You fill find two code coverage files for each of your source files: one with extension .gcda and one with extension .gcno.&lt;/p&gt;&#xA;&lt;h3 id=&#34;viewing-code-coverage-statistics&#34; class=&#34;relative group&#34;&gt;Viewing Code Coverage Statistics &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#viewing-code-coverage-statistics&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The last step is to view the code coverage statistics. I recommend using &lt;a href=&#34;http://code.google.com/p/coverstory&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;CoverStory&lt;/a&gt;. Choose File &amp;gt; Open in CoverStory. Select the folder containing your code coverage files and click the Open button. Next to each line of code is the number of times it executed. Lines of code that were not executed are highlighted in red.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>TextMate 2 Now Open Source</title>
      <link>https://www.meandmark.com/textmate-2-now-open-source/</link>
      <pubDate>Mon, 13 Aug 2012 01:43:52 +0000</pubDate>
      <guid>https://www.meandmark.com/textmate-2-now-open-source/</guid>
      <description>&lt;p&gt;If you’re a Mac developer looking for a text editor, you may be interested to know that Text Mate 2 is now open source. You can find the &lt;a href=&#34;https://github.com/textmate/textmate&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;source code on Github&lt;/a&gt;. Click the Downloads link on the right side of the Github page to download the application.&lt;/p&gt;&#xA;&lt;p&gt;One quirk I noticed is when you have a project open and you select a file from the project’s file list, nothing happens. Click the icon next to the file to open the file and edit it.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Great Job Opportunity for Mac and iOS Developers</title>
      <link>https://www.meandmark.com/great-job-opportunity-for-mac-and-ios-developers/</link>
      <pubDate>Thu, 09 Aug 2012 19:08:26 +0000</pubDate>
      <guid>https://www.meandmark.com/great-job-opportunity-for-mac-and-ios-developers/</guid>
      <description>&lt;p&gt;I found the following &lt;a href=&#34;http://tech.groups.yahoo.com/group/mac-dev-jobs/message/222&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;job listing&lt;/a&gt; on Yahoo’s mac-dev-jobs list:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;We are developing developing a software for iPad to make IOS apps without&lt;br&gt;&#xA;coding! So no coding necessary. It is drag-and-drop so you drag in behaviors and&lt;br&gt;&#xA;it does the rest for you. As of now we are just making an iPad version, but we&lt;br&gt;&#xA;really want to have a Mac Creator in our near future. In this project we are&lt;br&gt;&#xA;looking for somebody that knows how to make a program for a Mac. We can explain&lt;br&gt;&#xA;more details after we are contacted. In this job we are making it so if you want&lt;br&gt;&#xA;the app, you need to pay. So each developer will pay $200-$500 (that’s an&lt;br&gt;&#xA;estimate). We will not pay up front because we will start making the money once&lt;br&gt;&#xA;we release the creator. – I need a iOS developer to help me with developing the&lt;br&gt;&#xA;iPad editor,&lt;br&gt;&#xA;– I need a Mac developer for a Mac editor (I use editor and creator&lt;br&gt;&#xA;interchangeably),&lt;br&gt;&#xA;– I could really use someone who has experience with the XNA framework from&lt;br&gt;&#xA;Microsoft all in C#. We want somebody who would be looking to make this creator&lt;br&gt;&#xA;full time and will be dedicated to be part of the Jango team. If anyone is&lt;br&gt;&#xA;interested please contact us!&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Not only do you get to work full time for no pay, you get to pay $200-$500 for the privilege. I would consider applying, but I’m sure they’re already swamped with applicants.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4.4 Changes</title>
      <link>https://www.meandmark.com/xcode-4-4-changes/</link>
      <pubDate>Mon, 30 Jul 2012 18:37:22 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-4-changes/</guid>
      <description>&lt;p&gt;Xcode 4.4 is now out for Mac OS X 10.7 and 10.8. It’s going to take some time for me to update the Xcode book for Xcode 4.4 so I’m writing this post. This post provides a brief explanation of the changes I noticed in Xcode 4.4 that affect the material in the book. You can read about additional changes in Xcode 4.4 in the following document from Apple:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_4.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;New Features in Xcode 4.4&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;organization-name-in-source-code-file-copyright-notice&#34; class=&#34;relative group&#34;&gt;Organization Name in Source Code File Copyright Notice &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#organization-name-in-source-code-file-copyright-notice&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you name your project in the Product Name text field, you will see an Organization Name text field. The name you specify in the text field appears in the copyright notice at the top of each new source code file Xcode creates for the project. The Organization Name text field comes as a great relief to people who were tired of their source code files having the name &lt;strong&gt;My Company Name&lt;/strong&gt; in the copyright notice. &lt;/p&gt;&#xA;&lt;p&gt;If you make a mistake entering the organization name, you can fix it by selecting the project file from the project navigator and opening the file inspector. Enter a new name in the Organization text field in the Project Document section of the file inspector.&lt;/p&gt;&#xA;&lt;h3 id=&#34;project-and-file-templates&#34; class=&#34;relative group&#34;&gt;Project and File Templates &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#project-and-file-templates&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The Other category under both Mac OS X and iOS has a project template for creating in-app purchase content. Most of you will add a target to an application project instead of creating a new project for in-app purchase content.&lt;/p&gt;&#xA;&lt;p&gt;Xcode 4.4 no longer has a Sync Schema project template, which was in the System Plug-In category under Mac OS X.&lt;/p&gt;&#xA;&lt;p&gt;The Cocoa and Cocoa Touch categories have an Objective-C class extension file template, which generates a class extension header file. A class extension allows you to declare parts of a class’s interface (the @interface section you find in Objective-C header files) outside the class’s public header file.&lt;/p&gt;&#xA;&lt;h3 id=&#34;refactoring-tools&#34; class=&#34;relative group&#34;&gt;Refactoring Tools &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#refactoring-tools&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 4.4 adds a new refactoring tool, which you can access by choosing Edit &amp;gt; Refactor &amp;gt; Convert to Modern Objective-C Syntax. If you have done any work with Objective-C strings, you know the @ character signifies the start of a string literal.&lt;/p&gt;&#xA;&lt;pre&gt;NSString* myString = @&#34;Hello&#34;;&lt;/pre&gt;&#xA;&lt;p&gt;In Xcode 4.4 you can use the @ character to initialize numbers, arrays, and dictionaries.&lt;/p&gt;&#xA;&lt;pre&gt;NSNumber* myNumber = @7;&#xA;NSNumber* myFloat = @2.5f;&#xA;NSArray* myArray = @[@1, @2, @3, @4];&#xA;NSDictionary* myDictionary = @{@1: @&#34;red&#34;, @2: @&#34;green&#34;, @3: @&#34;blue&#34;, @4: @&#34;alpha&#34;};&lt;/pre&gt;&#xA;&lt;p&gt;In addition to refactoring your code to use the new support for literals, the refactoring tool implements the [ ] syntax convention for Objective-C containers, such as arrays and dictionaries. The new syntax lets you access an element in an array with the following code:&lt;/p&gt;&#xA;&lt;pre&gt;myArray[3];&lt;/pre&gt;&#xA;&lt;p&gt;Instead of the following:&lt;/p&gt;&#xA;&lt;pre&gt;[myArray objectAtIndex:3];&lt;/pre&gt;&#xA;&lt;p&gt;According to Apple’s documentation, the modern Objective-C syntax requires the use of the Mac OS X 10.8 SDK. Code that uses the syntax runs on 10.7 and later. iOS support is coming soon.&lt;/p&gt;&#xA;&lt;h3 id=&#34;code-completion&#34; class=&#34;relative group&#34;&gt;Code Completion &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#code-completion&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 4.4 integrates Quick Help with code completion. When you select an item from the completion list, the bottom of the list shows the Quick Help documentation for the selected item.&lt;/p&gt;&#xA;&lt;h3 id=&#34;editing-dae-files&#34; class=&#34;relative group&#34;&gt;Editing DAE Files &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#editing-dae-files&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 4.4 provides an editor for 3D models. In your 3D modeling program, export the model as a DAE file. Add the DAE file to your project. When you select the DAE file from the project navigator, you can view and edit it in Xcode.&lt;/p&gt;&#xA;&lt;p&gt;You must be running Mac OS X 10.8 to edit DAE files.&lt;/p&gt;&#xA;&lt;h3 id=&#34;interface-builder&#34; class=&#34;relative group&#34;&gt;Interface Builder &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#interface-builder&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 4.4 adds the following user interface elements for Mac OS X: byte count formatter, page controller, scene view.&lt;/p&gt;&#xA;&lt;p&gt;Xcode 4.4 adds a split view controller for iOS projects.&lt;/p&gt;&#xA;&lt;h3 id=&#34;modeling-tools&#34; class=&#34;relative group&#34;&gt;Modeling Tools &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#modeling-tools&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The data model inspector no longer has a Synchronization section for syncing entities, attributes, and relationships.&lt;/p&gt;&#xA;&lt;h3 id=&#34;icon-composer&#34; class=&#34;relative group&#34;&gt;Icon Composer &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#icon-composer&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Icon Composer no longer comes with Xcode. It is part of the Graphics Tools package. You can download it from Xcode by choosing Xcode &amp;gt; Open Developer Tool &amp;gt; More Developer Tools.&lt;/p&gt;&#xA;&lt;h3 id=&#34;base-internationalization&#34; class=&#34;relative group&#34;&gt;Base Internationalization &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#base-internationalization&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you select the project from the project editor and click the Info button at the top of the editor, you will see a Use Base Internationalization checkbox. If you select this checkbox, Xcode creates a Base localization, which for most of you is based on English. Using a Base localization makes localizing your application easier.&lt;/p&gt;&#xA;&lt;p&gt;Suppose you have a xib file to localize. Prior to using base internationalization, you needed one xib file for each language your application supports. By using base internationalization, you use one xib file with a strings file for each language your application supports.&lt;/p&gt;&#xA;&lt;h3 id=&#34;build-settings&#34; class=&#34;relative group&#34;&gt;Build Settings &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#build-settings&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;New Cocoa application projects are initially set to build for 64-bit Intel.&lt;/p&gt;&#xA;&lt;h3 id=&#34;version-control&#34; class=&#34;relative group&#34;&gt;Version Control &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#version-control&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode 4.4 adds support for cherry picking changes to git repositories. If you make multiple changes to a file, you can now commit or discard a single change. Previously you had to commit all the changes to a file or discard all changes when committing from Xcode.&lt;/p&gt;&#xA;&lt;p&gt;When you commit a file a sheet opens that highlights the changes you made to the file. The sheet shows two versions of the file: the local version on your hard disk and the last version you committed to the repository. Between the two versions of the file is a button. Click the button and choose Don’t Commit to tell Xcode not to commit the change. Choose Discard Change to discard the change. Repeat this for each change you don’t want to commit. Click the Commit button to commit the remaining changes.&lt;/p&gt;&#xA;&lt;p&gt;You can also discard individual changes to a file by using Xcode’s version editor. Click the button between the two versions of the file and choose Discard Change.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating a Windows Installer with Inno Setup</title>
      <link>https://www.meandmark.com/creating-a-windows-installer-with-inno-setup/</link>
      <pubDate>Wed, 18 Jul 2012 00:08:32 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-a-windows-installer-with-inno-setup/</guid>
      <description>&lt;p&gt;If you’re making a Windows game, one of the tasks you must perform is to create an installer for the game. Coming from Mac OS X, where installers are rarely used, I was a little worried about making an installer for the Windows version of &lt;a href=&#34;http://www.meandmark.com/letterminer.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Letter Miner&lt;/a&gt;. But after doing some Internet research, I came across I&lt;a href=&#34;http://www.jrsoftware.org/isinfo.php&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;nno Setup&lt;/a&gt;, a free tool that greatly simplifies making an installer for Windows. In this article I’ll explain how to use Inno Setup to create a basic Windows installer.&lt;/p&gt;&#xA;&lt;h3 id=&#34;using-the-script-wizard&#34; class=&#34;relative group&#34;&gt;Using the Script Wizard &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#using-the-script-wizard&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The easiest way to start with Inno Setup is to use its script wizard. Launch Inno Setup and choose File &amp;gt; New to open the script wizard. The wizard creates a basic shell of an install script. Using the wizard allows you to specify the following without having to write any code:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The name of your application&lt;/li&gt;&#xA;&lt;li&gt;Your company name&lt;/li&gt;&#xA;&lt;li&gt;Your company URL&lt;/li&gt;&#xA;&lt;li&gt;The version number&lt;/li&gt;&#xA;&lt;li&gt;Where to install the application&lt;/li&gt;&#xA;&lt;li&gt;The Start menu folder name&lt;/li&gt;&#xA;&lt;li&gt;Whether or not to create a desktop icon&lt;/li&gt;&#xA;&lt;li&gt;A license file to use&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When you finish with the script wizard, you have a basic installer that installs your application. Games usually have additional files to copy, such as graphics, sound, and data files. You must add them manually to your script to have them installed when the player runs the installer.&lt;/p&gt;&#xA;&lt;h3 id=&#34;adding-files-to-install&#34; class=&#34;relative group&#34;&gt;Adding Files to Install &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#adding-files-to-install&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you look through the script the script wizard created, you will find a Files section in the script that looks similar to the following:&lt;/p&gt;&#xA;&lt;pre&gt;[Files] &#xA;Source: &#34;MyProg.exe&#34;; DestDir: &#34;{app}&#34;; Flags: ignoreversion &#xA;; NOTE: Don&#39;t use &#34;Flags: ignoreversion&#34; on any shared system files&lt;/pre&gt;&#xA;&lt;p&gt;To add your game’s files to the installer, you must add them to the Files section, one listing for each file in the game. The following example copies SDL’s DLL file to the same directory as the application when installing the application:&lt;/p&gt;&#xA;&lt;pre&gt;Source: &#34;SDL.dll&#34;; DestDir: &#34;{app}&#34;&lt;/pre&gt;&#xA;&lt;p&gt;This example assumes the file SDL.dll is in the same directory as the script you are writing. You may find it safer to pass the full path to the file on your computer.&lt;/p&gt;&#xA;&lt;pre&gt;Source: &#34;C:\Path\To\SDL.dll&#34;; DestDir: &#34;{app}&#34;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;running-other-programs-during-the-install&#34; class=&#34;relative group&#34;&gt;Running Other Programs During the Install &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#running-other-programs-during-the-install&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you use Visual C++ to write your game, your installer may need to run the Visual C++ Redistributable Package so that someone who does not have Visual C++ on their computer can play your game. Running another program in the installer is a two-step process. First, you must add the program to the Files section. The following example copies the Visual C++ Redistributable Package:&lt;/p&gt;&#xA;&lt;pre&gt;Source: &#34;vcredist_x86.exe&#34;; DestDir: &#34;{app}&#34;&lt;/pre&gt;&#xA;&lt;p&gt;Second, you must add the program to the Run section of the installer script (look for &lt;strong&gt;[Run]&lt;/strong&gt; in the script). The following example runs the Visual C++ Redistributable Package:&lt;/p&gt;&#xA;&lt;pre&gt;Filename: &#34;{app}\vcredist_x86.exe&#34;&lt;/pre&gt;&#xA;&lt;h3 id=&#34;compiling-the-script&#34; class=&#34;relative group&#34;&gt;Compiling the Script &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#compiling-the-script&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you finish writing your script, choose Build &amp;gt; Compile to compile it. The default name for the installer Inno Setup creates is setup.exe, but the actual name depends on what you entered in the script wizard. Choosing Run &amp;gt; Run allows you to run and test the installer you created.&lt;/p&gt;&#xA;&lt;h3 id=&#34;additional-information&#34; class=&#34;relative group&#34;&gt;Additional Information &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#additional-information&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;This article provides a basic introduction to using Inno Setup. Additional information is available from Inno Setup’s Help menu, including example scripts.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Using Tries to Store Word Lists in RAM</title>
      <link>https://www.meandmark.com/using-tries-to-store-word-lists-in-ram/</link>
      <pubDate>Tue, 10 Jul 2012 20:29:31 +0000</pubDate>
      <guid>https://www.meandmark.com/using-tries-to-store-word-lists-in-ram/</guid>
      <description>&lt;p&gt;One task every word game must perform is determining whether or not the word the player creates is a valid word. To check if a word is a valid, the game needs a word list and check if the word the player creates is in the list. How do you store the word list so you can check it quickly?&lt;/p&gt;&#xA;&lt;p&gt;One answer is to use a trie. A trie is a data structure that indexes and searches for words.&lt;/p&gt;&#xA;&lt;p&gt;The following diagram shows a trie for the words ace, aced, aces, acre, acres, act, acted, acting, and acts:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/07/TrieExampleCropped.png&#34; alt=&#34;TrieExampleCropped&#34; width=&#34;501&#34; height=&#34;480&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt; &lt;/p&gt;&#xA;&lt;p&gt;The silver nodes represent the end of a word. Notice the memory efficiency of using a trie. 15 nodes can represent nine words. Storing the nine words separately entails storing 38 characters in memory. Imagine a dictionary containing tens of thousands of words and you can see how much memory you can save by storing a word list as a trie.&lt;/p&gt;&#xA;&lt;p&gt;Traversing a trie is also fast. The speed of searching for a word in a trie depends on the length of the word, not the number of words in the list. This means you can search for a word quickly in a list that contains tens of thousands of words, which is important in a word game.&lt;/p&gt;&#xA;&lt;h3 id=&#34;implementing-a-trie&#34; class=&#34;relative group&#34;&gt;Implementing a Trie &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#implementing-a-trie&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Implementing a trie involves creating two data structures: trie node and trie. A trie node stores the following data:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The letter.&lt;/li&gt;&#xA;&lt;li&gt;Whether or not the node is the end of a word.&lt;/li&gt;&#xA;&lt;li&gt;A list of child nodes. If you’re using a C-based language, the list would be a pointer to a trie node.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You must perform the following actions on a trie node: add a child and find a child. Adding a child adds a trie node to the list of child nodes. Finding a child involves going through each node in the child list and checking that the letter of the node matches the desired letter.&lt;/p&gt;&#xA;&lt;p&gt;A trie consists of a list of trie nodes. In a C-based language the list would be a pointer to a trie node data structure.&lt;/p&gt;&#xA;&lt;p&gt;You must perform the following actions on a trie: add a word and find a word. To add a word start at the root of the tree and go through each letter in the word. For each letter check if it is already in the trie. If it is in the trie, make that node the current node and move on to the next letter. If the letter is not in the trie, add a node for the letter to the trie.&lt;/p&gt;&#xA;&lt;p&gt;To find a word, go through the letters in the word and drill down the trie until you get to the last letter. If you reach a NULL node before you get to the end of the trie, the word does not exist in the trie. If you get to the end of the word, check that the current node is the end of a word. If it is, the word was found.&lt;/p&gt;&#xA;&lt;h3 id=&#34;source-code-implementations&#34; class=&#34;relative group&#34;&gt;Source Code Implementations &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#source-code-implementations&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;You may have noticed this post is light on source code. That is because you can find many source code implementations of tries on the Internet. I will link to three of them here.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://login2win.blogspot.com/2011/06/c-tries.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;C++ implementation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://filoxus.blogspot.com/2007/11/trie-in-python.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Python implementation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://learnruby.com/boggle/index.shtml&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Ruby implementation&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The code in the C++ implementation link worked well for me so I decided to link to it instead of posting my code.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4 and Snow Leopard</title>
      <link>https://www.meandmark.com/xcode-4-and-snow-leopard/</link>
      <pubDate>Thu, 31 May 2012 18:49:05 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-and-snow-leopard/</guid>
      <description>&lt;p&gt;I have seen many questions from people on various forums who want to use Xcode 4 on Snow Leopard but can’t find it. To download Xcode 4 on Snow Leopard, you must be a member of one of Apple’s paid (iOS or Mac) developer programs. If you have a paid developer membership, you can download Xcode 4 for Snow Leopard at the following URL:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://developer.apple.com/downloads/index.action&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;https://developer.apple.com/downloads/index.action&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Xcode 4.2 is the most recent version that runs on Snow Leopard.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Introduction to Unit Testing with OCUnit</title>
      <link>https://www.meandmark.com/introduction-to-unit-testing-with-ocunit/</link>
      <pubDate>Wed, 23 May 2012 21:13:36 +0000</pubDate>
      <guid>https://www.meandmark.com/introduction-to-unit-testing-with-ocunit/</guid>
      <description>&lt;p&gt;In a previous post I covered &lt;a href=&#34;http://meandmark.com/blog/2012/05/setting-up-ocunit-unit-testing-in-xcode-4/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;how to setup OCUnit unit testing in Xcode 4&lt;/a&gt;. This post provides an introduction to writing unit tests with OCUnit, which is a unit testing framework for Objective-C code that comes with Xcode.&lt;/p&gt;&#xA;&lt;h3 id=&#34;unit-testing-classes&#34; class=&#34;relative group&#34;&gt;Unit Testing Classes &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#unit-testing-classes&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When writing unit tests with OCUnit, you will create one or more unit testing classes. How many classes you create is a matter of personal preference. I usually have one unit testing class for each class in my application. If you have a large application class, you could create multiple unit testing classes for that class. You could also have one class that contains all your unit tests.&lt;/p&gt;&#xA;&lt;p&gt;An OCUnit unit testing class contains two files: a header file with a .h extension and an implementation file with a .m extension. A newly created class’s header file looks similar to the following:&lt;/p&gt;&#xA;&lt;pre&gt;@interface TrieUnitTest : SenTestCase&#xA;@end&lt;/pre&gt;&#xA;&lt;p&gt;The unit testing class, TrieUnitTest in my example, inherits from the SenTestCase class, which is OCUnit’s base class. If you want to add any data members to the unit testing class, add them between the @interface and @end tags. A common data member to add to a unit testing class is an object of the application class you’re testing.&lt;/p&gt;&#xA;&lt;p&gt;You generally won’t do much in the header file. In an Objective-C application you must declare a class’s methods in the header file.&lt;/p&gt;&#xA;&lt;pre&gt;- (void)DoSomething;&lt;/pre&gt;&#xA;&lt;p&gt;You do not need to declare your unit testing methods in the header file. Write your unit testing methods in the implementation file.&lt;/p&gt;&#xA;&lt;p&gt;What appears in a newly created class’s implementation file depends on the version of Xcode you’re using and how the class was created. If you add a new unit testing class to a project in Xcode 4.3.2, you get an empty implementation to fill in.&lt;/p&gt;&#xA;&lt;pre&gt;@implementation TrieUnitTest&#xA;@end&lt;/pre&gt;&#xA;&lt;p&gt;If you create a new Xcode project in Xcode 4.3.2 with unit testing support, the unit testing class Xcode supplies has three methods: setUp:, tearDown:, and testExample, which creates a failing test. I will cover the setUp: and tearDown: methods later in this article. You can delete the testExample method, or you can keep it initially to see if unit testing is working.&lt;/p&gt;&#xA;&lt;h3 id=&#34;writing-test-methods&#34; class=&#34;relative group&#34;&gt;Writing Test Methods &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#writing-test-methods&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;An OCUnit test method has the following requirements:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;It must start with the word test. OCUnit treats methods with the test prefix as test methods and runs them automatically.&lt;/li&gt;&#xA;&lt;li&gt;It takes no arguments.&lt;/li&gt;&#xA;&lt;li&gt;It returns void.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The following code shows an example of defining a test method:&lt;/p&gt;&#xA;&lt;pre&gt;- (void)testDoSomething&#xA;{&#xA;&#xA;}&lt;/pre&gt;&#xA;&lt;p&gt;You do not need to define test methods in the header file. Write the method in the implementation file.&lt;/p&gt;&#xA;&lt;p&gt;One thing to keep in mind when writing test methods is you have no control over the order in which OCUnit runs your tests. Each unit test you write should be self-contained and should not rely on the results of other tests.&lt;/p&gt;&#xA;&lt;h3 id=&#34;ocunit-assertions&#34; class=&#34;relative group&#34;&gt;OCUnit Assertions &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#ocunit-assertions&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Assertion macros are the heart of unit testing. They determine whether or not the test passes. OCUnit has the following assertion macros:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;STAssertEqualObjects asserts two Cocoa objects are equal.&lt;/li&gt;&#xA;&lt;li&gt;STAssertEqual asserts two variables of a primitive data type, such as integers, are equal.&lt;/li&gt;&#xA;&lt;li&gt;STAssertEqualsWithAccuracy asserts two floating-point variables are equal. This assertion allows you to deal with small inaccuracies in floating-point arithmetic.&lt;/li&gt;&#xA;&lt;li&gt;STAssertFalse asserts a condition is false.&lt;/li&gt;&#xA;&lt;li&gt;STAssertFalseNoThrow asserts a condition is false and no exceptions are thrown.&lt;/li&gt;&#xA;&lt;li&gt;STAssertNil asserts a pointer is nil.&lt;/li&gt;&#xA;&lt;li&gt;STAssertNoThrow asserts no exceptions are thrown.&lt;/li&gt;&#xA;&lt;li&gt;STAssertNoThrowSpecific asserts no exceptions of a specific class are thrown.&lt;/li&gt;&#xA;&lt;li&gt;STAssertNoThrowSpecificNamed asserts a specific exception is not thrown.&lt;/li&gt;&#xA;&lt;li&gt;STAssertNotNil asserts a pointer is not nil.&lt;/li&gt;&#xA;&lt;li&gt;STAssertThrows asserts an exception is thrown.&lt;/li&gt;&#xA;&lt;li&gt;STAssertThrowsSpecific asserts an exception of a specific class is thrown.&lt;/li&gt;&#xA;&lt;li&gt;STAssertThrowsSpecificNamed asserts a specific exception is thrown.&lt;/li&gt;&#xA;&lt;li&gt;STAssertTrue asserts a condition is true.&lt;/li&gt;&#xA;&lt;li&gt;STAssertTrueNoThrow asserts a condition is true and no exceptions are thrown.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In most cases a unit test should have only one assertion. One assertion per test makes it easier to find where a failing test fails. &lt;/p&gt;&#xA;&lt;h3 id=&#34;test-method-example&#34; class=&#34;relative group&#34;&gt;Test Method Example &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#test-method-example&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now it’s time to write a unit test. I’m going to test that multiplying two negative integers yields a positive integer. Here’s the test method:&lt;/p&gt;&#xA;&lt;pre&gt;- (void)testMultiplyingTwoNegativeIntegersYieldsPositiveProduct&#xA;{&#xA;&#x9;int x = -5;&#xA;&#x9;int y = -7;&#xA;&#x9;int product = x * y;&#xA;&#xA;&#x9;STAssertTrue((product &amp;gt; 0), @&#34;The product was less than zero.&#34;);&#xA;}&lt;/pre&gt;&#xA;&lt;p&gt;The most interesting part of the test is the assertion. I use the STAssertTrue macro because I’m testing a condition, whether the product is positive. I pass two arguments to the STAssertTrue macro. The first argument is the condition to test. The second argument is the error message OCUnit displays if the test fails. The @ before the first quote specifies that the error message is an Objective-C string.&lt;/p&gt;&#xA;&lt;p&gt;If you add this test to one of your unit testing classes, it should pass. If you want to see what happens when a test fails, make x or y positive, change the condition in the assertion, or change STAssertTrue to STAssertFalse.&lt;/p&gt;&#xA;&lt;h3 id=&#34;improving-the-error-message&#34; class=&#34;relative group&#34;&gt;Improving the Error Message &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#improving-the-error-message&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The test I wrote in the last section shouldn’t fail, but if it does, the error message doesn’t help much. The error message tells you the product was less than zero, but it doesn’t tell you what the product’s value was, which is important to know. Let’s improve the error message.&lt;/p&gt;&#xA;&lt;pre&gt;STAssertTrue((product &amp;gt; 0), @&#34;The product was less than zero. Product: %d&#34;, product);&lt;/pre&gt;&#xA;&lt;p&gt;Now if the test fails, it prints the value of the product variable. The %d in the error message is a format string that specifies printing a variable’s value as a decimal integer. If you have printed variables using NSLog or printf, you’re familiar with format strings. Use %f to print a floating-point variable. Use %s to print a string of characters.&lt;/p&gt;&#xA;&lt;p&gt;You can print multiple variables by using multiple format strings and supplying the extra variables as arguments to the assertion. The following assertion tests that x and y are equal and prints their values if the test fails:&lt;/p&gt;&#xA;&lt;pre&gt;STAssertEquals(x, y, @&#34;x and y were not equal. x: %d y: %d&#34;, x, y);&lt;/pre&gt;&#xA;&lt;h3 style=&#34;font-size: 1.17em;&#34;&gt;&#xA;  The setUp: and tearDown: Methods&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;Two optional methods that can assist you in unit testing are setUp: and tearDown:. If you have initialization code to perform before running multiple tests, you can place that code in the setUp: method to remove duplicate code in your tests. The tearDown: method contains cleanup code. A common case of using the tearDown: method is to free any memory you allocated in the setUp: method.&lt;/p&gt;&#xA;&lt;p&gt;OCUnit calls the setUp: method before running each test and calls the tearDown: method after running each test. If your unit testing class has 20 tests, OCUnit calls setUp: and tearDown: 20 times.&lt;/p&gt;&#xA;&lt;p&gt;The following example shows a minimal setUp: method:&lt;/p&gt;&#xA;&lt;pre&gt;- (void)setUp&#xA;{&#xA;&#x9;[super setUp];&#xA;&#xA;&#x9;// Set-up code here.&#xA;}&lt;/pre&gt;&#xA;&lt;p&gt;Notice how you call the parent class’s setUp: method before writing your setup code.&lt;/p&gt;&#xA;&lt;p&gt;The following example shows a minimal tearDown: method:&lt;/p&gt;&#xA;&lt;pre&gt;- (void)tearDown&#xA;&#x9;// Tear-down code here. &#xA;&#xA;&#x9;[super tearDown];&#xA;}&lt;/pre&gt;&#xA;&lt;p&gt;Notice how you call the parent class’s tearDown: method after writing your cleanup code.&lt;/p&gt;&#xA;&lt;div&gt;&#xA;   &#xA;&lt;/div&gt;&#xA;</description>
    </item>
    <item>
      <title>Setting Up OCUnit Unit Testing in Xcode 4</title>
      <link>https://www.meandmark.com/setting-up-ocunit-unit-testing-in-xcode-4/</link>
      <pubDate>Tue, 15 May 2012 17:56:05 +0000</pubDate>
      <guid>https://www.meandmark.com/setting-up-ocunit-unit-testing-in-xcode-4/</guid>
      <description>&lt;p&gt;Xcode ships with OCUnit, which allows you to unit test Objective-C code. This post shows you how to setup Xcode 4 so you can unit test Cocoa and iOS applications.&lt;/p&gt;&#xA;&lt;h3 id=&#34;create-an-appropriate-project&#34; class=&#34;relative group&#34;&gt;Create an Appropriate Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-an-appropriate-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The easiest way to add unit testing support in Xcode 4 is to create a project that uses the Cocoa or Cocoa Touch frameworks, such as a Cocoa or iOS application. When you select an appropriate project and click the Next button, you should see an Include Unit Tests checkbox.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/05/Xcode4NewProjectIncludeUnitTests.png&#34; alt=&#34;Xcode4NewProjectIncludeUnitTests&#34; width=&#34;600&#34; height=&#34;404&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;When you select the Include Unit Tests checkbox, Xcode adds a unit test bundle target and a unit testing class to your project. Xcode also does most of the setup work for you. It configures the necessary build settings for unit testing and adds a target dependency so your application target builds when you build the unit test target.&lt;/p&gt;&#xA;&lt;h3 id=&#34;running-unit-tests-after-building-your-project&#34; class=&#34;relative group&#34;&gt;Running Unit Tests After Building Your Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#running-unit-tests-after-building-your-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Adding a unit test bundle when you create an Xcode project takes care of most of the build settings for you. There is one build setting you may have to setup manually. If you want Xcode to run your unit tests when you build the project, you must set the Test After Build build setting to YES. My &lt;a href=&#34;http://meandmark.com/blog/2011/03/xcode-4-accessing-build-settings/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 4: Accessing Build Settings&lt;/a&gt; post has detailed information on accessing build settings.&lt;/p&gt;&#xA;&lt;h3 id=&#34;adding-unit-test-classes-to-your-project&#34; class=&#34;relative group&#34;&gt;Adding Unit Test Classes to Your Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#adding-unit-test-classes-to-your-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;While Xcode adds a test case class to your project when you create a new project and select the Include Unit Tests checkbox, you’ll eventually need to add more classes for unit testing. Choose File &amp;gt; New &amp;gt; File to add a unit testing class to your project. Select either Cocoa under Mac OS X or Cocoa Touch under iOS on the left side of the New File Assistant. Select Objective-C test case class from the list of file templates. Click the Next button. Enter the name of your class in the Class text field. The name of the class is also the name of the file. Click the Next button. Choose a location to save the file. Click the Create button to create the file.&lt;/p&gt;&#xA;&lt;p&gt;Make sure the class you create is added to the unit test target, not the application target.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/05/AddFileToUnitTestTarget.png&#34; alt=&#34;AddFileToUnitTestTarget&#34; width=&#34;327&#34; height=&#34;143&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;If you mistakenly add the unit test class to the wrong target, select the file from the project navigator and open the file inspector by choosing View &amp;gt; Utilities &amp;gt; Show File Inspector. Use the checkboxes in the Target Membership section to ensure the unit test class is a member of the unit testing target, not the application target. &lt;/p&gt;&#xA;&lt;h3 id=&#34;configuring-your-scheme-for-testing&#34; class=&#34;relative group&#34;&gt;Configuring Your Scheme for Testing &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#configuring-your-scheme-for-testing&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Click the name of the scheme in the Scheme menu and choose Edit Scheme to open the scheme editor. Select the Test step from the left side of the scheme editor.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/05/SchemeEditorUnitTesting.png&#34; alt=&#34;SchemeEditorUnitTesting&#34; width=&#34;600&#34; height=&#34;407&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;The scheme editor allows you to choose a build configuration to use for unit testing, the debugger to use to debug unit tests, and the unit tests to run. Xcode is setup initially to run all unit tests.&lt;/p&gt;&#xA;&lt;h3 id=&#34;running-unit-tests&#34; class=&#34;relative group&#34;&gt;Running Unit Tests &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#running-unit-tests&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Xcode provides three ways of running unit tests. If you set the Test After Build build setting to YES, choosing Product &amp;gt; Build for Testing builds your project and runs the unit tests. The results of the unit tests appear in the build results window, which you can access from the log navigator. Choose View &amp;gt; Navigators &amp;gt; Show Log Navigator to show the log navigator. Select a build from the log navigator to show the build results window. &lt;/p&gt;&#xA;&lt;p&gt;The second way to run your unit tests is to choose Product &amp;gt; Test (or click the Run button and choose Test). When you choose Product &amp;gt; Test, Xcode builds your project and runs the tests. Use the log navigator to view the results of the unit tests. The final way to run your unit tests is to choose Product &amp;gt; Perform Action &amp;gt; Test Without Building, which runs unit tests without building the project.&lt;/p&gt;&#xA;&lt;h3 id=&#34;adding-unit-test-support-to-an-existing-project&#34; class=&#34;relative group&#34;&gt;Adding Unit Test Support to an Existing Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#adding-unit-test-support-to-an-existing-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To add unit test support to an existing project, you must add a unit test target to your project. Select the name of your project from the project navigator to open the project editor. Click the Add Target button at the bottom of the editor. Select the Other group under either Mac OS X or iOS. Select Unit Testing Bundle (either Cocoa or Cocoa Touch) from the target list.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/05/AddUnitTestTarget.png&#34; alt=&#34;AddUnitTestTarget&#34; width=&#34;600&#34; height=&#34;404&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Click the Next button. Enter a name for your target in the Product Name text field. Click the Finish button to finish creating the unit test target.&lt;/p&gt;&#xA;&lt;p&gt;Adding a unit test target to an existing Xcode project requires more setup work than creating a new project does. You must add a target dependency to the unit test target. You also must configure build settings for the unit test bundle.&lt;/p&gt;&#xA;&lt;h3 id=&#34;adding-target-dependencies&#34; class=&#34;relative group&#34;&gt;Adding Target Dependencies &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#adding-target-dependencies&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Adding a target dependency allows Xcode to build your application when you build the unit test target. Select the unit test target from the project editor. Click the Build Phases button at the top of the project editor. Click the disclosure triangle next to the Target Dependencies build phase. Click the + button to add a dependency. Select the application target from the target list.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/05/UnitTestTargetDependency.png&#34; alt=&#34;UnitTestTargetDependency&#34; width=&#34;186&#34; height=&#34;106&#34; border=&#34;0&#34; /&gt; &#xA;&lt;h3 id=&#34;configuring-the-unit-test-bundle&#34; class=&#34;relative group&#34;&gt;Configuring the Unit Test Bundle &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#configuring-the-unit-test-bundle&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you are unit testing an application, you must configure the unit test bundle. There are two build settings you must configure: Bundle Loader and Test Host. The Bundle Loader build setting is in the Linking collection, and the Test Host build setting is in the Unit Testing collection. You must set the value of these build settings to the location of the application’s executable file. For an application named MyApp, the value of the Bundle Loader and Test Host build settings would be the following:&lt;/p&gt;&#xA;&lt;pre&gt;$(BUILT_PRODUCTS_DIR)/MyApp.app/Contents/MacOS/MyApp (Mac)&lt;/pre&gt;&#xA;&lt;pre&gt;$(BUILT_PRODUCTS_DIR)/MyApp.app/MyApp (iOS)&lt;/pre&gt;&#xA;&lt;p&gt;iOS applications running in the simulator should leave the Test Host build setting blank. The simulator does not support application-hosted unit tests. If you set the Test Host build setting, you will get a warning when building the unit testing target and the tests will not run.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Downloading Xcode Without Using the Mac App Store</title>
      <link>https://www.meandmark.com/downloading-xcode-without-using-the-mac-app-store/</link>
      <pubDate>Fri, 11 May 2012 19:13:37 +0000</pubDate>
      <guid>https://www.meandmark.com/downloading-xcode-without-using-the-mac-app-store/</guid>
      <description>&lt;p&gt;I have read many posts on Apple’s free developer forums from people having problems downloading and installing Xcode from the App Store. If you are having similar problems, there is an alternative to using the App Store. You can download Xcode from the following URL:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://developer.apple.com/download&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;https://developer.apple.com/download&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;You can also use this URL to download older versions of Xcode.&lt;/p&gt;&#xA;&lt;p&gt;If you don’t have an ADC account, you will need to sign up for one to download Xcode from the URL I listed. You can get an ADC account for free.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Opening the Welcome Window</title>
      <link>https://www.meandmark.com/xcode-4-opening-the-welcome-window/</link>
      <pubDate>Thu, 05 Apr 2012 19:14:35 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-opening-the-welcome-window/</guid>
      <description>&lt;p&gt;When you launch Xcode, the default behavior is to open a welcome window. The following screenshot shows a cropped version of the welcome window:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/04/Xcode-Welcome-Window-Cropped.png&#34; border=&#34;0&#34; alt=&#34;Xcode Welcome Window Cropped&#34; width=&#34;459&#34; height=&#34;517&#34; /&gt; &#xA;&lt;p&gt;You can tell Xcode not to open the welcome window by deselecting the checkbox at the bottom of the welcome window. Suppose you deselect the checkbox and decide later you want to open the welcome window. How do you open it?&lt;/p&gt;&#xA;&lt;p&gt;In Xcode 4 choose Window &amp;gt; Welcome to Xcode to open the welcome window.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating a Custom Orthographic Projection With Pyglet</title>
      <link>https://www.meandmark.com/creating-a-custom-orthographic-projection-with-pyglet/</link>
      <pubDate>Wed, 22 Feb 2012 02:02:02 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-a-custom-orthographic-projection-with-pyglet/</guid>
      <description>&lt;p&gt;When you create a pyglet window, pyglet sets up an OpenGL orthographic projection for the window. The size of the projection matches the size of the window. If the window is 640 pixels wide and 480 pixels wide, the orthographic projection is 640 units wide and 480 units high. Pyglet’s default behavior works well in many cases, but there are situations where you may want to create an orthographic projection with different dimensions. If you’re writing a tile-based game, it is convenient to size the projection in tiles instead of pixels. How do you create a custom orthographic projection?&lt;/p&gt;&#xA;&lt;p&gt;Override pyglet’s on_resize() method for the window and make a call to glOrtho(). The following code provides an example of creating a custom-sized orthographic projection:&lt;/p&gt;&#xA;&lt;pre&gt;@window.event&#xA;&#xA;def on_resize(width, height):&#xA;&#x9;glViewport(0, 0, width, height)&#xA;&#x9;glMatrixMode(gl.GL_PROJECTION)&#xA;&#x9;glLoadIdentity()&#xA;&#xA;&#x9;projectionWidth = 24&#xA;&#x9;projectionHeight = 16&#xA;&#x9;glOrtho(0, projectionWidth, 0, projectionHeight, -1, 1)&#xA;&#x9;glMatrixMode(gl.GL_MODELVIEW)&#xA;&#x9;glLoadIdentity()&#xA;&#x9;return pyglet.event.EVENT_HANDLED&lt;/pre&gt;&#xA;&lt;p&gt;My example copies what the default on_resize() method does, but I supply a custom width and height to glOrtho().&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4.3 Changes</title>
      <link>https://www.meandmark.com/xcode-4-3-changes/</link>
      <pubDate>Fri, 17 Feb 2012 18:58:28 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-3-changes/</guid>
      <description>&lt;p&gt;Apple recently released Xcode 4.3. I did not notice many changes in Xcode 4.3, not enough for me to update &lt;em&gt;Xcode Tools Sensei&lt;/em&gt;. This post details what changed in Xcode 4.3.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-xcode-tools-are-packaged-in-a-single-application&#34; class=&#34;relative group&#34;&gt;The Xcode Tools Are Packaged in a Single Application &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#the-xcode-tools-are-packaged-in-a-single-application&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The biggest change in Xcode 4.3 is how Xcode is installed and packaged. Previous versions of Xcode required you to run an installer that installed the Xcode Tools in /Developer or another directory. Xcode 4.3 works like a typical Mac application, where the Xcode Tools appear as a single application in the Finder and install in your Applications folder. Xcode 4.3 is easier to install, uninstall, and update.&lt;/p&gt;&#xA;&lt;h4 id=&#34;launching-other-developer-tools&#34; class=&#34;relative group&#34;&gt;Launching Other Developer Tools &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#launching-other-developer-tools&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Since Xcode 4.3 is a single application you may be wondering how to launch the other tools that come with Xcode, such as Instruments. Launch them from Xcode by choosing Xcode &amp;gt; Open Developer Tool. Choose the tool you want to launch from the submenu. If the tool you want to launch is not in the submenu, choose More Developer Tools. Choosing More Developer Tools takes you to Apple’s developer downloads page, where you can download and install additional tools. If you want to run the Mac OpenGL developer tools that I cover in Chapter 11 of &lt;em&gt;Xcode Tools Sensei&lt;/em&gt;, you must choose More Developer Tools and install the Graphics Tools for Xcode package from Apple’s developer page. Download the disk image and drag the applications to your Applications folder.&lt;/p&gt;&#xA;&lt;p&gt;I don’t know how to add tools to Xcode’s Open Developer Tool menu. I downloaded the Graphics Tools for Xcode package and copied the applications to the Contents/Applications folder inside Xcode’s application bundle, but the applications did not appear in the Open Developer Tool menu. I asked about adding tools to the Open Developer Tool menu on Apple’s paid developer forums, but I have not received any answers.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Update (February 22, 2012)&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I received an answer on Apple’s developer forums to my question on adding tools to the Open Developer Tool menu. You can read the solution by reading user18861’s answer to the following question on the Ask Different website:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://apple.stackexchange.com/questions/40662/in-xcode-4-3-where-do-i-put-the-additional-tools&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;In Xcode 4.3, where do I put the additional tools?&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;When the answer mentions /Applications and /Resources, it means the Applications and Resources folders inside Xcode’s application bundle.&lt;/p&gt;&#xA;&lt;h4 id=&#34;installing-command-line-tools&#34; class=&#34;relative group&#34;&gt;Installing Command-Line Tools &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#installing-command-line-tools&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Xcode 4.3 does not initially install a copy of command-line tools that allow you to compile programs from the Terminal. You can install the command-line tools from Xcode’s Downloads preferences.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/02/Xcode4InstallCommandLineTools.png&#34; border=&#34;0&#34; alt=&#34;Xcode4InstallCommandLineTools&#34; width=&#34;600&#34; height=&#34;199&#34; /&gt; &#xA;&lt;h4 id=&#34;accessing-file-and-project-templates&#34; class=&#34;relative group&#34;&gt;Accessing File and Project Templates &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#accessing-file-and-project-templates&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Because Xcode 4.3 does not reside in a Developer folder, you must open the Xcode 4.3 application bundle to access things like Apple’s file and project templates. Select Xcode from the Finder, right-click, and choose Show Package Contents to examine the application bundle. The most interesting directory in Xcode’s application bundle is the following directory:&lt;/p&gt;&#xA;&lt;pre&gt;Contents/Developer&lt;/pre&gt;&#xA;&lt;h3 id=&#34;auto-layout&#34; class=&#34;relative group&#34;&gt;Auto Layout &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#auto-layout&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Cocoa application projects created with Xcode 4.3 enable auto layout. If you don’t want to use auto layout, select the xib file from the project navigator, open the file inspector, and deselect the Use Auto Layout checkbox.&lt;/p&gt;&#xA;&lt;h3 id=&#34;arc-conversion&#34; class=&#34;relative group&#34;&gt;ARC Conversion &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#arc-conversion&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;In Xcode 4.3 you can use Xcode’s ARC migration tool to convert an existing project that uses garbage collection. Xcode 4.2 could not convert a project to ARC if the project used garbage collection.&lt;/p&gt;&#xA;&lt;h3 id=&#34;developer-mode&#34; class=&#34;relative group&#34;&gt;Developer Mode &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#developer-mode&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you build your first project in Xcode 4.3 an alert may open asking if you want to enter developer mode. Entering developer mode lets you do things like debug your project without Xcode asking you for your user account’s password.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Installing Pyglet on 64-bit Macs</title>
      <link>https://www.meandmark.com/installing-pyglet-on-64-bit-macs/</link>
      <pubDate>Mon, 16 Jan 2012 19:03:25 +0000</pubDate>
      <guid>https://www.meandmark.com/installing-pyglet-on-64-bit-macs/</guid>
      <description>&lt;p&gt;Pyglet is a technology to write cross-platform OpenGL games and applications in Python. If you go to the &lt;a href=&#34;http://www.pyglet.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;pyglet site&lt;/a&gt;, you will find installers for Mac OS X and Windows. The current Mac version of the installer, 1.1.4, uses Carbon, which means it doesn’t work with 64-bit applications. Not working with 64-bit applications is a problem if you’re running Mac OS X 10.6 and later. Version 1.2 uses Cocoa and works with 64-bit applications, but an installer is not currently available because 1.2 is still in development. Until an installer for 1.2 becomes available, you will have to install pyglet from source code to use version 1.2.&lt;/p&gt;&#xA;&lt;h3 id=&#34;install-mercurial&#34; class=&#34;relative group&#34;&gt;Install Mercurial &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#install-mercurial&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The source code for pyglet is in a Mercurial repository. If you do not have Mercurial installed on your computer, you must install it to be able to install pyglet 1.2. Installers for Mac OS X and Windows are available at the &lt;a href=&#34;http://mercurial.selenic.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Mercurial site&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;clone-the-repository&#34; class=&#34;relative group&#34;&gt;Clone the Repository &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#clone-the-repository&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Cloning the pyglet repository gives you a copy of the source code so you can install pyglet. Launch the Terminal application, navigate to where you want the source code to reside, and run the following command:&lt;/p&gt;&#xA;&lt;pre&gt;hg clone https://pyglet.googlecode.com/hg/ pyglet&lt;/pre&gt;&#xA;&lt;p&gt;There is a space before pyglet in the last part of the URL. You should see a pyglet folder after cloning the repository.&lt;/p&gt;&#xA;&lt;h3 id=&#34;install-pyglet&#34; class=&#34;relative group&#34;&gt;Install Pyglet &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#install-pyglet&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;After cloning the repository, it’s time to install pyglet. In the Terminal application go to the pyglet folder and run the following command:&lt;/p&gt;&#xA;&lt;pre&gt;python setup.py install&lt;/pre&gt;&#xA;&lt;p&gt;Now pyglet should be installed and you can start coding.&lt;/p&gt;&#xA;&lt;h3 id=&#34;install-avbin&#34; class=&#34;relative group&#34;&gt;Install AVbin &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#install-avbin&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Installing pyglet alone has one limitation. It can play only uncompressed audio files. To play compressed audio files, such as MP3 and Ogg Vorbis files, with pyglet, you must install the AVbin library, which is what pyglet uses to play compressed audio. There are multiple versions available for Mac OS X, Windows, and Linux on the &lt;a href=&#34;http://avbin.github.com/AVbin/Download.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;AVbin download page&lt;/a&gt;. Those of you running Mac OS X 10.6 and later should download a version that supports 64-bit Intel.&lt;/p&gt;&#xA;&lt;p&gt;After downloading AVbin, you must install it from the Terminal application. Navigate to the avbin folder (the latest name of the folder on Mac OS X is avbin-darwin-x86-64-v8) and enter the following command:&lt;/p&gt;&#xA;&lt;pre&gt;sudo bash install.sh&lt;/pre&gt;&#xA;&lt;p&gt;Running the installation script installs AVbin and lets you play compressed audio files with pyglet.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Using SDL with Xcode 4</title>
      <link>https://www.meandmark.com/using-sdl-with-xcode-4/</link>
      <pubDate>Mon, 09 Jan 2012 19:31:36 +0000</pubDate>
      <guid>https://www.meandmark.com/using-sdl-with-xcode-4/</guid>
      <description>&lt;p&gt;Apple changed the format for project templates in Xcode 4. The format change means the Xcode templates that ship with the Mac version of SDL don’t work in Xcode 4. If you have both Xcode 3 and 4 installed on your Mac, you can create a project that uses SDL in Xcode 3 and open it in Xcode 4. But if you’re running Xcode 10.7 and don’t have Xcode 3 installed, you’re stuck with Xcode 4 and can’t use the SDL project templates. But you can use Xcode 4 to create SDL applications without too much hassle.&lt;/p&gt;&#xA;&lt;p&gt;While I wrote this article for Xcode 4 and SDL 1.2, most of the material in the article still applies to Xcode 5 and SDL 2. Some of the screenshots will look slightly different in Xcode 5, and any reference to SDL.framework should refer to SDL2.framework in SDL 2.&lt;/p&gt;&#xA;&lt;h3 id=&#34;create-a-cocoa-application-project&#34; class=&#34;relative group&#34;&gt;Create a Cocoa Application Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-a-cocoa-application-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you create a project in Xcode, select the Cocoa Application project, as you can see in the following screenshot:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; alt=&#34;Xcode4CocoaProjectStep1&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/01/Xcode4CocoaProjectStep1.png&#34; width=&#34;600&#34; height=&#34;404&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;The Mac OS X version of SDL is written with Cocoa so a Cocoa application project is the closest template to the old SDL project templates. Click the Next button to move to the next step where you name the project.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; alt=&#34;Xcode4CocoaProjectStep2&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/01/Xcode4CocoaProjectStep2.png&#34; width=&#34;600&#34; height=&#34;404&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;Deselect the Create Document-Based Application, Use Core Data, and Use Automatic Reference Counting checkboxes. SDL games don’t use Core Data or Apple’s NSDocument class. Automatic Reference Counting is for Objective-C code, which most of you won’t use if you’re using SDL. If you want to unit test your game with OCUnit, select the Include Unit Tests checkbox. My &lt;a href=&#34;http://meandmark.com/blog/2010/11/using-xcode-to-unit-test-sdl-games-written-in-c/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Using Xcode to Unit Test SDL Games Written in C++&lt;/a&gt; post has detailed information on using OCUnit to unit test C++ code.&lt;/p&gt;&#xA;&lt;p&gt;Click the Next button to move on to the final step of creating a project. Pick a location to save the project and click the Create button. If you want to place your project in a local git repository, select the checkbox to create the repository.&lt;/p&gt;&#xA;&lt;h3 id=&#34;remove-unwanted-files-from-the-project&#34; class=&#34;relative group&#34;&gt;Remove Unwanted Files from the Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#remove-unwanted-files-from-the-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Apple’s Cocoa application project template contains files that are not needed for SDL games. You can remove the xib file and source code files from the project: any files ending in .xib, .m, and .h. In Xcode 4.2 you would delete the following files: main.m, MainMenu.xib, AppDelegate.h, and AppDelegate.m. Select a file and choose Edit &amp;gt; Delete to delete the file from the project. An alert opens. If you click the Delete button, Xcode deletes the file instead of moving it to the Trash. Clicking the Remove Reference button is the safer option. My &lt;a href=&#34;http://meandmark.com/blog/2011/05/xcode-4-removing-files-from-a-project/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 4: Removing Files from a Project&lt;/a&gt; post has additional information on removing files from a project.&lt;/p&gt;&#xA;&lt;h3 id=&#34;add-the-sdl-framework-to-the-project&#34; class=&#34;relative group&#34;&gt;Add the SDL Framework to the Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-the-sdl-framework-to-the-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Now it’s time to add the SDL framework to the project. Select the project file from the project navigator to open the project editor. Select your target from the left side of the project editor. Click the Summary button at the top of the editor to see a list of linked frameworks. Click the + button to add a framework. More information on adding frameworks is in my &lt;a href=&#34;http://meandmark.com/blog/2011/03/xcode-4-adding-a-framework-to-your-project/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 4: Adding a Framework to Your Project&lt;/a&gt; post. Click the + button to add any additional frameworks, such as OpenGL, SDL_image, and SDL_mixer.&lt;/p&gt;&#xA;&lt;h3 id=&#34;add-sdlmain-to-the-project&#34; class=&#34;relative group&#34;&gt;Add SDLMain to the Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-sdlmain-to-the-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The Mac version of SDL uses two files, SDLMain.m and SDLMain.h, that contain glue code for running SDL code on Mac OS X. The SDL project templates include these files, but in Xcode 4 you must add them to your project. Choose File &amp;gt; Add Files to ProjectName to add the files. After adding the SDLMain files to the project, you can start coding.&lt;/p&gt;&#xA;&lt;h4 id=&#34;sdl-2-note&#34; class=&#34;relative group&#34;&gt;SDL 2 Note &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#sdl-2-note&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;SDL 2 has no SDLMain files to add. You can skip the Add SDLMain to the Project step if you’re using SDL 2.&lt;/p&gt;&#xA;&lt;h3 id=&#34;add-search-paths&#34; class=&#34;relative group&#34;&gt;Add Search Paths &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-search-paths&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When I tried to build a SDL project with Xcode 4, I got a build error saying that the file SDL.h was not found. The solution was to add the following search path to the Header Search Paths build setting:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;/Library/Frameworks/SDL.framework/Headers&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;You may also need to add a search path to the Framework Search Paths build setting, but I didn’t need to add a path. You may also need to specify additional search paths if you use additional frameworks, such as SDL_image and SDL_mixer. My &lt;a href=&#34;http://meandmark.com/blog/2011/03/xcode-4-accessing-build-settings/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode 4: Accessing Build Settings&lt;/a&gt; post has detailed information on accessing build settings in Xcode 4.&lt;/p&gt;&#xA;&lt;h3 id=&#34;copy-the-sdl-framework-to-your-application-bundle&#34; class=&#34;relative group&#34;&gt;Copy the SDL Framework to Your Application Bundle &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#copy-the-sdl-framework-to-your-application-bundle&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The SDL Xcode project templates copy the SDL framework to your application bundle. Copying the framework to the application bundle allows someone to play your SDL game without having SDL installed. If you want the SDL framework added to your application bundle, add a Copy Files build phase to your target and add the SDL framework to the build phase.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select the project file from the project navigator to open the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Select the target from the left side of the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Click the Build Phases button at the top of the editor.&lt;/li&gt;&#xA;&lt;li&gt;Click the Add Build Phase button at the bottom of the editor. If you’re using Xcode 5, choose Editor &amp;gt; Add Build Phase &amp;gt; Add Copy Files Build Phase and skip Step 5.&lt;/li&gt;&#xA;&lt;li&gt;Choose Add Copy Files from the menu.&lt;/li&gt;&#xA;&lt;li&gt;Drag the SDL framework from the project navigator to the table in the Copy Files build phase.&lt;/li&gt;&#xA;&lt;li&gt;Choose Frameworks from the Destination menu.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; alt=&#34;SDLCopyFilesBuildPhase&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/01/SDLCopyFilesBuildPhase.png&#34; width=&#34;600&#34; height=&#34;163&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;If you have additional frameworks to copy to the application bundle, repeat Step 6 for those frameworks. Don’t copy Apple’s frameworks to the application bundle; every Mac has Apple’s frameworks installed. Only copy third-party frameworks, such as SDL_image and SDL_mixer.&lt;/p&gt;&#xA;&lt;p&gt;If you find the SDL framework isn’t being copied into your application bundle, take a look at Adam’s comment, comment #5.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Accessing Local git Repositories in Redmine</title>
      <link>https://www.meandmark.com/accessing-local-git-repositories-in-redmine/</link>
      <pubDate>Fri, 06 Jan 2012 19:21:30 +0000</pubDate>
      <guid>https://www.meandmark.com/accessing-local-git-repositories-in-redmine/</guid>
      <description>&lt;p&gt;For those of you who don’t know what it is, &lt;a href=&#34;http://www.redmine.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Redmine&lt;/a&gt; is a tool for managing software projects and tracking bugs and other issues. One of Redmine’s features is its integration with version control systems. Suppose you have a bug in your software. You fix the bug and commit the fix to the repository. You can associate the revision number of your code fix with the bug in Redmine so you know which revision fixed the bug. Redmine supports several version controls, but I’m focusing on git because git is the only one I tested.&lt;/p&gt;&#xA;&lt;p&gt;Configuring a repository is not difficult in Redmine. Create a project, go to its Settings section, and click the Repository tab. But the instructions to configure the repository are misleading for local git repositories. They tell you to enter the path to the repository. If you enter the path to your local git repository, such as the following:&lt;/p&gt;&#xA;&lt;pre&gt;/path/to/repository&lt;/pre&gt;&#xA;&lt;p&gt;You will get a 404 error when you try to access the repository in Redmine. You must enter the path to the repository’s .git folder for Redmine to be able to access it.&lt;/p&gt;&#xA;&lt;pre&gt;/path/to/repository/.git&lt;/pre&gt;&#xA;&lt;p&gt;If you enter the wrong repository path, discover the 404 error, and go back to correct the error by adding .git to the path, you will notice that Redmine does not let you modify the repository path. You must delete the reference to the repository and recreate it.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2012/01/RedmineGitConfiguration.png&#34; border=&#34;0&#34; alt=&#34;RedmineGitConfiguration&#34; width=&#34;600&#34; height=&#34;180&#34; /&gt; &#xA;&lt;p&gt;Click the Delete button, which is in the bottom right corner of the screenshot, to delete the reference to the repository. After deleting the reference, choose a version control system from the SCM menu and reenter the path to the repository.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Adding Items to NSTextView’s Contextual Menu</title>
      <link>https://www.meandmark.com/adding-items-to-nstextviews-contextual-menu/</link>
      <pubDate>Tue, 03 Jan 2012 20:36:28 +0000</pubDate>
      <guid>https://www.meandmark.com/adding-items-to-nstextviews-contextual-menu/</guid>
      <description>&lt;p&gt;When you add a text view to your application using Interface Builder you get access to the text view’s default contextual menu. You can open the contextual menu in your application by right-clicking (or control-clicking) in the text view. This menu lets you do things like cut, copy, paste, and check the document for spelling errors. If you’ve read Aaron Hillegass’s Cocoa programming book you know how to replace the default contextual menu, but you may want to use the default menu and add some menu items to it. If you’re writing an HTML editor, you may want to add a menu item to wrap HTML tags around selected text. This post shows you how to add a menu item to NSTextView’s contextual menu.&lt;/p&gt;&#xA;&lt;h3 id=&#34;accessing-the-contextual-menu&#34; class=&#34;relative group&#34;&gt;Accessing the Contextual Menu &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#accessing-the-contextual-menu&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The first step to adding an item to a text view’s contextual menu is to access the menu. You can access NSTextView’s default contextual menu using the menu: method.&lt;/p&gt;&#xA;&lt;pre&gt;IBOutlet NSTextView* textView;&#xA;NSMenu* textViewContextualMenu = [textView menu];&lt;/pre&gt;&#xA;&lt;h3 id=&#34;adding-a-menu-item-to-the-contextual-menu&#34; class=&#34;relative group&#34;&gt;Adding a Menu Item to the Contextual Menu &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#adding-a-menu-item-to-the-contextual-menu&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;After you get access to the contextual menu, call NSMenu’s addItemWithTitle: method to add a menu item to the contextual menu. You must supply three pieces of information: the name of the menu item, the action, and the keyboard equivalent for the menu item. The action is the method that gets called when the user chooses the menu item. The following example adds a Tags menu item to the contextual menu with no keyboard equivalent:&lt;/p&gt;&#xA;&lt;pre&gt;- (IBAction)createTag:(id)sender;&lt;/pre&gt;&#xA;&lt;pre&gt;NSMenuItem* tagsMenuItem = [textViewContextualMenu addItemWithTitle:@&#34;Tags&#34;&#xA;&#x9;action:@selector(createTag:) keyEquivalent:@&#34;&#34;];&lt;/pre&gt;&#xA;&lt;p&gt;If you want to place a menu item in a specific place in the contextual menu, call NSMenu’s insertItemWithTitle: method. This method works similarly to the addItemWithTitle: method, but there is an additional argument to specify: the index (location in the menu) where you want to insert the menu item.&lt;/p&gt;&#xA;&lt;h3 id=&#34;adding-a-submenu&#34; class=&#34;relative group&#34;&gt;Adding a Submenu &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#adding-a-submenu&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Sometimes you need to add a submenu to a menu item. In the example I’ve been using in this article, you may decide to add a menu of tags as a submenu of the Tags menu so the user can add a specific tag. Call the contextual menu’s setSubmenu: method to add a submenu. Supply the menu to add and the menu item where you’re adding the menu. The following example adds a menu of tags to the Tags menu item:&lt;/p&gt;&#xA;&lt;pre&gt;IBOutlet NSMenu* tagsMenu;&#xA;[textViewContextualMenu setSubmenu:tagsMenu forItem:tagsMenuItem];&lt;/pre&gt;&#xA;&lt;p&gt;The example assumes you created a menu in Interface Builder. Add a NSMenu object to the xib file, and add items to the NSMenu object. Creating a menu in Interface Builder is generally easier than creating a menu programmatically, but you can create the menu in your source code if you want. Refer to the &lt;em&gt;NSMenu Class Reference&lt;/em&gt;, which is part of Apple’s documentation, to learn more about creating a menu in code. Searching for NSMenu in Xcode’s documentation window should be enough to find the class reference.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>User Interface Instrument</title>
      <link>https://www.meandmark.com/user-interface-instrument/</link>
      <pubDate>Mon, 19 Dec 2011 17:00:26 +0000</pubDate>
      <guid>https://www.meandmark.com/user-interface-instrument/</guid>
      <description>&lt;p&gt;The User Interface instrument records the user interaction with your Mac application and lets you replay the recording. This instrument records every event that occurs when you run the application. Choose the UI Recorder template to use the User Interface instrument.&lt;/p&gt;&#xA;&lt;h2 id=&#34;before-you-trace&#34; class=&#34;relative group&#34;&gt;Before You Trace &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#before-you-trace&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;User Interface recording requires the Enable access for assistive devices checkbox to be selected in the Universal Access section of Apple’s System Preferences. The System Preferences application should be in your Applications folder.&lt;/p&gt;&#xA;&lt;h2 id=&#34;user-interface-instrument-results&#34; class=&#34;relative group&#34;&gt;User Interface Instrument Results &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#user-interface-instrument-results&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;When you finish a trace with the User Interface instrument, it shows the following information for each event:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sample number.&lt;/li&gt;&#xA;&lt;li&gt;A thumbnail image of where the event happened.&lt;/li&gt;&#xA;&lt;li&gt;Triggers, whose purpose escapes me. For me it always shows an image of a menu with Triggers as the menu choice.&lt;/li&gt;&#xA;&lt;li&gt;The type of event, such as mouse button down, mouse moved, and key down. &lt;span style=&#34;white-space: pre;&#34;&gt;&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Key, which tells you the key that was pressed for a keyboard event. &lt;span style=&#34;white-space: pre;&#34;&gt;&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Title, which is the title of the view where the event occurred: window, view, control, menu, etc.  &lt;span style=&#34;white-space: pre;&#34;&gt;&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;Location, which tells you the location of the event. Mouse button events are the most common events to have a location.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Don’t worry if you see lots of samples with blank values in the Key, Title, and Location columns. That’s normal behavior. In the track pane mouse events are blue, keyboard events are green, and system events are yellow.&lt;/p&gt;&#xA;&lt;h2 id=&#34;replaying-what-the-user-interface-instrument-recorded&#34; class=&#34;relative group&#34;&gt;Replaying what the User Interface Instrument Recorded &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#replaying-what-the-user-interface-instrument-recorded&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;To replay a sequence you recorded, you must first finish a trace by clicking the Stop button. The Record button now has the title Drive and Record. Click the Drive and Record button to replay the recording. Instruments creates a new run and replays the event sequence.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>OpenGL Driver Instrument</title>
      <link>https://www.meandmark.com/opengl-driver-instrument/</link>
      <pubDate>Mon, 12 Dec 2011 05:30:01 +0000</pubDate>
      <guid>https://www.meandmark.com/opengl-driver-instrument/</guid>
      <description>&lt;p&gt;Researching Instruments for &lt;em&gt;Xcode Tools Sensei&lt;/em&gt; allowed me to become familiar with most of the built-in instruments. Due to the high number of instruments, there was no way for me to cover them all in the book. I focused on the most commonly used instruments in the book. I can use this blog to explain some of the other instruments. I start with the OpenGL Driver instrument.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-the-opengl-driver-instrument-does&#34; class=&#34;relative group&#34;&gt;What the OpenGL Driver Instrument Does &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#what-the-opengl-driver-instrument-does&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The OpenGL Driver instrument records OpenGL statistics. Some statistics this instrument records include the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The amount of free video memory. &lt;span style=&#34;white-space: pre;&#34;&gt;&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;The number of textures used. &lt;span style=&#34;white-space: pre;&#34;&gt;&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;The number of buffer swaps. &lt;span style=&#34;white-space: pre;&#34;&gt;&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;The amount of time the CPU waited for the GPU. &lt;span style=&#34;white-space: pre;&#34;&gt;&lt;/span&gt;&lt;/li&gt;&#xA;&lt;li&gt;The number of surfaces the GPU allocated.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Obviously OpenGL applications are the ones to benefit from the OpenGL Driver instrument. The OpenGL ES Driver instrument records similar information for iOS applications. The OpenGL ES Driver instrument is available in both the OpenGL ES Driver and OpenGL ES Analysis templates. In most cases you should use the OpenGL ES Analysis template for OpenGL ES profiling.&lt;/p&gt;&#xA;&lt;p&gt;One thing you’ll notice when you create a new trace document is there is no template for the OpenGL Driver instrument. Pick one of the other templates (Time Profiler and Empty would be good choices for profiling purposes) and add the OpenGL Driver instrument to the trace document by dragging the instrument from the Library to the instrument list. Click the Library button in the trace document window toolbar to open the Library.&lt;/p&gt;&#xA;&lt;h2 id=&#34;before-you-trace&#34; class=&#34;relative group&#34;&gt;Before You Trace &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#before-you-trace&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Before you start tracing you must tell Instruments the statistics to show in the track pane and detail view. Click the Info button next to the OpenGL Driver instrument to open a pop-up editor. Click the Configure button to see all the available statistics. Select the checkbox next to a statistic to tell Instruments to show it in the track pane and detail view. The extended detail view shows all the statistics so you should show only the most important statistics in the track pane and detail view.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/12/OpenGL-Driver-Configuration.png&#34; border=&#34;0&#34; alt=&#34;OpenGL Driver Configuration&#34; width=&#34;495&#34; height=&#34;273&#34; /&gt; &#xA;&lt;p&gt;The screenshot also shows where you set the sampling rate.&lt;/p&gt;&#xA;&lt;h2 id=&#34;trace-results&#34; class=&#34;relative group&#34;&gt;Trace Results &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#trace-results&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Use the Target menu in the trace document window toolbar to pick an application to profile. Click the Record button to start profiling. Click the Pause button to pause recording and see the statistics. The track pane graphs each statistic you told the OpenGL Driver instrument to observe.&lt;/p&gt;&#xA;&lt;p&gt;The detail view at the bottom of the trace document window has one column for each statistic you told Instruments to show. There is one row in the detail view for each sample the OpenGL Driver instrument recorded. Selecting a sample from the list shows all the OpenGL statistics for that sample in the extended detail view. The extended detail view is on the right side of the trace document window. If you don’t see it, choose View &amp;gt; Extended Detail or click the right button in the View group in the toolbar.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Instruments: Finding Where You Allocate Memory</title>
      <link>https://www.meandmark.com/instruments-finding-where-you-allocate-memory/</link>
      <pubDate>Thu, 08 Dec 2011 00:04:33 +0000</pubDate>
      <guid>https://www.meandmark.com/instruments-finding-where-you-allocate-memory/</guid>
      <description>&lt;p&gt;I have seen several questions recently on Stack Overflow from people using the Allocations instrument in Instruments. When looking through the information the Allocations instrument provides, they have difficulty finding the areas of their code responsible for the memory allocations. Answering questions on this topic several times on Stack Overflow tells me it’s time to make a post about finding where your application allocates memory.&lt;/p&gt;&#xA;&lt;p&gt;There are three views in Instruments that can help you find the parts of your code that are allocating large amounts of memory: the extended detail view, the call tree view, and the source view.&lt;/p&gt;&#xA;&lt;h2 id=&#34;extended-detail-view&#34; class=&#34;relative group&#34;&gt;Extended Detail View &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#extended-detail-view&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;When you select a memory allocation from the detail view, the extended detail view shows the call stack for that memory allocation. Examining the call stack can help you find the function in your code that makes the memory allocation. To open the extended detail view, choose View &amp;gt; Extended Detail or click the right button in the View group in the toolbar.&lt;/p&gt;&#xA;&lt;h2 id=&#34;call-tree-view&#34; class=&#34;relative group&#34;&gt;Call Tree View &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#call-tree-view&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The Allocations instrument initially shows the table view, which tells you memory allocation statistics. Switching to the call tree view can help you find where your application allocates memory. Use the jump bar to switch to the call tree view.&lt;/p&gt;&#xA;&lt;p&gt;To the left of the call tree view is the Call Tree collection of checkboxes. Selecting the Invert Call Tree and Hide System Libraries checkboxes can help you quickly find your code in the call tree view.&lt;/p&gt;&#xA;&lt;h2 id=&#34;source-view&#34; class=&#34;relative group&#34;&gt;Source View &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#source-view&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Double-clicking one of your functions from the extended detail view’s call stack or the call tree view opens the source view. The source view highlights the lines of code in the function that are allocating memory and tells you the amount of memory allocated. More information on the source view is available in the &lt;a href=&#34;http://meandmark.com/blog/2010/05/instruments-source-view/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Instruments Source View&lt;/a&gt; post, but keep in mind that some parts of the post do not apply in Xcode 4.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating Custom Xcode 4 Project Templates</title>
      <link>https://www.meandmark.com/creating-custom-xcode-4-project-templates/</link>
      <pubDate>Tue, 06 Dec 2011 01:15:04 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-custom-xcode-4-project-templates/</guid>
      <description>&lt;p&gt;This post contains the material on custom project templates I had prepared for the book. The material was not strong enough to put in the book, mainly because creating custom project templates manually in Xcode 4 is difficult (much more difficult than in previous versions of Xcode) and not documented by Apple. I had a difficult time getting a simple project template to work. But there is not a lot of information available on creating Xcode 4 project templates so I’m making what I wrote available here. I hope it helps you create your own project templates.&lt;/p&gt;&#xA;&lt;p&gt;For more information on Xcode 4 project templates, look at Apple’s templates and read the following articles, which you’ve probably read if you’ve done a Google search for creating project templates in Xcode 4:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://blog.boreal-kiss.net/2011/03/11/a-minimal-project-template-for-xcode-4/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;A minimal project template for Xcode 4&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://snipt.net/yonishin/about-xcode-4-project-template&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;About XCode 4 Project Template (How To Create Custom Project Template)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;project-template-contents&#34; class=&#34;relative group&#34;&gt;Project Template Contents &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#project-template-contents&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;At a minimum a project template consists of two items: a folder with the extension .xctemplate and a property list file named TemplateInfo.plist. You can also have additional files like icon files, source code files, and xib files in the project template. Place these files and the property list file in the template folder.&lt;/p&gt;&#xA;&lt;p&gt;The .xctemplate extension defines the folder as a template folder. The name of the folder is the name that appears in the list of templates for the selected category in the New Project Assistant. The name of the folder is the name of the template.&lt;/p&gt;&#xA;&lt;h2 id=&#34;apple8217s-project-templates&#34; class=&#34;relative group&#34;&gt;Apple’s Project Templates &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#apple8217s-project-templates&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;I recommend duplicating the TemplateInfo.plist file from one of Apple’s templates and using that copy as your TemplateInfo.plist file. You can find Apple’s iOS project templates in the following location:&lt;/p&gt;&#xA;&lt;pre&gt;Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates&lt;/pre&gt;&#xA;&lt;p&gt;The rest of Apple’s project templates are in the following location:&lt;/p&gt;&#xA;&lt;pre&gt;Developer/Library/Xcode/Templates/Project Templates&lt;/pre&gt;&#xA;&lt;p&gt;Developer is where you installed Xcode 4. For Xcode 4.3 and later you can find Apple’s project templates in the Xcode application bundle. Select the Xcode application in the Finder, right-click, and choose Show Package Contents to access the files in the application bundle.&lt;/p&gt;&#xA;&lt;p&gt;Open the TemplateInfo.plist file in Xcode to modify it. I’m going to cover the keys in the TemplateInfo.plist file later in this post.&lt;/p&gt;&#xA;&lt;h2 id=&#34;moving-the-template-folder&#34; class=&#34;relative group&#34;&gt;Moving the Template Folder &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#moving-the-template-folder&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  For Xcode to find your project template you must move the template folder to the user templates folder, which is in the following location:&#xA;&lt;/p&gt;&#xA;&lt;pre&gt;/Users/Username/Library/Developer/Xcode/Templates/Project Templates/GroupName&lt;/pre&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  You may need to manually create some of the folders in the path to the user templates folder. GroupName is the name of the category on the left side of the New Project Assistant. You can create your own group name or use one of the built-in names. Your project template will appear in the GroupName category.&#xA;&lt;/p&gt;&#xA;&lt;h2 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  TemplateInfo.plist Keys&#xA;&lt;/h2&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  The TemplateInfo.plist file has the following keys (this may not be an exhaustive list) for project templates:&#xA;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Ancestors&lt;/li&gt;&#xA;&lt;li&gt;Concrete&lt;/li&gt;&#xA;&lt;li&gt;Definitions&lt;/li&gt;&#xA;&lt;li&gt;Description&lt;/li&gt;&#xA;&lt;li&gt;Identifier&lt;/li&gt;&#xA;&lt;li&gt;InjectionTargets&lt;/li&gt;&#xA;&lt;li&gt;Kind&lt;/li&gt;&#xA;&lt;li&gt;MacOSXVersionMin&lt;/li&gt;&#xA;&lt;li&gt;Nodes&lt;/li&gt;&#xA;&lt;li&gt;Options&lt;/li&gt;&#xA;&lt;li&gt;Platforms&lt;/li&gt;&#xA;&lt;li&gt;Project&lt;/li&gt;&#xA;&lt;li&gt;SortOrder&lt;/li&gt;&#xA;&lt;li&gt;Targets&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  Your template does not have to use all these keys. The data type for the keys is usually one of the following: Array, Boolean, Dictionary, or String.&#xA;&lt;/p&gt;&#xA;&lt;h3 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  Ancestors Key&#xA;&lt;/h3&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  The Ancestors key is an array of strings. The strings are the identifiers of the project templates your template inherits from. If your template has no ancestors, you can ignore this key.&#xA;&lt;/p&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  Suppose your template inherits from Apple’s Cocoa Application template. You want the same options the Apple template has to create a document-based application, to use Core Data, and to add a unit testing bundle. In this case you would need to inherit from Apple’s document-based application, Core Data application, and CoreDataSpotlight application templates. You would add the following ancestor values to your template:&#xA;&lt;/p&gt;&#xA;&lt;pre&gt;com.apple.dt.unit.cocoaDocumentBasedApplication&#xA;com.apple.dt.unit.coreDataApplication&#xA;com.apple.dt.unit.coreDataSpotlightApplication&lt;/pre&gt;&#xA;&lt;h3 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  Concrete Key&#xA;&lt;/h3&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  The Concrete key is a Boolean value. You must set the Concrete key to YES for your template to appear in the New Project Assistant.&#xA;&lt;/p&gt;&#xA;&lt;h3 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  Definitions Key&#xA;&lt;/h3&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  The Definitions key is a dictionary. This key allows you to add comments, includes, and code to source code files. It also allows you to create groups from files or folders in an Xcode workspace. If you use the Definitions key to create groups, you must also have a Nodes key in your project template.&#xA;&lt;/p&gt;&#xA;&lt;h3 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  Description Key&#xA;&lt;/h3&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  The Description key describes the project template. The contents of the Description key appear at the bottom of the New Project Assistant when you select the project template.&#xA;&lt;/p&gt;&#xA;&lt;h3 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  Identifier Key&#xA;&lt;/h3&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  The Identifier key is a string value that uniquely identifies your template. It takes the following form:&#xA;&lt;/p&gt;&#xA;&lt;pre style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;com.CompanyName.TemplateName&lt;/pre&gt;&#xA;&lt;h3 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  InjectionTargets&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;The InjectionTargets key is an array of strings. The strings are the identifiers of project templates. The InjectionTargets key is a new key, which didn’t exist when I originally researched custom project templates. A Google search turned up no results. You’re on your own.&lt;/p&gt;&#xA;&lt;h3 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  Kind Key&#xA;&lt;/h3&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  The Kind key is a string value. It should have the following value:&#xA;&lt;/p&gt;&#xA;&lt;pre style=&#34;margin: 8px;&#34;&gt;Xcode.Xcode3.ProjetTemplateUnitKind&lt;/pre&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;If you inherit from another template, you shouldn’t have to specify the Kind key.&lt;/span&gt;&lt;/p&gt;&#xA;&lt;h3 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  MacOSXVersionMin Key&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;The MacOSXVersionMin key is the earliest version of Mac OS X that can use the template.&lt;/p&gt;&#xA;&lt;h3 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  Nodes Key&#xA;&lt;/h3&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  The Nodes key is an array key that creates a file in the project. Add a string key for each file you want to be created in the project. The value for the key is the name of the file.&#xA;&lt;/p&gt;&#xA;&lt;h3 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  Options Key&#xA;&lt;/h3&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  The Options key is an array that lets you add controls to the New Project Assistant. An example of a custom control is the Type pop-up menu for command-line tool projects that lets you choose the language for the project. The Type menu is an example of a custom control.&#xA;&lt;/p&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  Create a dictionary key for each control you want to add. Add keys to the dictionary key. The following are common keys for controls:&#xA;&lt;/p&gt;&#xA;&lt;ul style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  &lt;li&gt;&#xA;    Type identifies the type of control. Pop-up menus should use a value of popup. Checkboxes should use a value of checkbox. Text fields should use a value of text. Combo boxes should use a value of combo.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Name is the label for the control.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Description contains tool tip text for the control.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Identifier is a string that uniquely identifies the control.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Default is a string that provides a default value for a control.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Values is an array that contains the entries for a combo box or pop-up menu.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Required is a Boolean key that says whether a condition has to be true for the control to be enabled.&#xA;  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;You can see an example of the Required key if you create a Cocoa application. The Document Extension text field is disabled unless you select the Create Document-Based Application checkbox. If you use the Required key, you must add a RequiredOptions dictionary key that contains the conditions.&lt;/p&gt;&#xA;&lt;h3 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  Platforms Key&#xA;&lt;/h3&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  The Platforms key is an array of strings that identifies the platforms the template works on. A Mac project template has the following value:&#xA;&lt;/p&gt;&#xA;&lt;pre&gt;com.apple.platform.macosx&lt;/pre&gt;&#xA;&lt;p style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  An iOS project template has the following value:&#xA;&lt;/p&gt;&#xA;&lt;pre&gt;com.apple.platform.iphoneos&lt;/pre&gt;&#xA;&lt;h3 id=&#34;project-key&#34; class=&#34;relative group&#34;&gt;Project Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#project-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The Project key is a dictionary key that contains build settings. For those of you creating project templates for personal use, I recommend using a configuration settings file instead of placing build setting values in the project template. A reason to add build settings is if you want to add libraries to the project template. Add a build setting for linker flags and add the flags for the libraries, such as -lLibraryName.&lt;/p&gt;&#xA;&lt;p&gt;If you use the Project key to place build settings in the project template, you will most likely need to create additional dictionary keys inside the Project key. Create a Configuration dictionary key for configuration-specific build settings. Inside the Configurations dictionary, create Debug and Release dictionaries. Place your configuration-specific build settings inside the Debug and Release dictionaries. Create a SharedSettings dictionary for any build settings that apply to all build configurations. Place any build settings that apply to all build configurations inside the SharedSettings dictionary.&lt;/p&gt;&#xA;&lt;h3 style=&#34;font-family: &#39;Lucida Grande&#39;;&#34;&gt;&#xA;  SortOrder Key&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;I’m not exactly sure what the SortOrder key does. I haven’t seen a sort order value other than 1 in Apple’s templates.&lt;/p&gt;&#xA;&lt;h3 id=&#34;target-key&#34; class=&#34;relative group&#34;&gt;Target Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#target-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The Targets key is an array key you use to add frameworks, libraries, build phases, and build settings to the template. The build settings you add to the Targets key apply to the target while the build settings you add to the Project key apply to the project.&lt;/p&gt;&#xA;&lt;p&gt;To add frameworks to the template, add a Frameworks key to the Targets key. The Frameworks key should be an array. Add string keys to the Frameworks key. The value of a string key is the name of the framework. None of Apple’s project templates use a library so I don’t know what you have to do to add a library to the Target key.&lt;/p&gt;&#xA;&lt;p&gt;To add build phases, create a dictionary key named BuildPhases. Add a dictionary key for each build phase you want in the project template. At a minimum you need to add a Class string key to the dictionary key that contains the name of the build phase. Use the following values:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Sources is the name for the Compile Sources build phase.&lt;/li&gt;&#xA;&lt;li&gt;Frameworks is the name for the Link Binary with Libraries build phase.&lt;/li&gt;&#xA;&lt;li&gt;Resources is the name for the Copy Bundle Resources build phase.&lt;/li&gt;&#xA;&lt;li&gt;CopyFiles is the name for the Copy Files build phase.&lt;/li&gt;&#xA;&lt;li&gt;ShellScript is the name for the Run Script build phase.&lt;/li&gt;&#xA;&lt;li&gt;Headers is the name for the Copy Headers build phase.&lt;/li&gt;&#xA;&lt;li&gt;Rez is the name for the Build Carbon Resources build phase.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4.2: Application and Logic Unit Test Classes</title>
      <link>https://www.meandmark.com/xcode-4-2-application-and-logic-unit-test-classes/</link>
      <pubDate>Wed, 30 Nov 2011 20:46:30 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-2-application-and-logic-unit-test-classes/</guid>
      <description>&lt;p&gt;In Xcode 4.2 when you add a new Objective-C test case class to your project and click the Next button, you will see a Test Type menu. This menu has two choices: Application and Logic. The menu determines the unit test Xcode adds in the class’s implementation file. If you choose Application, Xcode adds a test for the application delegate. If you choose Logic, Xcode adds a dummy test that asserts 1 + 1 = 2.&lt;/p&gt;&#xA;&lt;p&gt;It doesn’t matter what you choose from the Test Type menu. You’ll probably delete the unit test Xcode creates and add your tests. You can add your tests to both test types.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Open New Tab When Double-Clicking a File</title>
      <link>https://www.meandmark.com/xcode-4-open-new-tab-when-double-clicking-a-file/</link>
      <pubDate>Mon, 28 Nov 2011 18:20:48 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-open-new-tab-when-double-clicking-a-file/</guid>
      <description>&lt;p&gt;Xcode 4 adds support for tabbed editing. When using tabbed editing you most likely want Xcode to open a new tab when you open a file from the project navigator. To get this behavior you must tell Xcode to open a new tab when you double-click a file in the project navigator.&lt;/p&gt;&#xA;&lt;p&gt;Open Xcode’s preferences. Click the General button. Choose Uses Separate Tab from the Double Click Navigation menu.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/11/Xcode-Tabbed-Editing-Prefs.png&#34; border=&#34;0&#34; alt=&#34;Xcode Tabbed Editing Prefs&#34; width=&#34;599&#34; height=&#34;432&#34; /&gt; &#xA;&lt;p&gt;Now when you double-click a file in the project navigator, Xcode opens the file in a new tab.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4 Print Book Now Available</title>
      <link>https://www.meandmark.com/xcode-4-print-book-now-available/</link>
      <pubDate>Wed, 23 Nov 2011 21:00:51 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-print-book-now-available/</guid>
      <description>&lt;p&gt;I am happy to announce that the print version of &lt;em&gt;Xcode Tools Sensei&lt;/em&gt; is available. Go to &lt;a href=&#34;http://www.meandmark.com/xcodebook.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;the book’s site&lt;/a&gt; to buy it. The print version of the book will also be available on Amazon soon. I submitted the book to Amazon last night and was told it would take 5-7 business days for it to appear on Amazon. This means the book should be on Amazon late next week or the week after that. I will add a link to the book’s Amazon page when the book is available on Amazon.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Creating Custom Xcode 4 File Templates</title>
      <link>https://www.meandmark.com/creating-custom-xcode-4-file-templates/</link>
      <pubDate>Thu, 17 Nov 2011 20:36:42 +0000</pubDate>
      <guid>https://www.meandmark.com/creating-custom-xcode-4-file-templates/</guid>
      <description>&lt;p&gt;This post contains the material on custom file templates I had prepared for the book. I decided not to put this material in the book because it wasn’t strong enough for me to support. But information on creating custom file templates in Xcode 4 isn’t easily available so I’m making it available here. I hope it helps you create your own file templates.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-size: 18px; font-weight: bold;&#34;&gt;File Template Contents&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;At a minimum a file template has the following items:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A folder with extension .xctemplate&lt;/li&gt;&#xA;&lt;li&gt;A property list file TemplateInfo.plist&lt;/li&gt;&#xA;&lt;li&gt;The file itself, which usually has the name _\&lt;em&gt;_FILEBASENAME__&lt;/em&gt; (triple underscores)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;File templates can also include additional files, such as xib files and icon files.&lt;/p&gt;&#xA;&lt;p&gt;The .xctemplate extension defines the folder as a template folder. The name of the folder is the name that appears in the list of templates for the selected category in the New File Assistant. The name of the folder is the name of the template.&lt;/p&gt;&#xA;&lt;p&gt;The extension for the _\&lt;em&gt;_FILEBASENAME__&lt;/em&gt; file depends on the language. If you create a C, C++, or Objective-C template, there may be a second file for the header file.&lt;/p&gt;&#xA;&lt;h2 id=&#34;apple8217s-file-templates&#34; class=&#34;relative group&#34;&gt;Apple’s File Templates &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#apple8217s-file-templates&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The easiest way to create a custom file template is to copy one of Apple’s templates and modify it to suit your needs. Apple’s file templates also provide good examples that you can study to help you build your own templates. Apple’s iOS file templates are in the following location:&lt;/p&gt;&#xA;&lt;pre&gt;Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/File Templates&lt;/pre&gt;&#xA;&lt;p&gt;The rest of Apple’s file templates are in the following location:&lt;/p&gt;&#xA;&lt;pre&gt;Developer/Library/Xcode/Templates/File Templates&lt;/pre&gt;&#xA;&lt;p&gt;Developer is where you installed Xcode. For Xcode 4.3 and later you can find Apple’s file templates in the Xcode application bundle. Select the Xcode application in the Finder, right-click, and choose Show Package Contents to access the files in the application bundle.&lt;/p&gt;&#xA;&lt;h2 id=&#34;making-changes-to-existing-templates&#34; class=&#34;relative group&#34;&gt;Making Changes to Existing Templates &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#making-changes-to-existing-templates&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;After creating a copy of one of Apple’s templates, you must modify the files to customize them. Open the _\&lt;em&gt;_FILEBASENAME__&lt;/em&gt; file and the TemplateInfo.plist file in Xcode to make your changes. I’m going to cover the keys in the TemplateInfo.plist file later in this post.&lt;/p&gt;&#xA;&lt;h2 id=&#34;moving-the-template-folder&#34; class=&#34;relative group&#34;&gt;Moving the Template Folder &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#moving-the-template-folder&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;For Xcode to find your file template you must move the template folder to the user templates folder, which is in the following location:&lt;/p&gt;&#xA;&lt;pre&gt;/Users/Username/Library/Developer/Xcode/Templates/File Templates/GroupName&lt;/pre&gt;&#xA;&lt;p&gt;You may need to manually create some of the folders in the path to the user templates folder. GroupName is the name of the category on the left side of the New File Assistant. You can create your own group name or use one of the built-in names. Your file template will appear in the GroupName category.&lt;/p&gt;&#xA;&lt;h2 id=&#34;templateinfoplist-keys&#34; class=&#34;relative group&#34;&gt;TemplateInfo.plist Keys &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#templateinfoplist-keys&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The TemplateInfo.plist file has the following keys (this may not be an exhaustive list) for file templates:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;AllowedTypes&lt;/li&gt;&#xA;&lt;li&gt;CounterpartTemplateFile&lt;/li&gt;&#xA;&lt;li&gt;DefaultCompletionName&lt;/li&gt;&#xA;&lt;li&gt;Description&lt;/li&gt;&#xA;&lt;li&gt;Kind&lt;/li&gt;&#xA;&lt;li&gt;MainTemplateFile&lt;/li&gt;&#xA;&lt;li&gt;MacOSXVersionMin&lt;/li&gt;&#xA;&lt;li&gt;Options&lt;/li&gt;&#xA;&lt;li&gt;Platforms&lt;/li&gt;&#xA;&lt;li&gt;SortOrder&lt;/li&gt;&#xA;&lt;li&gt;Summary&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Your template does not have to use all these keys. The data type for the keys is usually one of the following: Array, Boolean, Dictionary, or String.&lt;/p&gt;&#xA;&lt;h3 id=&#34;allowedtypes-key&#34; class=&#34;relative group&#34;&gt;AllowedTypes Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#allowedtypes-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The AllowedTypes key is an array that contains allowed file types. Source code file templates use this key. The following are examples of common allowed types:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;public.objective-c-source (Objective-C)&lt;/li&gt;&#xA;&lt;li&gt;public.objective-c-plus-plus-source (Objective C++)&lt;/li&gt;&#xA;&lt;li&gt;public.c-source (C)&lt;/li&gt;&#xA;&lt;li&gt;public.c-plus-plus.source (C++)&lt;/li&gt;&#xA;&lt;li&gt;public.c-header (header file for C, C++, Objective C)&lt;/li&gt;&#xA;&lt;li&gt;public.ruby-script (Ruby)&lt;/li&gt;&#xA;&lt;li&gt;public.python-script (Python)&lt;/li&gt;&#xA;&lt;li&gt;com.sun.java-class (Java .class file)&lt;/li&gt;&#xA;&lt;li&gt;com.sun.java-source (Java .java file)&lt;/li&gt;&#xA;&lt;li&gt;public.xml (XML)&lt;/li&gt;&#xA;&lt;li&gt;public.source-code (generic source code)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Use the public.source-code type for languages other than the ones I listed.&lt;/p&gt;&#xA;&lt;h3 id=&#34;counterparttemplatefile-key&#34; class=&#34;relative group&#34;&gt;CounterpartTemplateFile Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#counterparttemplatefile-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Only languages that have header files use the CounterpartTemplateFile key. Supply the name of the header file.&lt;/p&gt;&#xA;&lt;h3 id=&#34;defaultcompletionname-key&#34; class=&#34;relative group&#34;&gt;DefaultCompletionName Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#defaultcompletionname-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The DefaultCompletionName key contains the initial name for the file. When you save the file for the first time, this name appears as the file name in the Save panel.&lt;/p&gt;&#xA;&lt;h3 id=&#34;description-key&#34; class=&#34;relative group&#34;&gt;Description Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#description-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The Description key describes the file template. The contents of the Description key appear at the bottom of the New File Assistant when you select the file template.&lt;/p&gt;&#xA;&lt;h3 id=&#34;kind-key&#34; class=&#34;relative group&#34;&gt;Kind Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#kind-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Text files have the following Kind key value:&lt;/p&gt;&#xA;&lt;pre&gt;Xcode.IDEKit.TextSubstitutionFileTemplateKind&lt;/pre&gt;&#xA;&lt;h3 id=&#34;maintemplatefile-key&#34; class=&#34;relative group&#34;&gt;MainTemplateFile Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#maintemplatefile-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The value of MainTemplateFile should be the name of the file in the .xctemplate folder. It generally has the following value:&lt;/p&gt;&#xA;&lt;pre&gt;___FILEBASENAME___.Extension(triple underscores)&lt;/pre&gt;&#xA;&lt;p&gt;Where Extension depends on the type of file you’re creating. For C, C++, and Objective-C files, the main template file is the implementation file, not the header file. The extension for an Objective-C file is .m.&lt;/p&gt;&#xA;&lt;h3 id=&#34;macosxversionmin-key&#34; class=&#34;relative group&#34;&gt;MacOSXVersionMin Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#macosxversionmin-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The MacOSXVersionMin key is the earliest version of Mac OS X that can use the template.&lt;/p&gt;&#xA;&lt;h3 id=&#34;options-key&#34; class=&#34;relative group&#34;&gt;Options Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#options-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The Options key is an array that lets you add controls to the New File Assistant. You can see an example of a custom control if you add an Objective-C class to a project. When you add an Objective-C class, there is a combo box that lets you choose the subclass. The combo box is an example of a custom control.&lt;/p&gt;&#xA;&lt;p&gt;Create a dictionary key for each control you want to add. Add keys to the dictionary key. The following are common keys for controls:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Type identifies the type of control. Pop-up menus should use a value of popup. Checkboxes should use a value of checkbox. Text fields should use a value of text. Combo boxes should use a value of combo.&lt;/li&gt;&#xA;&lt;li&gt;Name is the label for the control.&lt;/li&gt;&#xA;&lt;li&gt;Description contains tool tip text for the control.&lt;/li&gt;&#xA;&lt;li&gt;Identifier is a string that uniquely identifies the control.&lt;/li&gt;&#xA;&lt;li&gt;Default is a string that provides a default value for a control.&lt;/li&gt;&#xA;&lt;li&gt;Values is an array that contains the entries for a combo box or pop-up menu.&lt;/li&gt;&#xA;&lt;li&gt;Required is a Boolean key that says whether a condition has to be true for the control to be enabled.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;platforms-key&#34; class=&#34;relative group&#34;&gt;Platforms Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#platforms-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The Platforms key is an array of strings that identifies the platforms the template works on. A Mac file template has the following value:&lt;/p&gt;&#xA;&lt;pre&gt;com.apple.platform.macosx&lt;/pre&gt;&#xA;&lt;p&gt;An iOS file template has the following value:&lt;/p&gt;&#xA;&lt;pre&gt;com.apple.platform.iphoneos&lt;/pre&gt;&#xA;&lt;h3 id=&#34;sortorder-key&#34; class=&#34;relative group&#34;&gt;SortOrder Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#sortorder-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I’m not exactly sure what the SortOrder key does. I haven’t seen a sort order value other than 1 in Apple’s templates.&lt;/p&gt;&#xA;&lt;h3 id=&#34;summary-key&#34; class=&#34;relative group&#34;&gt;Summary Key &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#summary-key&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The Summary key summarizes what the file template does. The summary is a shorter form of the file template’s description.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>SDL OpenGL Typedef Redefinition Error on Mac OS X 10.7</title>
      <link>https://www.meandmark.com/sdl-opengl-typedef-redefinition-error-on-mac-os-x-10-7/</link>
      <pubDate>Mon, 07 Nov 2011 19:00:28 +0000</pubDate>
      <guid>https://www.meandmark.com/sdl-opengl-typedef-redefinition-error-on-mac-os-x-10-7/</guid>
      <description>&lt;p&gt;If you build a SDL OpenGL application for Mac OS X using SDL 1.2.14 (using the binary installer at the SDL site) and the Mac OS X 10.7 SDK, you can get the following error:&lt;/p&gt;&#xA;&lt;pre&gt;typedef redefinition with different types (&#39;unsigned int&#39; vs &#39;void *&#39;)&lt;/pre&gt;&#xA;&lt;p&gt;The SDL header file SDL_opengl.h and the OpenGL header file glext.h both define a data type GLhandleARB. SDL_opengl.h defines it as an unsigned integer. The Mac OS X 10.7 version of glext.h defines it as a void pointer. Defining GLhandleARB as different data types in different header files causes problems.&lt;/p&gt;&#xA;&lt;p&gt;The SDL team fixed the problem in their &lt;a href=&#34;http://hg.libsdl.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Mercurial repository&lt;/a&gt;. The fix is not too difficult to apply. In your SDL_opengl.h file, change the following line of code:&lt;/p&gt;&#xA;&lt;pre&gt;typedef unsigned int GLhandleARB;&lt;/pre&gt;&#xA;&lt;p&gt;To the following:&lt;/p&gt;&#xA;&lt;pre&gt;#if defined(__APPLE__)  &#xA;&#x9;typedef void *GLhandleARB;&#xA;#else    &#xA;&#x9;typedef unsigned int GLhandleARB;&#xA;#endif&lt;/pre&gt;&#xA;&lt;p&gt;The fix defines GLhandleARB as a void pointer on Mac OS X and an unsigned integer on other operating systems.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4.2 Convert to ARC Troubleshooting</title>
      <link>https://www.meandmark.com/xcode-4-2-convert-to-arc-troubleshooting/</link>
      <pubDate>Thu, 03 Nov 2011 18:50:27 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-2-convert-to-arc-troubleshooting/</guid>
      <description>&lt;p&gt;One of Xcode 4.2’s new features is compiler support for ARC (Automatic Reference Counting), which automates memory management of Objective-C objects. Xcode 4.2 includes a refactoring tool to convert an existing project to ARC. Choose Edit &amp;gt; Refactor &amp;gt; Convert to Objective-C ARC. When you convert a project to ARC, a sheet opens that walks you through the conversion. But there are a couple of problems that can occur.&lt;/p&gt;&#xA;&lt;h2 id=&#34;problem-1-clicking-the-save-button-does-nothing&#34; class=&#34;relative group&#34;&gt;Problem 1: Clicking the Save Button Does Nothing &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#problem-1-clicking-the-save-button-does-nothing&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;In the last step of the conversion, Xcode shows the changes it will make to each file when it does the conversion. Clicking the Save button is supposed to complete the conversion, but you may find nothing happens when you click the Save button. The only way to close the sheet is to click the Cancel button.&lt;/p&gt;&#xA;&lt;p&gt;You can get this problem if your project is in a git repository. Xcode is set to take a snapshot of your project when you convert it to ARC. But snapshots do not work well with git repositories. Xcode tries to take a snapshot, the snapshot fails, and Xcode stops the conversion.&lt;/p&gt;&#xA;&lt;p&gt;The workaround is to move the .git folder out of your project folder temporarily, convert the project, and move the .git folder back. Files that start with a period are hidden by default in the Finder so you will either have to use the Terminal to move the .git folder or use a utility that shows hidden folders in the Finder.&lt;/p&gt;&#xA;&lt;h2 id=&#34;problem-2-release-builds-of-mac-projects-generate-build-errors&#34; class=&#34;relative group&#34;&gt;Problem 2: Release Builds of Mac Projects Generate Build Errors &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#problem-2-release-builds-of-mac-projects-generate-build-errors&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;After converting your project to ARC, you may get the following error when you build your project:&lt;/p&gt;&#xA;&lt;pre&gt;-fobjc-arc is not supported with fragile abi&lt;/pre&gt;&#xA;&lt;p&gt;Xcode generates this error when you try to build a 32-bit version of a Mac application that uses ARC. ARC can build only 64-bit Mac applications. The Release build configuration is set to build both 32-bit and 64-bit Intel binaries. The error occurs when building with the Release build configuration because Xcode is trying to build a 32-bit version of your project, which ARC does not support. The solution is to set the Architectures build setting to 64-bit Intel.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode Book Updated for Xcode 4.2</title>
      <link>https://www.meandmark.com/xcode-book-updated-for-xcode-4-2/</link>
      <pubDate>Tue, 01 Nov 2011 23:15:33 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-book-updated-for-xcode-4-2/</guid>
      <description>&lt;p&gt;The electronic version of &lt;em&gt;Xcode Tools Sensei&lt;/em&gt; has been updated for Xcode 4.2. Go to &lt;a href=&#34;http://www.meandmark.com/xcodebook.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;the book’s site&lt;/a&gt; to buy it. You can also read the table of contents, introduction, and a sample chapter at the book’s site.&lt;/p&gt;&#xA;&lt;p&gt;You may be wondering when the print version will be available. The release of the print book is weeks away. I have to layout the print book, create the index, and have a test copy shipped to me to make sure there are no glaring errors before I can release the print version.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Setting Compiler Flags for a Single File</title>
      <link>https://www.meandmark.com/xcode-4-setting-compiler-flags-for-a-single-file/</link>
      <pubDate>Mon, 24 Oct 2011 17:20:49 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-setting-compiler-flags-for-a-single-file/</guid>
      <description>&lt;p&gt;In Xcode 4 you can set compiler flags for a single file from the target’s Compile Sources build phase.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select the project file from the project navigator to open the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Select the target from the left side of the project editor.&lt;/li&gt;&#xA;&lt;li&gt;Click the Build Phases button at the top of the editor.&lt;/li&gt;&#xA;&lt;li&gt;Click the disclosure triangle next to the Compile Sources build phase.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/10/Compiler-Flags-Single-File.png&#34; border=&#34;0&#34; alt=&#34;Compiler Flags Single File&#34; width=&#34;479&#34; height=&#34;145&#34; /&gt; &#xA;&lt;p&gt;Select the file where you want to set the compiler flags. Double-click the Compiler Flags column to open a pop-up editor, which is where you enter the flags.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Event Profiler and Counters Instruments</title>
      <link>https://www.meandmark.com/event-profiler-and-counters-instruments/</link>
      <pubDate>Wed, 19 Oct 2011 01:00:43 +0000</pubDate>
      <guid>https://www.meandmark.com/event-profiler-and-counters-instruments/</guid>
      <description>&lt;p&gt;Xcode 4.2 adds two instruments for Mac applications that users of the Shark performance tool will appreciate. The Event Profiler instrument records a sample when a low-level event occurs. The Counters instrument samples your application and collects PMC (Performance Monitor Counter) events. PMC events are low-level CPU events, such as incorrectly predicted branches and cache misses.&lt;/p&gt;&#xA;&lt;p&gt;Before you trace with the Event Profiler and Counters instruments, you must first configure them. Click the Info button next to the instrument in the instrument list to open a pop-up editor. The pop-up editor is where you configure the instrument. You must tell the Event Profiler instrument the event that triggers sampling. Choose an event from the Event Name menu.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/10/Event-Profiler-Instrument-Configuration.png&#34; border=&#34;0&#34; alt=&#34;Event Profiler Instrument Configuration&#34; width=&#34;282&#34; height=&#34;282&#34; /&gt; &#xA;&lt;p&gt;You must specify the PMC events to collect to use the Counters instrument. Click the + button to add an event to the Counters list. Choose an event from the pop-up cell.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/10/Counters-Instrument-Configuration.png&#34; border=&#34;0&#34; alt=&#34;Counters Instrument Configuration&#34; width=&#34;283&#34; height=&#34;449&#34; /&gt; &#xA;&lt;p&gt;When you choose PMC events to collect for the Counters instrument, Instruments shows only a subset of the available PMC events. Choose Window &amp;gt; Manage PM Events to control the PMC events the Counters instrument can collect.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/10/PMC-Event-Manager.png&#34; border=&#34;0&#34; alt=&#34;PMC Event Manager&#34; width=&#34;452&#34; height=&#34;141&#34; /&gt; &#xA;&lt;p&gt;Most of the PMC events are hidden initially. Choose Visible from the State pop-up cell to make that event visible. When you add an event for the Counters instrument to collect, the event you made visible should be one of the choices in the pop-up cell.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Using Makefiles in Xcode 4</title>
      <link>https://www.meandmark.com/using-makefiles-in-xcode-4/</link>
      <pubDate>Wed, 12 Oct 2011 19:09:33 +0000</pubDate>
      <guid>https://www.meandmark.com/using-makefiles-in-xcode-4/</guid>
      <description>&lt;p&gt;Sometimes I read questions from developers who want to use makefiles in Xcode. The short answer to their questions is to create an external build system project. The rest of this article provides a longer answer for those of you using Xcode 4.&lt;/p&gt;&#xA;&lt;h2 id=&#34;create-an-external-build-system-project&#34; class=&#34;relative group&#34;&gt;Create an External Build System Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#create-an-external-build-system-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;An external build system project uses something besides Xcode to build the project. By using an external build system project you can use another build tool, such as make, ant, CMake, and SCons to build the project. An external build system also lets you use languages Xcode does not directly support. Supply the path to the language’s compiler when creating the project.&lt;/p&gt;&#xA;&lt;p&gt;Choose File &amp;gt; New &amp;gt; New Project to create a new project. The external build system project is in the Other section under Mac OS X.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/10/External-Build-System-Project-Step-1.png&#34; border=&#34;0&#34; alt=&#34;External Build System Project Step 1&#34; width=&#34;600&#34; height=&#34;404&#34; /&gt; &#xA;&lt;p&gt;After selecting the external build system project, click the Next button to move on to the next step. In the next step you name the project and supply the path to the build tool. Xcode is initially configured to use make so you should not have to change the build tool if you’re using a makefile.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/10/External-Build-System-Project-Step-2.png&#34; border=&#34;0&#34; alt=&#34;External Build System Project Step 2&#34; width=&#34;600&#34; height=&#34;404&#34; /&gt; &#xA;&lt;p&gt;If you’re running Xcode 4.2 or later you will see the Use Automatic Reference Counting checkbox. This checkbox applies only to Objective-C code. If you’re not using Objective-C, deselect the checkbox.&lt;/p&gt;&#xA;&lt;p&gt;After naming the project, click the Next button. Choose a location to save the project, and click the Create button to finish creating the project.&lt;/p&gt;&#xA;&lt;h2 id=&#34;add-files-to-the-project&#34; class=&#34;relative group&#34;&gt;Add Files to the Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#add-files-to-the-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Now that you’ve created an external build system project, you must add the makefile and source code files to the project. If you have existing files, choose File &amp;gt; Add Files to ProjectName to add the files to the project. Choose File &amp;gt; New &amp;gt; New File to add a blank file to your project. Xcode does not have a makefile file template. Add an empty file to the project to add a new makefile. The empty file template is in the Other section under Mac OS X.&lt;/p&gt;&#xA;&lt;h2 id=&#34;configuring-the-build-tool&#34; class=&#34;relative group&#34;&gt;Configuring the Build Tool &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#configuring-the-build-tool&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;If you need to configure the build tool, use the project editor. Choose the project file from the project navigator on the left side of the project window to open the project editor.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/10/External-Build-Tool-Configuration.png&#34; border=&#34;0&#34; alt=&#34;External Build Tool Configuration&#34; width=&#34;600&#34; height=&#34;137&#34; /&gt; &#xA;&lt;p&gt;Select the target from the target list. Click the Info button at the top of the editor, which you can see in the screenshot.&lt;/p&gt;&#xA;&lt;h2 id=&#34;build-the-project&#34; class=&#34;relative group&#34;&gt;Build the Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#build-the-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Click the Run button or use the Product menu to build the project. Xcode builds the project using the makefile. If you chose a different build tool, Xcode uses the tool you specified to build the project.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4 Book Available (Electronic Version)</title>
      <link>https://www.meandmark.com/xcode-4-book-available-electronic-version/</link>
      <pubDate>Mon, 10 Oct 2011 17:17:33 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-book-available-electronic-version/</guid>
      <description>&lt;p&gt;I am happy to announce that a new electronic version of &lt;em&gt;Xcode Tools Sensei&lt;/em&gt; is now available. Go to &lt;a href=&#34;http://www.meandmark.com/xcodebook.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;the book’s site&lt;/a&gt; to buy it. You can also read the table of contents, introduction, and a sample chapter at the book’s site.&lt;/p&gt;&#xA;&lt;p&gt;The current version of the book covers Xcode 4.1. I will update the book for Xcode 4.2 when Apple releases it to the public. Anyone who buys the current electronic version of the book is eligible for a free update to the Xcode 4.2 version of the book when it becomes available. On the book’s order form is a checkbox to sign up for the book’s mailing list. If you sign up for the mailing list, you will be notified when the Xcode 4.2 version comes out.&lt;/p&gt;&#xA;&lt;h3 id=&#34;update-october-11&#34; class=&#34;relative group&#34;&gt;Update: October 11 &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update-october-11&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The store for the ebook was in test mode, which meant you couldn’t buy the book. The store is now active so you should be able to buy the book now. I apologize for the inconvenience.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4 Book Should be Ready Next Week</title>
      <link>https://www.meandmark.com/xcode-4-book-should-be-ready-next-week/</link>
      <pubDate>Wed, 05 Oct 2011 06:08:03 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-book-should-be-ready-next-week/</guid>
      <description>&lt;p&gt;I just finished laying out the last chapter. Now I have to proofread the book and get the website ready for the book launch.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>uDevGames Voting Begins</title>
      <link>https://www.meandmark.com/udevgames-voting-begins/</link>
      <pubDate>Mon, 03 Oct 2011 18:15:46 +0000</pubDate>
      <guid>https://www.meandmark.com/udevgames-voting-begins/</guid>
      <description>&lt;p&gt;The entries in the Mac game development contest uDevGames are finished and voting has started. The voting ends on October 13 at 11:59 PM GMT, with the winners announced on October 14. If you have a Mac, you can download and play all the entries by going to the following URL:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://www.udevgames.com/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;http://www.udevgames.com/&lt;/a&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4 Book Status Report: September 19</title>
      <link>https://www.meandmark.com/xcode-4-book-status-report-september-19/</link>
      <pubDate>Mon, 19 Sep 2011 04:19:24 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-book-status-report-september-19/</guid>
      <description>&lt;p&gt;I have started laying out chapters for the electronic version of the book, which is good news.&lt;/p&gt;&#xA;&lt;p&gt;The first version of the ebook covers Xcode 4.1. I will update the ebook for Xcode 4.2, which will be a free update for anyone who buys the Xcode 4.1 version. The print version will cover Xcode 4.2. Xcode 4.2 should be released by the time the print version is finished.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4 Book Status Report: September 6</title>
      <link>https://www.meandmark.com/xcode-4-book-status-report-september-6/</link>
      <pubDate>Tue, 06 Sep 2011 19:40:06 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-book-status-report-september-6/</guid>
      <description>&lt;p&gt;I’m still cleaning up material. The Instruments material has been more difficult to clean up than I anticipated. I’m still working on cleaning up the material on the Time Profiler instrument and general material on interpreting the trace results.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4 Book Status Report: August 22</title>
      <link>https://www.meandmark.com/xcode-4-book-status-report-august-22/</link>
      <pubDate>Mon, 22 Aug 2011 16:54:52 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-book-status-report-august-22/</guid>
      <description>&lt;p&gt;I cleaned up the modeling tools chapter enough to move it to the almost ready to layout category. I proofread some sections of the Interface Builder and debugging chapters so they’re closer to being in the ready to layout category.&lt;/p&gt;&#xA;&lt;p&gt;Right now I’m working on the Instruments chapter, which is the largest remaining obstacle to finishing the book. The Instruments chapter has the following main topics:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Setting up a trace.&lt;/li&gt;&#xA;&lt;li&gt;Running a trace.&lt;/li&gt;&#xA;&lt;li&gt;General material on interpreting the trace results that applies to most instruments.&lt;/li&gt;&#xA;&lt;li&gt;Instrument-specific results for the Leaks, Allocations, Time Profiler, OpenGL ES Analyzer, and Activity Monitor instruments.&lt;/li&gt;&#xA;&lt;li&gt;Creating custom instruments.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Topics 1 and 2 are cleaned up. This week I’m going to be busy cleaning up the rest of the Instruments chapter.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>New Xcode Project for SDL OpenGL Article</title>
      <link>https://www.meandmark.com/new-xcode-project-for-sdl-opengl-article/</link>
      <pubDate>Tue, 16 Aug 2011 19:34:39 +0000</pubDate>
      <guid>https://www.meandmark.com/new-xcode-project-for-sdl-opengl-article/</guid>
      <description>&lt;p&gt;I added a link to the sidebar of my &lt;a href=&#34;http://www.meandmark.com/sdlopenglpart1.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;SDL OpenGL article&lt;/a&gt; that contains a version of the project updated for Xcode 4.1. The original project had several problems building on Xcode 4.1 that persisted after I modernized the project. The updated version of the project works on Xcode 4.1 and uses the Mac OS X 10.7 SDK. I have not tested the project on Xcode 4.0, but at a minimum, you must change the Base SDK to 10.6 to get the project to work on Xcode 4.0.&lt;/p&gt;&#xA;&lt;p&gt;The original project is still there. I just added another version to make things easier for people using Xcode 4.1.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4 Book Status Report: August 15</title>
      <link>https://www.meandmark.com/xcode-4-book-status-report-august-15/</link>
      <pubDate>Mon, 15 Aug 2011 17:38:58 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-book-status-report-august-15/</guid>
      <description>&lt;p&gt;Here’s how the cleanup of the material is coming along.&lt;/p&gt;&#xA;&lt;p&gt;Ready to layout: projects, code editing, version control, command-line tools, and OpenGL tools chapters&lt;/p&gt;&#xA;&lt;p&gt;Almost ready to layout: debugging and Interface Builder chapters&lt;/p&gt;&#xA;&lt;p&gt;More cleanup to do: modeling tools, building projects, and Instruments chapters&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Installing Mac Compilers Without Using Xcode</title>
      <link>https://www.meandmark.com/installing-mac-compilers-without-using-xcode/</link>
      <pubDate>Wed, 10 Aug 2011 20:27:59 +0000</pubDate>
      <guid>https://www.meandmark.com/installing-mac-compilers-without-using-xcode/</guid>
      <description>&lt;p&gt;Most programmers with a Mac install Xcode when they need a C/C++/Objective-C compiler because Xcode includes everything you need to write C, C++, and Objective C code on Mac OS X. Xcode is a large download and is excessive if all you want to do is install GCC, LLVM, or Clang on your Mac. Kenneth Reitz has placed a compiler installer on Github that lets you install GCC, LLVM, and Clang without downloading Xcode. You can learn more by clicking the following link:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/kennethreitz/osx-gcc-installer&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;os-x-gcc-installer&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;I have Xcode installed so I haven’t tested the installer, but I know some Mac-using programmers will be interested in this.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Supplying a Method Name to an Objective-C Custom Instrument</title>
      <link>https://www.meandmark.com/supplying-a-method-name-to-an-objective-c-custom-instrument/</link>
      <pubDate>Wed, 10 Aug 2011 02:04:50 +0000</pubDate>
      <guid>https://www.meandmark.com/supplying-a-method-name-to-an-objective-c-custom-instrument/</guid>
      <description>&lt;p&gt;One of Instruments’ most powerful features is the ability to create your own instruments. Apple supplies an Objective-C provider to DTrace, which Instruments is built on. In the Objective-C provider, you can tell a probe to fire when you enter or exit an Objective-C method. Supplying the method name can be tricky, especially if the method takes multiple arguments. This post shows you how to supply a method name to an Objective-C custom instrument.&lt;/p&gt;&#xA;&lt;p&gt;Create a new instrument in Instruments by choosing Instrument &amp;gt; Build New Instrument. If you choose the Objective-C provider, the top of the probe looks like the following:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/08/Objective-C-Probe.png&#34; border=&#34;0&#34; alt=&#34;Objective C Probe&#34; width=&#34;600&#34; height=&#34;39&#34; /&gt; &#xA;&lt;p&gt;As you can see in the screenshot, you can supply a class and a method name to limit when the probe fires. Suppose you want the probe to fire when you enter an Objective-C method. You would enter the following for a method that takes no arguments:&lt;/p&gt;&#xA;&lt;pre&gt;-MethodName  (Instance method)&#xA;+MethodName  (Class method)&lt;/pre&gt;&#xA;&lt;p&gt;If the method takes one argument, place a colon after the method name.&lt;/p&gt;&#xA;&lt;pre&gt;-MethodName:&lt;/pre&gt;&#xA;&lt;p&gt;Things become more complicated if the method takes multiple arguments. You can’t have multiple colons in the method name text field because DTrace interprets colons as provider field separators. Use question marks instead of colons to separate the method’s arguments. Let’s look at an example. Suppose you have the following Objective-C method in your application:&lt;/p&gt;&#xA;&lt;pre&gt;- (BOOL)readFromFileWrapper:(NSFileWrapper*)appFileWrapper ofType:(NSString*)typeName error:(NSError**)outError&lt;/pre&gt;&#xA;&lt;p&gt;You would enter the following as the method name:&lt;/p&gt;&#xA;&lt;pre&gt;-readFromFileWrapper?ofType?error?&lt;/pre&gt;&#xA;&lt;p&gt;Notice how you enter the argument name, which is the text to the left of the colon, and a question mark for each argument.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4.1: Modernizing Projects</title>
      <link>https://www.meandmark.com/xcode-4-1-modernizing-projects/</link>
      <pubDate>Mon, 25 Jul 2011 02:09:01 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-1-modernizing-projects/</guid>
      <description>&lt;p&gt;When you open a project in Xcode 4.1, Xcode checks the project for any outdated settings like build settings, SDKs, and project file formats. If Xcode finds any outdated settings, they appear as a Project Modernization warning in the issue navigator. Select the Project Modernization warning or choose Editor &amp;gt; Modernize Project to update the project.&lt;/p&gt;&#xA;&lt;p&gt;Checking for outdated settings makes working with old Xcode projects easier. If you have ever downloaded an old Xcode project and been unable to build it due to a missing SDK, you will appreciate Xcode’s ability to modernize a project.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4 Book Status Report: June 13</title>
      <link>https://www.meandmark.com/xcode-4-book-status-report-june-13/</link>
      <pubDate>Mon, 13 Jun 2011 18:35:33 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-book-status-report-june-13/</guid>
      <description>&lt;p&gt;I have moved from the writing to the rewriting phase. What this means I have the material written. Now I have to clean up the material I’ve written: improving explanations, eliminating redundancies, and proofreading. With several hundred pages of material to go through, cleaning up the material is going to take a while. I hope to start laying out the electronic version of the book in a few weeks.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4 Book Status Update: May 21</title>
      <link>https://www.meandmark.com/xcode-4-book-status-update-may-21/</link>
      <pubDate>Sun, 22 May 2011 02:18:59 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-book-status-update-may-21/</guid>
      <description>&lt;p&gt;The book is coming along, but not as quickly as I want. I spent a bunch of time on custom project templates and came to the realization that Xcode 4 project templates were not meant to be created manually. I am not going to put the custom project template material in the book because I do not have enough confidence in the material to put it in print, but I will make the material available online.&lt;/p&gt;&#xA;&lt;p&gt;The Instruments and Interface Builder chapters are the chapters that have the most work to do. I have been working on the Instruments chapter the past few days and hope to have it ready for proofreading in the next few days.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Unit Testing 64-Bit Mac Apps</title>
      <link>https://www.meandmark.com/xcode-4-unit-testing-64-bit-mac-apps/</link>
      <pubDate>Thu, 12 May 2011 21:35:16 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-unit-testing-64-bit-mac-apps/</guid>
      <description>&lt;p&gt;When unit-testing a 64-bit Mac application, make sure the class files you are testing (your application’s implementation files) are members of the unit testing target. You will get linker errors when building the unit testing target if the class files being tested are not members of the unit testing target.&lt;/p&gt;&#xA;&lt;p&gt;How do you make a file a member of the unit testing target? Open the file inspector by choosing View &amp;gt; Utilities &amp;gt; File Inspector. Select the file from the project navigator. Select the checkbox for the unit testing target in the Target Membership section of the file inspector.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/05/Xcode4TargetMembership.png&#34; border=&#34;0&#34; alt=&#34;Xcode4TargetMembership&#34; width=&#34;256&#34; height=&#34;78&#34; /&gt;</description>
    </item>
    <item>
      <title>Xcode 4: Removing Files from a Project</title>
      <link>https://www.meandmark.com/xcode-4-removing-files-from-a-project/</link>
      <pubDate>Mon, 09 May 2011 18:06:22 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-removing-files-from-a-project/</guid>
      <description>&lt;p&gt;To remove a file from an Xcode project, select the file from the project navigator and press the Delete key. An alert like the following opens:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/05/Xcode4DeleteFile.png&#34; alt=&#34;Xcode4DeleteFile&#34; width=&#34;529&#34; height=&#34;153&#34; border=&#34;0&#34; /&gt; &#xA;&lt;p&gt;If you want to delete the file, the safest thing to do is click the Remove Reference Only button, then move the file to the Trash. Clicking the Delete button permanently deletes the file, which means the only ways to recover the file are to restore a backup or use a data recovery tool. Unless you’re absolutely sure you want to delete the file, click the Remove Reference Only button.&lt;/p&gt;&#xA;&lt;h3 id=&#34;update-may-2012&#34; class=&#34;relative group&#34;&gt;Update: May 2012 &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update-may-2012&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I noticed in Xcode 4.3.2 that the Delete button referenced in the screenshot now says Move to Trash. I’m not sure which version of Xcode introduced this change as I don’t delete files from projects often.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4 Book Status Update (Late April)</title>
      <link>https://www.meandmark.com/xcode-4-book-status-update-late-april/</link>
      <pubDate>Sat, 30 Apr 2011 22:48:54 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-book-status-update-late-april/</guid>
      <description>&lt;p&gt;The book is still several weeks away from being finished. I’m not sure if I can reach my goal of finishing the ebook in May, but if I do reach the goal, it will be late May. I am working on the book every day and making steady progress. When the book is finished, I will update this blog and the book’s website.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Saving a Property List in a File Wrapper</title>
      <link>https://www.meandmark.com/saving-a-property-list-in-a-file-wrapper/</link>
      <pubDate>Thu, 14 Apr 2011 01:20:13 +0000</pubDate>
      <guid>https://www.meandmark.com/saving-a-property-list-in-a-file-wrapper/</guid>
      <description>&lt;p&gt;Saving a property list in a file wrapper takes two steps. First, call NSPropertyListSerialization’s dataFromPropertyList: or dataWithPropertyList: methods to create a property list. The dataWithPropertyList: method was introduced in Mac OS X 10.6. Use dataFromPropertyList: if you are supporting earlier versions of Mac OS X.&lt;/p&gt;&#xA;&lt;pre&gt;NSMutableDictionary* root;&#xA;NSError* error;&#xA;NSData* propertyList = [NSPropertyListSerialization dataWithPropertyList:root format:NSPropertyListXMLFormat_v1_0 options:0 error:&amp;error];&lt;/pre&gt;&#xA;&lt;p&gt;Second, pass the property list you created as the first argument to NSFileWrapper’s addRegularFileWithContents: method.&lt;/p&gt;&#xA;&lt;pre&gt;NSFileWrapper* wrapper;&#xA;[wrapper addRegularFileWithContents:propertyList preferredFilename:@&#34;MyFile.plist&#34;];&lt;/pre&gt;&#xA;&lt;p&gt;My &lt;a href=&#34;http://meandmark.com/blog/2010/10/working-with-cocoa-file-packages/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Working with Cocoa File Packages&lt;/a&gt; post has detailed information on file packages. Read Apple’s &lt;em&gt;Property List Programming Guide&lt;/em&gt; for more information on property lists.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Finding the Application You Built</title>
      <link>https://www.meandmark.com/xcode-4-finding-the-application-you-built/</link>
      <pubDate>Wed, 06 Apr 2011 06:20:23 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-finding-the-application-you-built/</guid>
      <description>&lt;p&gt;Previous versions of Xcode created a build folder inside your project folder and placed your application there. Xcode 4 stores build products in the following location:&lt;/p&gt;&#xA;&lt;pre&gt;/Users/Username/Library/Developer/Xcode/DerivedData&lt;br /&gt;&lt;/pre&gt;&#xA;&lt;p&gt;When you build the project, Xcode creates a folder for your project in the derived data folder and places the files it creates in that folder. If you want your derived data in a different location, open Xcode’s Location Preferences. Choosing File &amp;gt; Project Settings lets you change the derived data location for a single project.&lt;/p&gt;&#xA;&lt;h3 id=&#34;update&#34; class=&#34;relative group&#34;&gt;Update &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;You can also open the folder where your application resides using the Xcode project window. Click the disclosure triangle next to the Products folder in the project navigator. Select the application, right-click, and choose Show in Finder.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Finding User Interface Elements</title>
      <link>https://www.meandmark.com/xcode-4-finding-user-interface-elements/</link>
      <pubDate>Mon, 04 Apr 2011 04:24:02 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-finding-user-interface-elements/</guid>
      <description>&lt;p&gt;One of Xcode 4’s biggest changes is its integration with Interface Builder. There is no longer a separate Interface Builder application. Select a xib file from the project navigator to create your application’s user interface. You may be wondering where the user interface elements are located in Xcode 4.&lt;/p&gt;&#xA;&lt;p&gt;They are in the object library. Choose View &amp;gt; Utilities &amp;gt; Object Library to open the object library, which is located in the lower right corner of the project window.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/04/Xcode-4-Object-Library.png&#34; border=&#34;0&#34; alt=&#34;Xcode 4 Object Library&#34; width=&#34;257&#34; height=&#34;293&#34; /&gt; &#xA;&lt;p&gt; &lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Unit Testing Support</title>
      <link>https://www.meandmark.com/xcode-4-unit-testing-support/</link>
      <pubDate>Fri, 01 Apr 2011 05:21:25 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-unit-testing-support/</guid>
      <description>&lt;p&gt;Developers doing test-driven development with the Cocoa and Cocoa Touch frameworks will like the improved support Xcode 4 has for unit testing. When you create a project that uses the Cocoa or Cocoa Touch frameworks, such as a Cocoa or iPhone application, Xcode gives you the option to add a unit testing bundle to the project.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/04/Xcode4NewProjectIncludeUnitTests.png&#34; border=&#34;0&#34; alt=&#34;Xcode4NewProjectIncludeUnitTests&#34; width=&#34;600&#34; height=&#34;404&#34; /&gt; &#xA;&lt;p&gt;When you select the Include Unit Tests checkbox, Xcode adds a unit testing bundle and a unit testing class to the project. Xcode also sets the Bundle Loader and Test Host build settings for the unit testing target and creates a target dependency so you can automatically run the unit tests.&lt;/p&gt;&#xA;&lt;p&gt;Another change Apple made to unit testing in Xcode 4 is adding the Test After Build build setting. When you set the Test After Build build setting to YES, Xcode runs your unit tests after building the unit testing target. Choose Product &amp;gt; Build For &amp;gt; Build For Testing to build the unit testing target. The test results appear in the build results window. Read my &lt;a href=&#34;http://meandmark.com/blog/2011/03/xcode-4-opening-the-build-results-window/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Opening the Build Results Window&lt;/a&gt; post for more information on opening the build results window. If Test After Build is set to NO, you must run the tests by choosing Product &amp;gt; Test. Open the log navigator to view the test results. I found unit testing works better when setting Test After Build to YES.&lt;/p&gt;&#xA;&lt;p&gt;If you open the scheme editor (use the Scheme pop-up menu in the project window toolbar), you can specify what tests are run as well as run scripts before and after running the tests. Xcode initially is set to run all tests.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Splitting the Editor</title>
      <link>https://www.meandmark.com/xcode-4-splitting-the-editor/</link>
      <pubDate>Wed, 30 Mar 2011 06:35:38 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-splitting-the-editor/</guid>
      <description>&lt;p&gt;Xcode 4’s standard editor does not support splitting. Use the assistant editor if you want to split the editor. Choose View &amp;gt; Editor &amp;gt; Assistant to open the assistant editor. Choose View &amp;gt; Assistant Layout to customize the appearance of the assistant editor. Click the Add Assistant Editor button (the + button) on the right side of the jump bar to split the editor.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Adding Command-Line Arguments and Environment Variables</title>
      <link>https://www.meandmark.com/xcode-4-adding-command-line-arguments-and-environment-variables/</link>
      <pubDate>Mon, 28 Mar 2011 18:23:48 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-adding-command-line-arguments-and-environment-variables/</guid>
      <description>&lt;p&gt;Choose Edit Scheme from the Scheme pop-up menu in the project window toolbar to open the scheme editor. Select Run from the list on the left side of the scheme editor. Click the Arguments button in the scheme editor.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/03/Xcode-4-Command-Line-Arguments.png&#34; border=&#34;0&#34; alt=&#34;Xcode 4 Command Line Arguments&#34; width=&#34;600&#34; height=&#34;407&#34; /&gt; &#xA;&lt;p&gt;From here you can add command-line arguments and environment variables. Clicking the Diagnostics button provides checkboxes for commonly-used environment variables.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Adding a Framework to Your Project</title>
      <link>https://www.meandmark.com/xcode-4-adding-a-framework-to-your-project/</link>
      <pubDate>Fri, 25 Mar 2011 04:59:33 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-adding-a-framework-to-your-project/</guid>
      <description>&lt;p&gt;To add a framework to your project, select the project file from the project navigator on the left side of the project window. Select the target from the project settings editor. Click the Summary button at the top of the editor.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/03/Xcode-4-Linked-Frameworks.png&#34; border=&#34;0&#34; alt=&#34;Xcode 4 Linked Frameworks&#34; width=&#34;600&#34; height=&#34;228&#34; /&gt; &#xA;&lt;p&gt;You will see a list of linked frameworks and libraries in the project settings editor. Click the + button to add a framework or library to your project.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Opening the Build Results Window</title>
      <link>https://www.meandmark.com/xcode-4-opening-the-build-results-window/</link>
      <pubDate>Wed, 23 Mar 2011 04:08:20 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-opening-the-build-results-window/</guid>
      <description>&lt;p&gt;Those of you who have upgraded to Xcode 4 may be wondering where the build results window went. Open the log navigator by choosing View &amp;gt; Navigators &amp;gt; Log. Select a build from the log list to open the build results window for that build.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Setting the Active Build Configuration</title>
      <link>https://www.meandmark.com/xcode-4-setting-the-active-build-configuration/</link>
      <pubDate>Mon, 21 Mar 2011 04:18:55 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-setting-the-active-build-configuration/</guid>
      <description>&lt;p&gt;Where do you set the active build configuration in Xcode 4? You set the build configuration in the scheme editor. To open the scheme editor, choose Edit Scheme from the Scheme pop-up menu in the project window toolbar.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/03/Xcode-4-Scheme-Editor.png&#34; border=&#34;0&#34; alt=&#34;Xcode 4 Scheme Editor&#34; width=&#34;600&#34; height=&#34;407&#34; /&gt; &#xA;&lt;p&gt;Use the scheme editor to choose the build configuration to use when running, testing, profiling, analyzing, and archiving your project. You’ll change the build configuration most often for running. To change the build configuration Xcode uses when running your program, select Run from the list on the left side of the scheme editor. Choose a build configuration from the Build Configuration menu.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Installing Documentation</title>
      <link>https://www.meandmark.com/xcode-4-installing-documentation/</link>
      <pubDate>Fri, 18 Mar 2011 04:36:22 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-installing-documentation/</guid>
      <description>&lt;p&gt;When I installed Xcode 4, it did not install the developer documentation on my Mac. If you find yourself in the same situation, open Xcode’s documentation preferences.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/03/Xcode-4-Documentation-Preferences.png&#34; border=&#34;0&#34; alt=&#34;Xcode 4 Documentation Preferences&#34; width=&#34;600&#34; height=&#34;421&#34; /&gt; &#xA;&lt;p&gt;Click the Check and Install Now button. A list of available documentation sets should appear in the preferences window along with a Get button next to each set that is not installed on your Mac. Click the Get button to install the documentation set.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Renaming Projects</title>
      <link>https://www.meandmark.com/xcode-4-renaming-projects/</link>
      <pubDate>Wed, 16 Mar 2011 04:04:10 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-renaming-projects/</guid>
      <description>&lt;p&gt;To rename a project in Xcode 4, select the project file from the project navigator on the left side of the project window. Choose View &amp;gt; Utilities &amp;gt; File Inspector to open the file inspector on the right side of the project window. At the top of the file inspector is the Project Name text field. Enter a new project name and press the Return key or the Tab key.&lt;/p&gt;&#xA;&lt;p&gt;A sheet opens asking if you want to rename the project content items. Click the Rename button to finish renaming the project.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: Accessing Build Settings</title>
      <link>https://www.meandmark.com/xcode-4-accessing-build-settings/</link>
      <pubDate>Mon, 14 Mar 2011 19:04:31 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-accessing-build-settings/</guid>
      <description>&lt;p&gt;To access build settings in Xcode 4, select the project file from the project navigator on the left side of the project window. The project file should be at the top of the project navigator. Selecting the project file opens the project settings editor. The project settings editor is Xcode 4’s replacement for Xcode 3’s project and target inspectors. Select either the project or a target from the project settings editor. Click the Build Settings button at the top of the editor. Now you should see a list of the project’s build settings.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/03/Xcode-4-Build-Settings-Window.png&#34; border=&#34;0&#34; alt=&#34;Xcode 4 Build Settings Window&#34; width=&#34;600&#34; height=&#34;275&#34; /&gt; &#xA;&lt;p&gt;Above the list of build settings are two sets of buttons. The first set is Basic/All. Clicking the Basic button shows the most commonly accessed build settings. Clicking the All button shows all the build settings.&lt;/p&gt;&#xA;&lt;p&gt;The second set of buttons is Combined/Levels. The screenshot shows what appears when you click the Levels button. Multiple columns of build settings are visible: default, project, target, and resolved. If you select the project from the build settings editor instead of the target, there is no column for the target. Showing levels allows you to see any changes from the default build settings as well as any differences between project and target build settings.&lt;/p&gt;&#xA;&lt;p&gt;If you click the Combined button, one column of build settings appears in the editor. The column shows the effective value of each build setting, the value Xcode will use when you build the project. Showing the combined build settings simplifies changing a build setting’s value.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4: git Support</title>
      <link>https://www.meandmark.com/xcode-4-git-support/</link>
      <pubDate>Fri, 11 Mar 2011 05:39:00 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-git-support/</guid>
      <description>&lt;p&gt;One of Xcode 4’s new features is support for the git version control system. Xcode 4 can create a local git repository for you when you create a project.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/03/Xcode-4-Create-git-Repository.png&#34; border=&#34;0&#34; alt=&#34;Xcode 4 Create git Repository&#34; width=&#34;537&#34; height=&#34;514&#34; /&gt; &#xA;&lt;p&gt;Select the Create local git repository for this project checkbox to create the repository. If you have an existing Xcode project you want to place under version control, launch the Terminal application. Navigate to the folder where your Xcode project resides and run the git init command.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-family: Helvetica; white-space: normal;&#34;&gt;After creating the repository, you must add the project files to the repository. You can do this from the Terminal by running the git add and git commit commands, or you can use a git GUI like &lt;/span&gt;&lt;span style=&#34;font-family: Helvetica; white-space: normal;&#34;&gt;&lt;a href=&#34;http://gitx.frim.nl&#34;&gt;GitX&lt;/a&gt;&lt;/span&gt;&lt;span style=&#34;font-family: Helvetica; white-space: normal;&#34;&gt;.&lt;/span&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 4 on Mac App Store</title>
      <link>https://www.meandmark.com/xcode-4-on-mac-app-store/</link>
      <pubDate>Thu, 10 Mar 2011 01:53:10 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-4-on-mac-app-store/</guid>
      <description>&lt;p&gt;Mac developers who are not part of Apple’s paid developer programs will be glad to know Xcode 4 is now on the Mac App Store. You will not be glad to know that it costs $5, but at least it’s cheaper than the $99 annual fees for Apple’s iPhone and Mac developer programs.&lt;/p&gt;&#xA;&lt;p&gt;Those of you who are members of one of the paid programs should know the version on the Mac App Store is the same as the GM Seed 2.&lt;/p&gt;&#xA;&lt;p&gt;Xcode 4 does not build PowerPC binaries. If you support PowerPC Macs, don’t remove your Xcode 3.2 installation. You still need 3.2.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-about-the-xcode-book&#34; class=&#34;relative group&#34;&gt;What About the Xcode Book? &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#what-about-the-xcode-book&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The release of Xcode 4 means I can talk about it now. It also means books that cover Xcode 4 can be published. You may be wondering when the new edition of Xcode Tools Sensei for Xcode 4 will be released.&lt;/p&gt;&#xA;&lt;p&gt;I don’t see the book being finished before May. The release of Xcode 4 took me by surprise. I figured it would ship with Mac OS X 10.7. I have most of the material written, but it’s disorganized. The big things I have to do are clarifying instructions, organizing the material, and cleaning up the writing.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Changing Name of Xcode Project Doesn’t Change Name in Menu Bar</title>
      <link>https://www.meandmark.com/changing-name-of-xcode-project-doesnt-change-name-in-menu-bar/</link>
      <pubDate>Fri, 04 Mar 2011 19:47:54 +0000</pubDate>
      <guid>https://www.meandmark.com/changing-name-of-xcode-project-doesnt-change-name-in-menu-bar/</guid>
      <description>&lt;p&gt;I recently changed the name of an Xcode SDL project. The change worked except for one problem. The menu bar showed the old project name as the application name. What was strange was the menus in the application menu (About App, Hide App, Quit App) showed the new project name. What was causing the menu bar to show the old project name?&lt;/p&gt;&#xA;&lt;p&gt;The culprit was the project’s InfoPlist.strings file. I noticed the keys CFBundleName, CFBundleShortVersionString, and CFBundleGetInfoString had the old project name. Changing these keys to the new project name, cleaning the project, and rebuilding the project fixed the problem. The menu bar now shows the new project name.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Apple’s Mac Developer Program</title>
      <link>https://www.meandmark.com/apples-mac-developer-program/</link>
      <pubDate>Tue, 15 Feb 2011 05:34:49 +0000</pubDate>
      <guid>https://www.meandmark.com/apples-mac-developer-program/</guid>
      <description>&lt;p&gt;With the advent of the Mac App Store, I’ve noticed some confusion from new Mac developers on some message boards. They think they must sign up for Apple’s Mac Developer Program and pay $99 a year to develop applications for Mac OS X.&lt;/p&gt;&#xA;&lt;p&gt;You don’t have to sign up for the paid developer program to download Xcode or to write Mac applications. A free developer account with Apple is all you need. If you don’t care about having the latest version of Xcode, you can install Xcode from your Mac OS X install disc and avoid signing up for any developer account with Apple.&lt;/p&gt;&#xA;&lt;p&gt;There are two reasons to sign up for the Mac Developer Program and pay the $99 annual fee.&lt;/p&gt;&#xA;&lt;h2 id=&#34;reason-1-you-need-access-to-pre-release-versions-of-mac-os-x&#34; class=&#34;relative group&#34;&gt;Reason 1: You need access to pre-release versions of Mac OS X &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#reason-1-you-need-access-to-pre-release-versions-of-mac-os-x&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;As I’m writing this post, the current version of Mac OS X is 10.6.6. Members of the paid developer program get access to pre-release versions of 10.6.7 and 10.7 so they can test their applications on upcoming versions of Mac OS X. Generally developers with shipping applications are the ones with the greatest need for access to pre-release versions of Mac OS X. They must make sure the new version of Mac OS X doesn’t break their application. If you’re new to Mac development, you most likely don’t need this access.&lt;/p&gt;&#xA;&lt;h2 id=&#34;reason-2-you-want-your-application-in-the-mac-app-store&#34; class=&#34;relative group&#34;&gt;Reason 2: You want your application in the Mac App Store &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#reason-2-you-want-your-application-in-the-mac-app-store&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;If you want to be in the Mac App Store, you must pay the $99. But you can wait until you’re close to releasing your application to sign up for the paid developer program.&lt;/p&gt;&#xA;&lt;p&gt;Those of you who have no need for pre-release versions of Mac OS X and the Mac App Store can save your money while you develop Mac applications.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Making Your README file readable on github on a Mac</title>
      <link>https://www.meandmark.com/making-your-readme-file-readable-on-github-on-a-mac/</link>
      <pubDate>Fri, 07 Jan 2011 04:27:10 +0000</pubDate>
      <guid>https://www.meandmark.com/making-your-readme-file-readable-on-github-on-a-mac/</guid>
      <description>&lt;p&gt;I recently put a small project on github as an experiment. The biggest problem I had was getting the project’s README file to look right. Github supports a &lt;a href=&#34;https://github.com/github/markup&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;variety of markup languages&lt;/a&gt;, but not RTF (Rich Text Format), which is the file format the Cocoa text system uses. If you supply a RTF file and a github visitor clicks on it, the file is downloaded to the visitor’s computer. I tried supplying a plain text file as a workaround, but github displayed each paragraph as a single line, which is very annoying for the reader.&lt;/p&gt;&#xA;&lt;p&gt;My solution was to paste my README file in TextWrangler and use the menu at the bottom of the window to tell TextWrangler to treat the file as a Markdown file, which is one of the markup languages github supports.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2011/01/TextWrangler-Markdown.png&#34; border=&#34;0&#34; alt=&#34;TextWrangler Markdown.png&#34; width=&#34;521&#34; height=&#34;16&#34; /&gt; &#xA;&lt;p&gt;I saved the file, added it to my git repository, and pushed the commit to github. I clicked the README file in github, and it looked decent, better than the plain text version I tried earlier.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Magic Mouse Battery Life</title>
      <link>https://www.meandmark.com/magic-mouse-battery-life/</link>
      <pubDate>Thu, 30 Dec 2010 02:50:27 +0000</pubDate>
      <guid>https://www.meandmark.com/magic-mouse-battery-life/</guid>
      <description>&lt;p&gt;The batteries that came with my Magic Mouse lasted four weeks, which was longer than I expected. I figured they would last 1-2 weeks.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Using Xcode to Unit Test SDL Games Written in C&#43;&#43;</title>
      <link>https://www.meandmark.com/using-xcode-to-unit-test-sdl-games-written-in-c/</link>
      <pubDate>Tue, 23 Nov 2010 20:59:19 +0000</pubDate>
      <guid>https://www.meandmark.com/using-xcode-to-unit-test-sdl-games-written-in-c/</guid>
      <description>&lt;p&gt;Suppose you’re using SDL to program a game. You’re writing the game in C++, and you want to write unit tests for your code. Your first instinct would be to use a C++ unit testing framework like googletest or UnitTest++. Your instinct would be correct on Linux and Windows, but the Mac version of SDL uses Cocoa, which is an Objective-C framework. If you try to unit test your SDL C++ game on a Mac, you’re going to get hundreds of compiler errors related to the Cocoa framework because a C++ unit testing framework doesn’t understand Objective-C. How do you unit test your SDL game on a Mac?&lt;/p&gt;&#xA;&lt;p&gt;Use Xcode’s built-in support for Objective-C unit testing. Add a Cocoa unit testing bundle target to your project. Add an Objective-C test case class to your project, making sure to add the test case class to the unit testing target, not the target for your SDL game. Give the test case file the extension .mm instead of .m. Giving the file the extension .mm tells Xcode to treat the test case file as an Objective-C++ file, which allows you to unit test your C++ code with OCUnit, the Objective-C unit testing framework that comes with Xcode.&lt;/p&gt;&#xA;&lt;p&gt;Make sure your game’s C++ source files are members of the unit testing target you created. If you don’t add your game’s C++ files to the unit testing target, you will get linker errors when your unit tests access your game’s classes. Read my &lt;a href=&#34;http://meandmark.com/blog/2010/11/googletest-xcode-tip/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;googleTest Xcode Tip post&lt;/a&gt; for instructions on adding your C++ files to the unit testing target.&lt;/p&gt;&#xA;&lt;p&gt;Apple’s Xcode Unit Testing Guide, which is part of Apple’s Mac developer documentation, contains additional information on setting up Xcode for unit testing. Also, thanks to Chris Hanson for his answer to a question 5 years ago on one of Apple’s mailing lists. Without his answer I would have never known you could unit test C++ code with OCUnit.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>googletest Xcode Tip</title>
      <link>https://www.meandmark.com/googletest-xcode-tip/</link>
      <pubDate>Mon, 22 Nov 2010 20:02:30 +0000</pubDate>
      <guid>https://www.meandmark.com/googletest-xcode-tip/</guid>
      <description>&lt;p&gt;Make sure your application’s C++ source files are members of the unit testing target you created. If you don’t add your application’s C++ files to the unit testing target, you will get linker errors when your unit tests access your application’s classes.&lt;/p&gt;&#xA;&lt;p&gt;To add one of your application’s C++ files to the unit testing target, open the file’s inspector by selecting the file in the project window and clicking the Get Info button in the project window toolbar. Click the Targets tab in the inspector, which should have a list of your project’s targets with a checkbox next to each target. Select the checkbox next to the unit testing target.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2010/11/FileTargetInspector.png&#34; border=&#34;0&#34; alt=&#34;FileTargetInspector.png&#34; width=&#34;323&#34; height=&#34;149&#34; /&gt; &#xA;&lt;p&gt;Alternatively, you can add a bunch of files to the unit testing target by clicking disclosure triangles in the Groups and Files list to expose the unit testing target’s build phases. Drag the C++ files to the unit testing target’s Compile Sources build phase.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Mac Game Programming Roadmap Update for 2010</title>
      <link>https://www.meandmark.com/mac-game-programming-roadmap-update-for-2010/</link>
      <pubDate>Sun, 14 Nov 2010 05:34:57 +0000</pubDate>
      <guid>https://www.meandmark.com/mac-game-programming-roadmap-update-for-2010/</guid>
      <description>&lt;p&gt;I’ve seen several questions on Mac programming forums recently looking for Mac game programming tutorials, which made me look at my &lt;a href=&#34;http://meandmark.com/macgamedevroadmappart1.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Mac Game Programming Roadmap&lt;/a&gt; article. The article is three years old, and some things have changed in the past three years.&lt;/p&gt;&#xA;&lt;h2 id=&#34;avoid-carbon&#34; class=&#34;relative group&#34;&gt;Avoid Carbon &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#avoid-carbon&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Unless you have an existing Carbon codebase, avoid Carbon. If you don’t want to learn Objective-C, use a cross-platform game framework like &lt;a href=&#34;http://www.libsdl.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;SDL&lt;/a&gt;, &lt;a href=&#34;http://alleg.sourceforge.net&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Allegro&lt;/a&gt;, or &lt;a href=&#34;http://www.sfml-dev.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;SFML&lt;/a&gt;. Another advantage of using one of these frameworks is you can support Windows and Linux without having to rewrite much of your code.&lt;/p&gt;&#xA;&lt;h2 id=&#34;sfml&#34; class=&#34;relative group&#34;&gt;SFML &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#sfml&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;&lt;a href=&#34;http://www.sfml-dev.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;SFML&lt;/a&gt; is a cross-platform game framework that has grown in popularity in the past three years. I have not used SFML, but go the SFML website and see if it meets your needs.&lt;/p&gt;&#xA;&lt;h2 id=&#34;unity&#34; class=&#34;relative group&#34;&gt;Unity &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#unity&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;&lt;a href=&#34;http://unity3d.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Unity&lt;/a&gt; existed in 2007, but its Indie version cost $199. The Indie version is now free and lets you write games that run on Mac OS X, Windows, and the Web. If you’re interested in creating 3D games, I recommend Unity. You’ll finish your game much faster with Unity than you will by programming your game from scratch.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Loading Files for Unit Testing in Cocoa</title>
      <link>https://www.meandmark.com/loading-files-for-unit-testing-in-cocoa/</link>
      <pubDate>Thu, 11 Nov 2010 00:43:00 +0000</pubDate>
      <guid>https://www.meandmark.com/loading-files-for-unit-testing-in-cocoa/</guid>
      <description>&lt;p&gt;Adding files to your unit testing bundle helps when you’re unit testing file behavior or when you have a lot of test data. This post shows you how to load files from the unit testing bundle to help you unit test Cocoa applications.&lt;/p&gt;&#xA;&lt;h2 id=&#34;before-you-code&#34; class=&#34;relative group&#34;&gt;Before You Code &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#before-you-code&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The first thing you must do is get your test files in the unit testing bundle. Add the test files to your project. When adding the files, add them to the unit testing target, not the application target. Make sure the test files are part of the unit testing target’s Copy Bundle Resources build phase. When you build the project, the test files will be copied to the unit testing bundle’s Resources directory.&lt;/p&gt;&#xA;&lt;h2 id=&#34;loading-a-file-from-the-unit-testing-bundle&#34; class=&#34;relative group&#34;&gt;Loading a File from the Unit Testing Bundle &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#loading-a-file-from-the-unit-testing-bundle&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;To load an individual file call NSBundle’s pathForResource: method. The following code loads a test XML file from the unit testing bundle:&lt;/p&gt;&#xA;&lt;pre&gt;NSBundle *unitTestBundle = [NSBundle bundleForClass:[self class]];&#xA;NSString* xmlFilename = [unitTestBundle pathForResource:@&#34;XMLTestFile&#34; ofType:nil];&#xA;NSData* xmlData = [[NSData alloc] initWithContentsOfFile:xmlFilename];&lt;/pre&gt;&#xA;&lt;h2 id=&#34;opening-a-file-wrapper&#34; class=&#34;relative group&#34;&gt;Opening a File Wrapper &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#opening-a-file-wrapper&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;To open a file wrapper, call NSBundle’s URLForResource: method to find the file wrapper. Call NSFileWrapper’s initWithURL: method to open the file wrapper. The following code opens a file wrapper from the unit testing bundle:&lt;/p&gt;&#xA;&lt;pre&gt;NSBundle *unitTestBundle = [NSBundle bundleForClass:[self class]];&#xA;NSURL* testFileURL = [unitTestBundle URLForResource:@&#34;FileWrapperTest&#34; withExtension:@&#34;wrap&#34;];&#xA;NSFileWrapper* testFile = [[NSFileWrapper alloc] initWithURL:testFileURL options:0 error:nil];&lt;/pre&gt;&#xA;&lt;p&gt;Substitute your file wrapper’s file extension for “wrap” in the URLForResource: call. Read my &lt;a href=&#34;http://meandmark.com/blog/2010/10/working-with-cocoa-file-packages&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Working with Cocoa File Packages post&lt;/a&gt; for more information on working with file wrappers.&lt;/p&gt;&#xA;&lt;p&gt;Keep in mind that the initWithURL: method was added in Mac OS X 10.6. If you’re running an older version of Mac OS X, call NSFileWrapper’s initWithPath: method, which was deprecated in 10.6.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Working with Cocoa File Packages</title>
      <link>https://www.meandmark.com/working-with-cocoa-file-packages/</link>
      <pubDate>Wed, 27 Oct 2010 19:09:58 +0000</pubDate>
      <guid>https://www.meandmark.com/working-with-cocoa-file-packages/</guid>
      <description>&lt;p&gt;Saving a Cocoa application’s data in a file package is not much more difficult than saving the data in a single file. This post shows you how to save your document’s data in a file package and read the data from the package.&lt;/p&gt;&#xA;&lt;h2 id=&#34;introduction-to-file-packages&#34; class=&#34;relative group&#34;&gt;Introduction to File Packages &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#introduction-to-file-packages&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;A file package is a bundle, which is a collection of one or more directories that appears as a single file to the user. Xcode projects use file packages. Select an Xcode project in the Finder, right-click, and choose Show Package Contents to examine the file package.&lt;/p&gt;&#xA;&lt;p&gt;When should you use a file package? Use a file package when you want to save your application’s document data in multiple files. A game level editor may want to save the level layout, the level’s enemy list, and the level’s treasure list in separate files. Screenwriting software may want to save each scene in its own text file.&lt;/p&gt;&#xA;&lt;p&gt;The simplest file package is a single directory that contains all the files. But you can have multiple directories to group files if you’re going to store lots of files in your file package.&lt;/p&gt;&#xA;&lt;p&gt;There are two tasks you must perform to add file package support to your application. First, you must add a document type for the package to your Xcode project’s target. Second, you must implement the methods fileWrapperOfType: and readFromFileWrapper: in your NSDocument subclass.&lt;/p&gt;&#xA;&lt;h2 id=&#34;adding-a-document-type-to-your-project&#34; class=&#34;relative group&#34;&gt;Adding a Document Type to Your Project &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#adding-a-document-type-to-your-project&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;By adding a document type to your project’s target and setting the document type as a package, your document’s data will be saved as a file package. If you don’t add the document type, your data will appear as a folder in the Finder instead of as a single file, which makes it easier for someone to accidentally delete or move a file.&lt;/p&gt;&#xA;&lt;p&gt;To access the inspector for your target, perform the following steps in Xcode:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Select your target from the Groups and Files list.&lt;/li&gt;&#xA;&lt;li&gt;Click the Info button on the project window toolbar to open the target’s inspector.&lt;/li&gt;&#xA;&lt;li&gt;Click the Properties tab in the inspector.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;At the bottom of the target inspector is a list of document types. You should see the following columns of information:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Name&lt;/li&gt;&#xA;&lt;li&gt;UTI&lt;/li&gt;&#xA;&lt;li&gt;Extensions&lt;/li&gt;&#xA;&lt;li&gt;MIME Types&lt;/li&gt;&#xA;&lt;li&gt;OS Types&lt;/li&gt;&#xA;&lt;li&gt;Class&lt;/li&gt;&#xA;&lt;li&gt;Icon File&lt;/li&gt;&#xA;&lt;li&gt;Store Type&lt;/li&gt;&#xA;&lt;li&gt;Role&lt;/li&gt;&#xA;&lt;li&gt;Package&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you have a document-based Cocoa application project, there should be one document type in the list. Click the + button in the lower left corner of the inspector to add a document type if you need another one.&lt;/p&gt;&#xA;&lt;h3 id=&#34;mandatory-document-type-fields-for-file-packages&#34; class=&#34;relative group&#34;&gt;Mandatory Document Type Fields for File Packages &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#mandatory-document-type-fields-for-file-packages&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;At a minimum, you must deal with the Name, Extensions, Role, and Package fields for your file package’s document type. For the Name field, give a description for your file type. For the Extensions field, list the file extension you want for your file type, skipping the period. If you wanted your file to have the extension .xyz, you would enter the following for the Extensions field:&lt;/p&gt;&#xA;&lt;pre&gt;xyz&lt;/pre&gt;&#xA;&lt;p&gt;Make sure the Role is Editor. An editor can read and write files. Select the Package checkbox to make your document type a file package.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-other-document-type-fields&#34; class=&#34;relative group&#34;&gt;The Other Document Type Fields &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#the-other-document-type-fields&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;UTI stands for uniform type identifier, which identifies an abstract type, such as a file format. A UTI takes the following form:&lt;/p&gt;&#xA;&lt;pre&gt;com.CompanyName.DocumentType&lt;/pre&gt;&#xA;&lt;p&gt;MIME (Multimedia Email Extensions) types are file types a web browser uses. Web browsers don’t open file packages so you shouldn’t have to worry about setting MIME types.&lt;/p&gt;&#xA;&lt;p&gt;OS Types are four-character codes for the document’s file type. Before Mac OS X, Mac applications used OS Types instead of file extensions to identify themselves as the creator of a particular file. Today, you should use file extensions and UTIs to identify a document type.&lt;/p&gt;&#xA;&lt;p&gt;The Class field contains the name of your NSDocument subclass. The Icon File field contains the file name for the document icon. If you use a custom icon for your file package, enter the file name in the Icon File field. You should also add the icon file to your project.&lt;/p&gt;&#xA;&lt;p&gt;The Store Type field is used by Core Data applications. If you’re not using Core Data, you can ignore this field.&lt;/p&gt;&#xA;&lt;h2 id=&#34;writing-to-a-file-package&#34; class=&#34;relative group&#34;&gt;Writing to a File Package &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#writing-to-a-file-package&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;To write your document’s data to a file package, your NSDocument subclass must implement the method fileWrapperOfType:. This method takes the following form:&lt;/p&gt;&#xA;&lt;pre&gt;- (NSFileWrapper &lt;em&gt;)fileWrapperOfType:(NSString &lt;/em&gt;)typeName error:(NSError **)outError&lt;/pre&gt;&#xA;&lt;p&gt;The file wrapper that fileWrapperOfType: returns is the main directory for the file package. The typeName argument identifies the type of document. You shouldn’t have to worry about the typeName argument. If there is a problem during the write, the outError argument will contain the reason for the problem.&lt;/p&gt;&#xA;&lt;p&gt;In your implementation of fileWrapperOfType:, you must perform the following tasks:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Create a directory file wrapper.&lt;/li&gt;&#xA;&lt;li&gt;Get your data into a NSData object.&lt;/li&gt;&#xA;&lt;li&gt;Create a file wrapper and add the file to a directory file wrapper.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;creating-a-directory-file-wrapper&#34; class=&#34;relative group&#34;&gt;Creating a Directory File Wrapper &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#creating-a-directory-file-wrapper&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Call NSFileWrapper’s initDirectoryWithFileWrappers: method to create a directory file wrapper. The following code creates an empty directory:&lt;/p&gt;&#xA;&lt;pre&gt;NSFileWrapper* mainDirectory;&#xA;[mainDirectory initDirectoryWithFileWrappers:nil];&lt;/pre&gt;&#xA;&lt;p&gt;If you’re going to store all your files in one directory, you’re done with the directory file wrapper for now. But if you’re going to store your files in folders inside the file package, you must create a directory file wrapper for each folder and give that folder a preferred filename. Call NSFileWrapper’s setPreferredFilename: method to give the folder a preferred filename. The following code creates an empty directory named HTML inside the file package:&lt;/p&gt;&#xA;&lt;pre&gt;NSFileWrapper* htmlDirectory;&#xA;[htmlDirectory initDirectoryWithFileWrappers:nil];&#xA;[htmlDirectory setPreferredFilename:@&amp;#8220;HTML&amp;#8221;];&lt;/pre&gt;&lt;/p&gt; &#xA;&lt;h3 id=&#34;getting-your-data-into-a-nsdata-object&#34; class=&#34;relative group&#34;&gt;Getting Your Data into a NSData Object &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#getting-your-data-into-a-nsdata-object&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;NSFileWrapper’s methods use NSData objects to write data to files and read data from files. How you get your data into a NSData object depends on your application, but the following code shows how to convert the RTF data of a text view to NSData:&lt;/p&gt;&#xA;&lt;pre&gt;NSTextView* textView;&#xA;NSData* myData;&#xA;NSRange range = NSMakeRange(0, [[textView textStorage] length]);&#xA;myData = [[textView textStorage]RTFFromRange:range documentAttributes:nil];&lt;/pre&gt;&#xA;&lt;p&gt;The following code demonstrates how to convert an XML document to NSData:&lt;/p&gt;&#xA;&lt;pre&gt;NSXMLDocument* xmlDoc;&#xA;NSData* myData = [xmlDoc XMLData];&lt;/pre&gt;&lt;/p&gt; &#xA;&lt;h3 id=&#34;creating-a-file-wrapper&#34; class=&#34;relative group&#34;&gt;Creating a File Wrapper &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#creating-a-file-wrapper&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;You can create a file wrapper and add it to a directory file wrapper with one method call. Call NSFileWrapper’s addRegularFileWithContents: method. This method takes two arguments. The first argument is the NSData object you created, and the second argument is the filename you want for the file. The following code adds a file named “index” to the HTML directory:&lt;/p&gt;&#xA;&lt;pre&gt;NSFileWrapper* htmlDirectory;&#xA;NSData* myData;&#xA;[htmlDirectory addRegularFileWithContents:myData preferredFilename:@”index”];&lt;/pre&gt;&#xA;&lt;p&gt;Call addRegularFileWithContents: for each file you’re going to save in the file package.&lt;/p&gt;&#xA;&lt;p&gt;To add a subdirectory to the directory, call NSFileWrapper’s addFileWrapper: method. The following code adds the HTML directory to the main directory:&lt;/p&gt;&#xA;&lt;pre&gt;NSFileWrapper* htmlDirectory;&#xA;NSFileWrapper* mainDirectory;&#xA;[mainDirectory addFileWrapper:htmlDirectory];&lt;/pre&gt;&lt;/p&gt; &#xA;&lt;h2 id=&#34;reading-from-a-file-package&#34; class=&#34;relative group&#34;&gt;Reading from a File Package &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#reading-from-a-file-package&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;To read from a file package, your NSDocument subclass must implement the method readFromFileWrapper:. This method takes the following form:&lt;/p&gt;&#xA;&lt;pre&gt;- (BOOL)readFromFileWrapper:(NSFileWrapper &lt;em&gt;)fileWrapper ofType:(NSString &lt;/em&gt;)typeName error:(NSError **)outError&lt;/pre&gt;&lt;/p&gt; &#xA;&lt;p&gt;The fileWrapper argument is the main directory where all the files in the wrapper are stored. You can give it a more descriptive name than fileWrapper if you want. The typeName argument identifies the type of document. You shouldn’t have to worry about the typeName argument. If there is a problem during the read, the outError argument will contain the reason for the problem.&lt;/p&gt;&#xA;&lt;p&gt;If you have all your files inside the main wrapper, call NSFileWrapper’s fileWrappers: method, which contains all the file wrappers inside a directory.&lt;/p&gt;&#xA;&lt;pre&gt;NSFileWrapper* mainDirectory;&#xA;NSDictionary* files = [mainDirectory fileWrappers];&lt;/pre&gt;&#xA;&lt;p&gt;If you need to find a particular file or directory, call NSFileWrapper’s objectForKey: method. The following code locates the HTML folder in the file wrapper:&lt;/p&gt;&#xA;&lt;pre&gt;NSFileWrapper* mainDirectory;&#xA;NSFileWrapper* htmlDirectory = [[mainDirectory fileWrappers] objectForKey:@”HTML&#34;];&lt;/pre&gt;&#xA;&lt;p&gt;Once you get a directory, call fileWrappers: to get the list of files in that directory.&lt;/p&gt;&#xA;&lt;pre&gt;NSFileWrapper* htmlFiles = [htmlDirectory fileWrappers];&lt;/pre&gt;&lt;/p&gt; &#xA;&lt;h3 id=&#34;reading-the-individual-files&#34; class=&#34;relative group&#34;&gt;Reading the Individual Files &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#reading-the-individual-files&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;When you call NSFileWrapper’s fileWrappers: method, it returns a NSDictionary object containing all the files in the directory. Assuming you want to read all the files, the easiest thing to do is create an NSEnumerator object and use that object to go through the files.&lt;/p&gt;&#xA;&lt;p&gt;A dictionary contains a list of key-value pairs. The enumerator for a dictionary can either be a key enumerator or an object enumerator. For a file wrapper you should use a key enumerator that contains all of the filenames in the dictionary.&lt;/p&gt;&#xA;&lt;pre&gt;NSDictionary* files;&#xA;NSEnumerator* fileEnumerator = [files keyEnumerator];&lt;/pre&gt;&#xA;&lt;p&gt;Use NSEnumerator’s nextObject: method to go through the files in the dictionary. Call NSEnumerator’s objectForKey: method to get the file wrapper. Call NSFileWrapper’s regularFileContents: method to get the contents of the file in a NSData object.&lt;/p&gt;&#xA;&lt;pre&gt;id currentFilename;&#xA;NSFileWrapper* currentFile;&#xA;NSData* myData;&#xA;&#xA;while (currentFilename = [fileEnumerator nextObject]) {&#xA;    currentFile = [files objectForKey:currentFilename];&#xA;    myData = [currentFile regularFileContents];&#xA;    // Load myData.&#xA;}&lt;/pre&gt;&#xA;&lt;h3 id=&#34;loading-the-data&#34; class=&#34;relative group&#34;&gt;Loading the Data &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#loading-the-data&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;How you load the data depends on the data you’re storing. If you store RTF data, you can use NSTextStorage’s initWithRTF: method to load a text view with the contents of a text file.&lt;/p&gt;&#xA;&lt;pre&gt;NSTextView* textView;&#xA;NSData* myData;&#xA;[[textView textStorage] initWithRTF:myData documentAttributes:nil];&lt;/pre&gt;&#xA;&lt;p&gt;If you’re loading an XML document, call NSXMLDocument’s initWithData: method to load the document from disk to the NSXMLDocument.&lt;/p&gt;&#xA;&lt;pre&gt;NSError* error;&#xA;NSXMLDocument* xmlDoc;&#xA;[xmlDoc initWithData:myData options:NSXMLDocumentValidate error:&amp;error];&lt;/pre&gt;&lt;/p&gt; &#xA;&lt;h2 id=&#34;additional-information&#34; class=&#34;relative group&#34;&gt;Additional Information &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#additional-information&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;Read Apple’s documentation for the NSFileWrapper, NSData, and NSDocument classes for more information on working with file packages.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Locating the Unit Testing Bundle in Cocoa</title>
      <link>https://www.meandmark.com/locating-the-unit-testing-bundle-in-cocoa/</link>
      <pubDate>Wed, 20 Oct 2010 00:49:02 +0000</pubDate>
      <guid>https://www.meandmark.com/locating-the-unit-testing-bundle-in-cocoa/</guid>
      <description>&lt;p&gt;If you load test data from a file when unit testing a Cocoa application, you’ll need to access the unit testing bundle to find the file. Your first instinct might be to call NSBundle’s mainBundle: method. For a unit testing target, the main bundle should be the unit testing bundle, right? Unfortunately, the mainBundle: method is for application bundles, not unit testing bundles.&lt;/p&gt;&#xA;&lt;p&gt;Call NSBundle’s bundleForClass: method to load the unit testing bundle. The following code demonstrates how to locate the unit testing bundle:&lt;/p&gt;&#xA;&lt;pre&gt;NSBundle *unitTestBundle = [NSBundle bundleForClass:[self class]];&lt;br /&gt;&lt;/pre&gt;</description>
    </item>
    <item>
      <title>Using NSZombie with Instruments</title>
      <link>https://www.meandmark.com/using-nszombie-with-instruments/</link>
      <pubDate>Wed, 22 Sep 2010 01:29:37 +0000</pubDate>
      <guid>https://www.meandmark.com/using-nszombie-with-instruments/</guid>
      <description>&lt;p&gt;Cocoa’s NSZombie class helps you discover where you are accessing a deallocated object in your code. For those of you running Snow Leopard, Instruments has support for NSZombie so you can use NSZombie without having to make any changes to your Xcode project.&lt;/p&gt;&#xA;&lt;p&gt;Checking for zombies is pretty simple. Open your project in Xcode. Choose Run &amp;gt; Run With Performance Tool &amp;gt; Zombies. Your application will launch and Instruments will trace its execution. If your application accesses a deallocated object, a zombie message appears in Instruments.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2010/09/Instruments-Zombie-Message.png&#34; border=&#34;0&#34; alt=&#34;Instruments Zombie Message.png&#34; width=&#34;290&#34; height=&#34;141&#34; /&gt; &#xA;&lt;p&gt;Clicking the focus button next to the memory address shows the history of that memory address. The Responsible Caller column tells you where you’re trying to access a deallocated object.&lt;/p&gt;&#xA;&lt;p&gt;If the Run With Performance Tool option is grayed out in Xcode, launch Instruments (or choose File &amp;gt; New if Instruments is already running) and select the Zombies template. The Zombies template is available for Mac applications and iPhone applications running in the Simulator. Use the Target menu in the trace document window toolbar to choose your application. Click the Record button to start recording.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Dealing with Missing SDKs in Xcode</title>
      <link>https://www.meandmark.com/dealing-with-missing-sdks-in-xcode/</link>
      <pubDate>Tue, 10 Aug 2010 01:48:19 +0000</pubDate>
      <guid>https://www.meandmark.com/dealing-with-missing-sdks-in-xcode/</guid>
      <description>&lt;p&gt;If you’re running a recent version of Xcode, you may notice a problem when opening older projects. The Overview pop-up menu in the project window toolbar will tell you the Base SDK is missing. The cause of this problem is the project you opened used a SDK that is not installed on your Mac.&lt;/p&gt;&#xA;&lt;p&gt;The missing SDK problem is most likely to occur if you have installed the iPhone 4 SDK. The iPhone 4 SDK installation erases any previously installed SDKs so any Xcode projects that use an older version of the iPhone SDK have a missing SDK. The missing SDK problem is not limited to iPhone projects. Mac projects can have the problem as well, but they’re less likely to have the problem because Xcode 3.2 installs the 10.5 and 10.6 SDKs. A Mac project would have to use the 10.4 SDK (or earlier SDK) to get the missing SDK message.&lt;/p&gt;&#xA;&lt;p&gt;The solution to the missing SDK problem is to set the Base SDK to one that is installed on your Mac. Choose Project &amp;gt; Edit Project Settings to change the Base SDK build setting. For those of you using the iPhone 4 SDK, set the Base SDK to iPhone Device 4.0.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2010/08/BaseSDK.png&#34; border=&#34;0&#34; alt=&#34;BaseSDK.png&#34; width=&#34;404&#34; height=&#34;17&#34; /&gt; &#xA;&lt;p&gt;The missing SDK message in the Overview pop-up menu should go away now.&lt;/p&gt;&#xA;&lt;p&gt;iPhone Device 4.0 is the most recent SDK as I’m writing this post. Use the most recent SDK if you’re reading this post in the future.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Eight Chapters</title>
      <link>https://www.meandmark.com/eight-chapters/</link>
      <pubDate>Mon, 28 Jun 2010 17:49:57 +0000</pubDate>
      <guid>https://www.meandmark.com/eight-chapters/</guid>
      <description>&lt;p&gt;A few weeks ago Apple unveiled Xcode 4 to the developers who were at WWDC. The announcement of Xcode 4 makes an Xcode 3 book obsolete so I am going to focus on Xcode 4 for the next edition of Xcode Tools Sensei.&lt;/p&gt;&#xA;&lt;p&gt;To keep the Xcode 3 material I wrote from going to waste, I am making eight chapters I wrote for an Xcode 3 version of the book available for download. There are six chapters on Xcode as well as a chapter on the OpenGL tools and a chapter on command-line debugging tools.&lt;/p&gt;&#xA;&lt;p&gt;You can download the chapters at the &lt;a href=&#34;http://www.meandmark.com/xcodebook.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode Tools Sensei site&lt;/a&gt;. There is a zip archive with all eight chapters available as well as the individual chapters if you don’t want all eight of them.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Instruments Source View</title>
      <link>https://www.meandmark.com/instruments-source-view/</link>
      <pubDate>Wed, 05 May 2010 19:08:56 +0000</pubDate>
      <guid>https://www.meandmark.com/instruments-source-view/</guid>
      <description>&lt;p&gt;Instruments 2, which ships with Xcode 3.2, added a source view that lets you examine your source code inside Instruments. When you combine the source view with the extended detail view, finding the problem areas in your code becomes easier.&lt;/p&gt;&#xA;&lt;h2 id=&#34;switching-to-the-source-view&#34; class=&#34;relative group&#34;&gt;Switching to the Source View &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#switching-to-the-source-view&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;At the bottom of the trace document window is a collection of six buttons.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2010/03/Detail-View-Buttons.png&#34; border=&#34;0&#34; alt=&#34;Detail View Buttons.png&#34; width=&#34;191&#34; height=&#34;26&#34; /&gt; &#xA;&lt;p&gt;If you see only four buttons, you’re most likely running Leopard and Instruments 1. Instruments 2 requires Snow Leopard. The buttons from left to right are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Table view&lt;/li&gt;&#xA;&lt;li&gt;Outline view&lt;/li&gt;&#xA;&lt;li&gt;Diagram view&lt;/li&gt;&#xA;&lt;li&gt;Console&lt;/li&gt;&#xA;&lt;li&gt;Source view&lt;/li&gt;&#xA;&lt;li&gt;Extended detail view&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The source view looks similar to an Xcode editor window. Click the source view button to switch to the source view.&lt;/p&gt;&#xA;&lt;p&gt;I’ll briefly explain the other views for those of you new to Instruments. The table, outline, and diagram views provide different views of the trace data. The table view shows the data in a flat list. The outline view shows the data in a hierarchical list, and the diagram view shows the data as a list of individual samples. Most instruments do not use the diagram view.&lt;/p&gt;&#xA;&lt;p&gt;The console is similar to Xcode’s debugger console. If your application uses NSLog or printf to log debugging information, the logged output appears in the console when you trace the application in Instruments.&lt;/p&gt;&#xA;&lt;p&gt;For most instruments the extended detail view shows the call stack. The extended detail view is initially invisible. To take full advantage of the source view, open the extended detail view. The extended detail view resides on the right side of the trace document window.&lt;/p&gt;&#xA;&lt;h2 id=&#34;viewing-source-code&#34; class=&#34;relative group&#34;&gt;Viewing Source Code &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#viewing-source-code&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;When you first open the source view, it displays the following message:&lt;/p&gt;&#xA;&lt;pre&gt;Drop Source File to Analyze&lt;/pre&gt;&#xA;&lt;p&gt;Drag one of your source code files to the source view to examine it in the source view.&lt;/p&gt;&#xA;&lt;p&gt;There is a second way to view source code. Make sure the extended detail view is open. Switch to the table, outline, or diagram view. Select a trace sample and examine the call stack in the extended detail view. Find a function you wrote on the call stack and double-click it. If there is no function you wrote on the call stack, select another trace sample.&lt;/p&gt;&#xA;&lt;p&gt;When you double-click a function you wrote, something cool happens. Instruments switches to the source view and displays the function you double-clicked. It also highlights the code with a message bubble that looks similar to the message bubbles Xcode shows when you have a compiler error or warning. The exact contents depend on the instrument, but the following is an example from the ObjectAlloc instrument:&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2010/03/Instruments-Source-View.png&#34; border=&#34;0&#34; alt=&#34;Instruments Source View.png&#34; width=&#34;571&#34; height=&#34;305&#34; /&gt; &#xA;&lt;p&gt;Each line of code that allocates memory is highlighted. The amount of memory allocated by that line of code appears on the right.&lt;/p&gt;&#xA;&lt;p&gt;The Leaks instrument highlights every line of code that leaks memory and tells you the total amount of leaked memory. The Time Profile and Sampler instruments tell you the number of samples recorded for a line of code.&lt;/p&gt;&#xA;&lt;p&gt;If you look at the screenshot, you’ll notice an information button next to the amount of allocated memory. Clicking the information button shows you the five heaviest backtraces. For the ObjectAlloc instrument, the heaviest backtraces are the largest memory allocations. For the Leaks instrument, the heaviest backtraces are the largest memory leaks.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Value Expressions: Where to Find Documentation</title>
      <link>https://www.meandmark.com/value-expressions-where-to-find-documentation/</link>
      <pubDate>Mon, 03 May 2010 04:40:08 +0000</pubDate>
      <guid>https://www.meandmark.com/value-expressions-where-to-find-documentation/</guid>
      <description>&lt;p&gt;When you open a mapping model in a Core Data project, you’ll see that attributes and relationships have a value expression, and you have the option to change the value expression. For attributes the value expression is usually simple.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;$source.AttributeName&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;I wanted to see what kinds of values you could give a value expression. I did a Google search and found some questions from people on mailing lists and message boards from people who wanted the same information as I did. But I found no answers. After doing some more searching, I learned an important piece of information.&lt;/p&gt;&#xA;&lt;p&gt;A value expression is an object of the NSExpression class. With this information I could look at Apple’s documentation. The place to start is the NSExpression class reference. In the class reference is a link to Apple’s &lt;strong&gt;Predicate Programming Guide&lt;/strong&gt;. After looking at both documents, I learned value expressions are a large topic with many possible values, too many for me to answer here. But I now know where to look when I need information on value expressions. Now you know where to look too.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Troubleshooting PNG Loading with SDL_image</title>
      <link>https://www.meandmark.com/troubleshooting-png-loading-with-sdl_image/</link>
      <pubDate>Tue, 27 Apr 2010 20:17:09 +0000</pubDate>
      <guid>https://www.meandmark.com/troubleshooting-png-loading-with-sdl_image/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;http://www.libsdl.org/projects/SDL_image&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;SDL_image&lt;/a&gt; is a library that simplifies loading image files for SDL games. One of the more popular image file formats for games is PNG, and SDL_image has support for PNG. On game development message boards, you’ll find many questions from people having trouble loading PNG files with SDL_image. This trouble has two common causes.&lt;/p&gt;&#xA;&lt;h2 id=&#34;cause-1-png-files-not-found&#34; class=&#34;relative group&#34;&gt;Cause 1: PNG Files Not Found &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#cause-1-png-files-not-found&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The most common cause of trouble of PNG file loading is the operating system being unable to find the file. Suppose you have the following SDL_image function call in your code to load an image:&lt;/p&gt;&#xA;&lt;pre&gt;SDL_Surface* image;&#xA;image = IMG_Load_RW(&#34;background.png&#34;, 1);&lt;/pre&gt;&#xA;&lt;p&gt;That code works only if the file &lt;strong&gt;background.png&lt;/strong&gt; is in the current working directory. If the file isn’t in the current working directory, SDL_image won’t load it, and you have problems.&lt;/p&gt;&#xA;&lt;p&gt;On Linux and Windows, the current working directory is the directory where the executable file is. Make sure your image files are in the same directory as the executable file.&lt;/p&gt;&#xA;&lt;p&gt;On Mac OS X, SDL sets the working directory to the directory containing the application bundle. But your image files are in the Resources folder inside the application bundle. This means the code example to load &lt;strong&gt;background.png&lt;/strong&gt; will not work on Mac OS X. The best solution is to change the working directory. My &lt;a href=&#34;http://meandmark.com/blog/2009/12/sdl-tips-for-mac-os-x&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;SDL Tips for Mac OS X post&lt;/a&gt; has instructions on changing the working directory.&lt;/p&gt;&#xA;&lt;h2 id=&#34;cause-2-dlls-not-found&#34; class=&#34;relative group&#34;&gt;Cause 2: DLLs Not Found &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#cause-2-dlls-not-found&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;The second common cause of PNG loading problems affects only Windows programmers. For SDL code to run on Windows, Windows must be able to find the SDL DLLs. To find the DLLs, they must reside either in the same directory as the executable file or in the &lt;strong&gt;windows\system32&lt;/strong&gt; directory.&lt;/p&gt;&#xA;&lt;p&gt;To use SDL_image on Windows, you must add the SDL_image DLL to the same location as the SDL DLL. Most people remember to add the SDL_image DLL, but they discover PNG files will not load.&lt;/p&gt;&#xA;&lt;p&gt;The reason the PNG files will not load is that loading PNG files with SDL_image on Windows requires the zlib and libpng DLLs as well as the SDL_image DLL. It’s an easy mistake to make, and the error message SDL_image returns isn’t very clear. The solution is to move the zlib and libpng DLLs to the same location as the SDL and SDL_image DLLs.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Comment Emails</title>
      <link>https://www.meandmark.com/comment-emails/</link>
      <pubDate>Tue, 09 Mar 2010 03:30:04 +0000</pubDate>
      <guid>https://www.meandmark.com/comment-emails/</guid>
      <description>&lt;p&gt;I’ve been testing a WordPress plug-in that sends first-time commenters an email asking them to verify their email address. Clicking the verification link in the email gets the comment approved immediately so you don’t have to wait for me to approve the comment.&lt;/p&gt;&#xA;&lt;p&gt;When you submit your first comment, you’ll get a message on the blog saying that a verification email was sent. If you don’t get an email within a few minutes check your spam folder. If the email is not there, you most likely won’t be getting an email. You’ll have to wait for me to approve the comment. But the newest version I’ve tested has been working well so you should be getting verification emails.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Shark and Java on Snow Leopard</title>
      <link>https://www.meandmark.com/shark-and-java-on-snow-leopard/</link>
      <pubDate>Wed, 24 Feb 2010 23:34:11 +0000</pubDate>
      <guid>https://www.meandmark.com/shark-and-java-on-snow-leopard/</guid>
      <description>&lt;p&gt;In my research for the Shark chapter of the new edition of the Xcode book, I had a difficult time getting Shark to profile a Java program in Snow Leopard. I’m writing this post to spare others my pain.&lt;/p&gt;&#xA;&lt;p&gt;For Java profiling to work with Shark, you must link Shark with the Java virtual machine. To link Shark with the Java virtual machine, you must add the following flag to the virtual machine:&lt;/p&gt;&#xA;&lt;pre&gt;-agentlib:Shark&lt;/pre&gt;&#xA;&lt;p&gt;Profiling with Shark on Snow Leopard is complicated by the fact that Snow Leopard initially uses the 64-bit version of the Java virtual machine. Shark does not work with 64-bit Java applications. You must use the 32-bit version of the Java virtual machine to profile with Shark. Add the following flag to the virtual machine&lt;/p&gt;&#xA;&lt;pre&gt;-d32&lt;/pre&gt;&#xA;&lt;p&gt;If you’re using Xcode 3.2 to write your Java applications, you must add the flags to the &lt;strong&gt;build.xml&lt;/strong&gt; file Xcode includes when you create a Java project. Search &lt;strong&gt;build.xml&lt;/strong&gt; for the &lt;strong&gt;&lt;/java&gt;&lt;/strong&gt; tag and add the flags before that tag.&lt;/p&gt;&#xA;&lt;pre&gt;&amp;lt;jvmarg value=&#34;-d32&#34;/&amp;gt;&#xA;&amp;lt;jvmarg value=&#34;-agentlib:Shark&#34;/&amp;gt;&lt;/pre&gt;&#xA;&lt;p&gt;At this point you’ll be able to use the Java Time Profile and Java Call Trace profiles. You won’t be able to use the Java Alloc Trace profile because Snow Leopard uses JVM 1.6, and the Java Alloc Trace profile doesn’t work with it. You will have to install JVM 1.5 to use Java Alloc Trace.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>New Comment Policy</title>
      <link>https://www.meandmark.com/new-comment-policy/</link>
      <pubDate>Mon, 01 Feb 2010 02:16:08 +0000</pubDate>
      <guid>https://www.meandmark.com/new-comment-policy/</guid>
      <description>&lt;p&gt;Spammers have forced me to start moderating comments on this blog. The moderation applies only to the first comment you make. Your first comment will not appear on the blog immediately. When you submit the comment, it will go into a moderation queue for me to approve. Assuming your comment is not spam, it may take up to 24 hours for the comment to appear on the blog.&lt;/p&gt;&#xA;&lt;p&gt;Once you get a comment approved, any future comments you make will not be subject to moderation. They will appear on the blog when you submit them.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 3.2: Renaming Projects</title>
      <link>https://www.meandmark.com/xcode-3-2-renaming-projects/</link>
      <pubDate>Wed, 27 Jan 2010 05:02:38 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-2-renaming-projects/</guid>
      <description>&lt;p&gt;Xcode 3.2 added the ability to rename projects. Choose Project &amp;gt; Rename Project.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2010/01/RenameProject.png&#34; alt=&#34;RenameProject.png&#34; border=&#34;0&#34; width=&#34;475&#34; height=&#34;380&#34; /&gt; &#xA;&lt;p&gt;Xcode is set to rename all files in the project that are based on the project name: project file, targets, build products (application name is an example), precompiled headers, and property lists. If you want to keep the old name for some files, deselect the checkbox in the left column.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Reading Third-Party Documentation in Xcode 3.2</title>
      <link>https://www.meandmark.com/reading-third-party-documentation-in-xcode-3-2/</link>
      <pubDate>Fri, 22 Jan 2010 21:12:13 +0000</pubDate>
      <guid>https://www.meandmark.com/reading-third-party-documentation-in-xcode-3-2/</guid>
      <description>&lt;p&gt;Apple supplies documentation sets that let you read Mac OS X, iPhone, and developer tools documentation in Xcode. But you are not limited to reading Apple’s documentation in Xcode. This post shows you how to install and read third-party documentation in Xcode.&lt;/p&gt;&#xA;&lt;p&gt;Xcode has one requirement for third-party documentation sets. The documentation set must be either an RSS or Atom feed. If you want an example of a documentation set, the cocos2D game engine has an Atom feed at the following URL:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://aptocore.com/downloads/cocos2d/cocos2d-iphone-doc.atom&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;http://aptocore.com/downloads/cocos2d/cocos2d-iphone-doc.atom&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;opening-xcode8217s-documentation-preferences&#34; class=&#34;relative group&#34;&gt;Opening Xcode’s Documentation Preferences &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#opening-xcode8217s-documentation-preferences&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Open Xcode’s preferences by choosing Xcode &amp;gt; Preferences. Click the Documentation button in the Xcode toolbar window. The Documentation button is on the far right. You’ll have to use the scroll bar to get to it unless you have a very wide monitor. You should see the documentation sets on the left side of the documentation preferences.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2010/01/Documentation-Sets.png&#34; alt=&#34;Documentation Sets.png&#34; border=&#34;0&#34; width=&#34;396&#34; height=&#34;369&#34; /&gt; &#xA;&lt;h3 id=&#34;adding-a-documentation-feed&#34; class=&#34;relative group&#34;&gt;Adding a Documentation Feed &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#adding-a-documentation-feed&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Click the Add Documentation Set Publisher button. You will be asked for a feed URL. RSS feeds start with &lt;strong&gt;feed://&lt;/strong&gt; while Atom feeds start with &lt;strong&gt;http://&lt;/strong&gt;. Click the OK button when you’ve finished entering the feed URL.&lt;/p&gt;&#xA;&lt;h3 id=&#34;installing-the-documentation&#34; class=&#34;relative group&#34;&gt;Installing the Documentation &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#installing-the-documentation&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;After adding your documentation feed, it should appear in the list of available sets. Click the Get button to install the documentation in Xcode.&lt;/p&gt;&#xA;&lt;h3 id=&#34;reading-the-documentation&#34; class=&#34;relative group&#34;&gt;Reading the Documentation &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#reading-the-documentation&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;After installing the documentation, open Xcode’s documentation window by choosing Help &amp;gt; Developer Documentation. Click the Home button in the documentation window toolbar. A menu with a list of installed documentation sets opens. The documentation set you installed should be one of the menu choices. Choose it to read the documentation.&lt;/p&gt;&#xA;&lt;h3 id=&#34;removing-the-documentation&#34; class=&#34;relative group&#34;&gt;Removing the Documentation &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#removing-the-documentation&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;To remove documentation you installed, open Xcode’s documentation preferences. Select the documentation set from the list of available sets. Right-click and choose Reveal In Finder. Drag the documentation set to the Trash.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>OpenGL Profiler Workaround</title>
      <link>https://www.meandmark.com/opengl-profiler-workaround/</link>
      <pubDate>Mon, 11 Jan 2010 03:04:42 +0000</pubDate>
      <guid>https://www.meandmark.com/opengl-profiler-workaround/</guid>
      <description>&lt;p&gt;I ran into a problem with OpenGL Profiler 4.2 on Snow Leopard. I would profile an application and pause profiling so I could look at the OpenGL statistics. When I opened the statistics window, it was blank. The trace window was also blank, and I had selected the Collect Trace checkbox in OpenGL Profiler’s main window.&lt;/p&gt;&#xA;&lt;p&gt;My workaround was to open the statistics and trace windows and start profiling. When I did this, both windows filled with the appropriate profiling data.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Getting Started with Mac Programming</title>
      <link>https://www.meandmark.com/getting-started-with-mac-programming/</link>
      <pubDate>Thu, 07 Jan 2010 05:07:22 +0000</pubDate>
      <guid>https://www.meandmark.com/getting-started-with-mac-programming/</guid>
      <description>&lt;p&gt;A question that comes up often in Mac programming forums is “Where do I start?” I have gathered a bunch of information and put it in this post to answer this question. Hopefully this helps people new to Mac development and reduces the frequency of “Where do I start?” questions on the forums.&lt;/p&gt;&#xA;&lt;p&gt;NOTE: The information in this post is for people writing Mac GUI applications, not games. You could write a Mac game without having to learn Objective-C and Cocoa. Getting started in game development would be a good topic for a future post.&lt;/p&gt;&#xA;&lt;h3 id=&#34;updatemarch2019&#34; class=&#34;relative group&#34;&gt;Update (March 2019) &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#updatemarch2019&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;The article &lt;a href=&#34;https://swiftdevjournal.com/resources-for-learning-mac-development/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Resources for Learning Mac Development&lt;/a&gt; contains a more up to date list of Mac programming resources.&lt;/p&gt;&#xA;&lt;h3 id=&#34;update-for-lion-and-xcode-4-users-july-2011&#34; class=&#34;relative group&#34;&gt;&lt;strong&gt;Update for Lion and Xcode 4 Users (July 2011)&lt;/strong&gt; &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update-for-lion-and-xcode-4-users-july-2011&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Mac OS X 10.7 does not include Xcode. Download Xcode from the Mac App Store. The version of Xcode on the Mac App Store includes the iPhone SDK. Xcode 4 integrates Interface Builder with Xcode. There is no separate Interface Builder application.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-tools-you-need&#34; class=&#34;relative group&#34;&gt;The Tools You Need &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#the-tools-you-need&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;If you have a copy of Mac OS X, you have the tools you need to write Mac applications. Apple includes developer tools, the Xcode Tools, with every copy of Mac OS X. Insert your Mac OS X DVD. The Xcode installer is in the Optional Installs folder.&lt;/p&gt;&#xA;&lt;p&gt;Apple constantly updates their developer tools. To get the latest version of Xcode, go to &lt;a href=&#34;http://developer.apple.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Apple’s developer site&lt;/a&gt;. You will have to sign up for a free ADC membership before you can download Xcode.&lt;/p&gt;&#xA;&lt;p&gt;If you’re interested in iPhone development, download the iPhone SDK instead of Xcode. The iPhone SDK contains both the Xcode Tools and the iPhone SDK. If you download Xcode, then download the iPhone SDK at a later date, you’re downloading Xcode twice, and Xcode is a large download.&lt;/p&gt;&#xA;&lt;p&gt;After installing Xcode you will have all the tools you need to write Mac applications. The tools you will use the most are Xcode and Interface Builder.&lt;/p&gt;&#xA;&lt;p&gt;Xcode is an integrated development environment. You will use Xcode to write your source code and compile the source code into a Mac application. You will use Interface Builder to create the user interface for your applications.&lt;/p&gt;&#xA;&lt;h3 id=&#34;learning-a-programming-language&#34; class=&#34;relative group&#34;&gt;Learning a Programming Language &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#learning-a-programming-language&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Before you can write Mac applications, you must know a programming language. If you have never programmed before, you will have to learn one. What language should you learn?&lt;/p&gt;&#xA;&lt;p&gt;If you’re serious about writing Mac applications, you should eventually learn Objective-C. The Cocoa framework uses Objective-C as well as the Cocoa Touch framework, which is used to write iPhone applications.&lt;/p&gt;&#xA;&lt;h4 id=&#34;your-first-language&#34; class=&#34;relative group&#34;&gt;Your First Language &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#your-first-language&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;Should you learn Objective-C first? If you post this question on a Mac programming message board, you will generate a lot of heated responses. These responses generally fall into three camps.&lt;/p&gt;&#xA;&lt;p&gt;Camp 1: Learn Objective-C first. You have to know Objective-C to write Cocoa applications so you should go ahead and learn Objective-C.&lt;/p&gt;&#xA;&lt;p&gt;Camp 2: Learn C, then Objective-C. Objective-C is a superset of C. It takes C and adds support for object-oriented programming. By learning C, you’ll make progress towards learning Objective-C.&lt;/p&gt;&#xA;&lt;p&gt;Camp 3: Learn a language like Python or Ruby first. C and Objective-C are too difficult for a beginner. Python and Ruby are easier to learn. Start with one of them. After you learn Python or Ruby, you can move on to Objective-C.&lt;/p&gt;&#xA;&lt;p&gt;Which camp is right? It depends on you and how you plan on learning Objective-C. If you plan on learning Objective-C through online tutorials, Camp 2 is right. Most Objective-C tutorials assume you know C so you would have to learn C first to understand the tutorials.&lt;/p&gt;&#xA;&lt;p&gt;If you plan on learning Objective-C through Stephen Kochan’s Objective-C book (&lt;a href=&#34;http://www.amazon.com/Programming-Objective-C-2-0-Stephen-Kochan/dp/0321566157&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Amazon link&lt;/a&gt;), Camp 1 is right. The book doesn’t assume you know C so you can use the book to learn Objective-C without learning C first.&lt;/p&gt;&#xA;&lt;p&gt;If you start learning C or Objective-C and have a hard time understanding the material, Camp 3 is right. Start with another language and learn Objective-C later.&lt;/p&gt;&#xA;&lt;h4 id=&#34;resources-for-learning-programming&#34; class=&#34;relative group&#34;&gt;Resources for Learning Programming &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#resources-for-learning-programming&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;The World Wide Web is full of programming tutorials. The following sites will give you a large collection of programming language tutorials:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://www.cocoadevcentral.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;CocoaDevCentral&lt;/a&gt; has tutorials on C and Objective-C.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://www.cprogramming.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;CProgramming.com&lt;/a&gt; has C tutorials.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&#34;http://www.python.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Python website&lt;/a&gt; has tutorials for learning Python in the Documentation section.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&#34;http://www.ruby-lang.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Ruby website&lt;/a&gt; has Ruby tutorials in the Documentation section.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Some of you will prefer learning programming from a book. You can find books on Mac programming, Python, and Ruby from the following publishers:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://www.apress.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Apress&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://www.informit.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;InformIT&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://oreilly.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;O’Reilly&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://pragprog.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Pragmatic Programmers&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Three programming language books that would help someone interested in Mac programming are the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Learn C on the Mac&lt;/strong&gt; by Dave Mark.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Learn Objective-C on the Mac&lt;/strong&gt; by Mark Dalrymple and Scott Knaster. This book is a sequel of sorts to &lt;strong&gt;Learn C on the Mac&lt;/strong&gt; and assumes you’ve read &lt;strong&gt;Learn C on the Mac&lt;/strong&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Programming in Objective-C 2.0&lt;/strong&gt; by Stephen Kochan.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;learning-programming-on-a-mac&#34; class=&#34;relative group&#34;&gt;Learning Programming on a Mac &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#learning-programming-on-a-mac&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;If you’re learning C or Objective-C, you can use Xcode to learn the language. Create a command-line tool project for each program you write. In Xcode 3.2 take the following steps to create a command-line tool project:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Choose File &amp;gt; New Project in Xcode.&lt;/li&gt;&#xA;&lt;li&gt;Select Application under Mac OS X on the left side of the New Project Assistant.&lt;/li&gt;&#xA;&lt;li&gt;Select Command Line Tool at the top of the New Project Assistant.&lt;/li&gt;&#xA;&lt;li&gt;Pick your language from the Type pop-up menu. Choose Foundation for Objective-C.&lt;/li&gt;&#xA;&lt;li&gt;Click the Choose button.&lt;/li&gt;&#xA;&lt;li&gt;Name your project and pick a location to save it.&lt;/li&gt;&#xA;&lt;li&gt;Click the Save button.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Those of you running Xcode 4 should click the Next button after Step 3. The Choose button in Step 5 is named Next in Xcode 4. Step 6 is split in Xcode 4. You name the project when you pick a language.&lt;/p&gt;&#xA;&lt;p&gt;For those of you running older versions of Xcode, create a Standard Tool project to learn C or a Foundation Tool project to learn Objective-C.&lt;/p&gt;&#xA;&lt;p&gt;Some people think integrated development environments like Xcode hide too many details from beginning programmers, which hinders learning. They suggest beginners write their source code in a text editor and compile it from the Terminal application. For more information on compiling from the Terminal, read my &lt;a href=&#34;http://meandmark.com/blog/2008/09/avoiding-xcode&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Avoiding Xcode&lt;/a&gt; post.&lt;/p&gt;&#xA;&lt;p&gt;If you’re learning Python or Ruby, I have good news. Mac OS X comes with Python and Ruby interpreters so you can start writing Python and Ruby programs right now. For Python and Ruby programming, I recommend using TextWrangler, which is a free text editor. You can write, run, and debug Python and Ruby programs inside TextWrangler. My &lt;a href=&#34;http://meandmark.com/blog/2007/01/textwrangler-and-interpreted-languages&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;TextWrangler and Interpreted Languages&lt;/a&gt; post has more information on using TextWrangler.&lt;/p&gt;&#xA;&lt;h3 id=&#34;learning-cocoa&#34; class=&#34;relative group&#34;&gt;Learning Cocoa &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#learning-cocoa&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;After learning Objective-C, you can move on to learning Cocoa. Cocoa is Apple’s framework for writing GUI applications on Mac OS X. Cocoa is a large framework so prepare to spend a lot of time learning it.&lt;/p&gt;&#xA;&lt;h4 id=&#34;cocoa-books&#34; class=&#34;relative group&#34;&gt;Cocoa Books &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#cocoa-books&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;When people ask for book recommendations on Mac programming message boards, the usual recommendation is Aaron Hillegass’ &lt;strong&gt;Cocoa Programming for Mac OS X&lt;/strong&gt; (&lt;a href=&#34;http://www.amazon.com/Cocoa-Programming-Mac-OS-3rd/dp/0321503619&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Amazon link&lt;/a&gt;). This book does a good job of teaching the fundamentals of Cocoa programming. Hillegass assumes the reader knows C so his book is not right for people completely new to programming.&lt;/p&gt;&#xA;&lt;p&gt;Cocoa is becoming a hot topic for computer book publishers. You can find a lot of new and upcoming Cocoa books from the following publishers:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://www.apress.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Apress&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://www.informit.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;InformIT&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://oreilly.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;O’Reilly&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://pragprog.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Pragmatic Programmers&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h4 id=&#34;cocoa-learning-resources&#34; class=&#34;relative group&#34;&gt;Cocoa Learning Resources &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#cocoa-learning-resources&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;The biggest source for Cocoa documentation is Apple. You can read Apple’s documentation in Xcode by choosing Help &amp;gt; Developer Documentation. You can also read it online at &lt;a href=&#34;http://developer.apple.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Apple’s developer site&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Some other sites that will help you learn Cocoa are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://www.cocoadevcentral.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;CocoaDevCentral&lt;/a&gt;, which has a lot of Cocoa tutorials.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://www.cocoadev.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;CocoaDev&lt;/a&gt;, which has lots of Cocoa information and a forum to ask questions.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://www.planetcocoa.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;PlanetCocoa&lt;/a&gt;, which is a large collection of Cocoa programming blogs.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;http://www.cocoabuilder.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Cocoabuilder&lt;/a&gt;, which contains an archive of Apple’s Cocoa mailing list.&lt;/li&gt;&#xA;&lt;li&gt;Andy Matuschak has a &lt;a href=&#34;http://andymatuschak.org/articles/2007/09/09/getting-started-with-cocoa-a-friendlier-approach&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;learning path for Cocoa&lt;/a&gt; on his blog.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This list is obviously not exhaustive. Use your favorite search engine to find more resources for learning Cocoa development and learning programming in general.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 3.2: New Project Assistant</title>
      <link>https://www.meandmark.com/xcode-3-2-new-project-assistant/</link>
      <pubDate>Mon, 04 Jan 2010 20:52:04 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-2-new-project-assistant/</guid>
      <description>&lt;p&gt;Xcode 3.1 changed the way you pick a project template when creating a new project. Previous versions of Xcode had a list of all installed project templates for you to choose. Xcode 3.1 filled the left side of the New Project Assistant with project categories like Application and Framework. Selecting the category filled the top of the New Project Assistant with the project templates in that category.&lt;/p&gt;&#xA;&lt;p&gt;Xcode 3.2 makes further changes. Suppose you’re writing a Cocoa application in Objective-C. In Xcode 3.1 you could choose from the following templates:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Cocoa Application&lt;/li&gt;&#xA;&lt;li&gt;Cocoa Document-based Application&lt;/li&gt;&#xA;&lt;li&gt;Core Data Application&lt;/li&gt;&#xA;&lt;li&gt;Core Data Document-based Application&lt;/li&gt;&#xA;&lt;li&gt;Core Data Document-based Application with Spotlight&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In Xcode 3.2, you have one template: Cocoa Application. There is an Options section with checkboxes for document-based applications, Core Data, and Spotlight importer.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2010/01/NewProjectCocoaApp.png&#34; alt=&#34;NewProjectCocoaApp.png&#34; border=&#34;0&#34; width=&#34;475&#34; height=&#34;330&#34; /&gt; &#xA;&lt;p&gt;The screenshot provides a hint on how to create a command-line application in Xcode 3.2. Select Command Line Tool, and the Options checkboxes are replaced by a Type pop-up menu. Use the Type menu to pick the language: C, C++, or Objective-C. Choose Foundation to write an Objective-C command-line application.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>The Story of the Blog Move</title>
      <link>https://www.meandmark.com/the-story-of-the-blog-move/</link>
      <pubDate>Sat, 02 Jan 2010 05:37:24 +0000</pubDate>
      <guid>https://www.meandmark.com/the-story-of-the-blog-move/</guid>
      <description>&lt;p&gt;Normally I write about technical topics like Xcode, Mac development, SDL, and game development. But I am in the midst of a 30-day trial of MarsEdit, and I can’t think of a good technical topic right now so I am writing about my experience moving my blog to WordPress.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-i-was-using&#34; class=&#34;relative group&#34;&gt;What I Was Using &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#what-i-was-using&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;For the past 18 months, I used RapidWeaver’s blog software to create the blog. RapidWeaver is a Mac website building application for people who want a good-looking site without having to hand code HTML and CSS. The biggest advantage of using RapidWeaver’s blog software is the blog matches the look of the rest of the site. But RapidWeaver’s blog software has two disadvantages.&lt;/p&gt;&#xA;&lt;p&gt;First, the entire blog is treated as a single page. When you add a new post to the blog and export it, RapidWeaver creates the entire blog, not just the parts that changed. If your blog has a lot of posts, creating the entire blog every time you add a post is wasteful.&lt;/p&gt;&#xA;&lt;p&gt;Second, RapidWeaver blogs do not provide navigation links to read older posts. Suppose your blog has 50 total posts and displays 10 posts per page. Someone visits your blog, reads the 10 most recent posts and wants to read the next 10 posts. The visitor can’t do that. All he or she can do is click archive links to read older posts.&lt;/p&gt;&#xA;&lt;p&gt;I could live with these two weaknesses, but I encountered a third problem. When I created the blog with RapidWeaver, HaloScan was the built-in way to add comments to the site. HaloScan was purchased by JS-Kit. They are currently in the process of discontinuing HaloScan, moving them over to Echo, their new commenting system. Echo is not free, and I didn’t need all of its features so it was time to move on.&lt;/p&gt;&#xA;&lt;h3 id=&#34;finding-a-new-commenting-system&#34; class=&#34;relative group&#34;&gt;Finding a New Commenting System &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#finding-a-new-commenting-system&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Because a blog without comments isn’t much of a blog (I can write articles on my site if I want to share information without comments), I searched for a new commenting system. I found two systems to examine: &lt;a href=&#34;http://disqus.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Disqus&lt;/a&gt; and &lt;a href=&#34;http://intensedebate.com&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Intense Debate&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Disqus and Intense Debate had instructions on adding it to blogging platforms like WordPress and Blogger, but no RapidWeaver instructions. They had code to embed into a blog, but I couldn’t find a place to place the code in RapidWeaver.&lt;/p&gt;&#xA;&lt;p&gt;I decided to see if there were better blogging solutions, and I came upon &lt;a href=&#34;http://nilrogsplace.se/plugins/wpblog&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;WP-Blog&lt;/a&gt;, which is a plug-in that lets you use a WordPress blog that matches the look of a RapidWeaver site. So I decided to try &lt;a href=&#34;http://wordpress.org&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;WordPress&lt;/a&gt; and WP-Blog.&lt;/p&gt;&#xA;&lt;h3 id=&#34;installing-wordpress&#34; class=&#34;relative group&#34;&gt;Installing WordPress &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#installing-wordpress&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Installing WordPress was very easy for me because my web host has support for Fantastico. Fanatastico lets you perform a one-click install of WordPress. The only thing I had to do was rename my old blog directory on my FTP site because I wanted to use the same directory for my WordPress blog.&lt;/p&gt;&#xA;&lt;p&gt;After installing WordPress I logged into my WordPress account. From there I could access tools to import old blog posts to the WordPress blog. I used the RapidWeaver blog’s RSS feed to import my posts. As a bonus, I was able to use the Blogger import tool to import the posts from my old Blogger blog. It even imported the comments from Blogger.&lt;/p&gt;&#xA;&lt;p&gt;The importing went well. The images from the RapidWeaver blog were missing, but I expected that. I didn’t have too many images to upload so it wasn’t a big problem. There were some line spacing issues importing the Blogger posts, but the posts were readable.&lt;/p&gt;&#xA;&lt;p&gt;One last thing I did was change the permalink structure. The initial permalink structure is to use the post number like p41 or p92. I wanted more meaningful names so I changed the structure to use the month, year, and title. But this caused a problem because I didn’t have a .htaccess file in the blog directory. I created one in a text editor, pasted the code WordPress provided, and uploaded the .htaccess file to my site.&lt;/p&gt;&#xA;&lt;h3 id=&#34;installing-wp-blog&#34; class=&#34;relative group&#34;&gt;Installing WP-Blog &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#installing-wp-blog&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;At this point I had my WordPress blog working, but I was using the default theme, which didn’t match the look of my site. I had to install WP-Blog. I copied the plugin, WP-Blog.rwplugin to the following location:&lt;/p&gt;&#xA;&lt;pre&gt;/Users/Username/Library/Application Support/RapidWeaver&lt;/pre&gt;&#xA;&lt;p&gt;After copying the WP-Blog plugin, I opened my site in RapidWeaver and added a WP-Blog page to my site. I opened the page inspector and configured the blog, including setting up the following information:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The location of the blog&lt;/li&gt;&#xA;&lt;li&gt;The date format&lt;/li&gt;&#xA;&lt;li&gt;The number of archive links to show on the sidebar&lt;/li&gt;&#xA;&lt;li&gt;The location of the search field&lt;/li&gt;&#xA;&lt;li&gt;The RSS feeds&lt;/li&gt;&#xA;&lt;li&gt;Whether or not to allow permalinks&lt;/li&gt;&#xA;&lt;li&gt;Whether or not to allow comments&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;When I had the new blog set up, I exported the page. The export created four items:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A files folder&lt;/li&gt;&#xA;&lt;li&gt;An index_files folder&lt;/li&gt;&#xA;&lt;li&gt;index.html&lt;/li&gt;&#xA;&lt;li&gt;index.php&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I uploaded the files folder, the index_files folder, and index.php to my site, and my WordPress blog looked like the rest of my site.&lt;/p&gt;&#xA;&lt;h3 id=&#34;conclusion&#34; class=&#34;relative group&#34;&gt;Conclusion &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#conclusion&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;So far I’m happy with the switch to WordPress. I have a blog that matches the rest of my site, has comments without my having to install a separate commenting system, has navigation links for older posts, and has search capabilities.&lt;/p&gt;&#xA;&lt;h3 id=&#34;update&#34; class=&#34;relative group&#34;&gt;Update &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#update&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;I did not make myself clear when I originally wrote this post because I keep getting questions about commenting systems. I use the built-in WordPress commenting system.&lt;/p&gt;&#xA;&lt;p&gt;I have not used or installed Disqus, Intense Debate, or any other commenting system. Because of this, I cannot answer any questions about what commenting system is best or answer any question about installing Disqus, Intense Debate, or any other commenting system.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Moved to WordPress</title>
      <link>https://www.meandmark.com/hello-world-2/</link>
      <pubDate>Wed, 30 Dec 2009 20:25:57 +0000</pubDate>
      <guid>https://www.meandmark.com/hello-world-2/</guid>
      <description>&lt;p&gt;I moved the blog to WordPress. I was able to import all the posts from the old blog and from the even older Blogger site. The comments from the Blogger site survived the import, but not the comments from the other blog. Images are missing from some of the newer posts, but I should have them up soon.&lt;/p&gt;&#xA;&lt;p&gt;For now I’m using one of the standard WordPress themes. I am working on getting the blog to match the look of the rest of the site.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Comments Off</title>
      <link>https://www.meandmark.com/comments-off/</link>
      <pubDate>Tue, 29 Dec 2009 05:45:21 +0000</pubDate>
      <guid>https://www.meandmark.com/comments-off/</guid>
      <description>&lt;p&gt;I have turned off comments temporarily. This blog had been using HaloScan for comments. They were purchased by JS-Kit, which is migrating HaloScan to Echo. Echo is not free, and I don’t get enough comments on this blog to warrant paying for a commenting service.&lt;/p&gt;&#xA;&lt;p&gt;Until I find a suitable commenting system, use the Contact link in the sidebar if you have any questions or comments about the blog posts.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>SDL Tips for Mac OS X</title>
      <link>https://www.meandmark.com/sdl-tips-for-mac-os-x/</link>
      <pubDate>Tue, 29 Dec 2009 05:30:32 +0000</pubDate>
      <guid>https://www.meandmark.com/sdl-tips-for-mac-os-x/</guid>
      <description>&lt;p&gt;SDL’s most compelling feature is its cross-platform compatibility. You can use the same source code to write a game for Linux, Mac OS X, Windows, and any other system SDL supports. When people write a game with SDL on Linux or Windows and try to build a Mac version of your game, they learn that Mac OS X has some subtle differences from Linux and Windows. The three tips in this post should help people create Mac versions of their SDL games.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Use the Xcode Project Templates&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you haven’t done so already, go to the &lt;a rel=&#34;self&#34; href=&#34;http://www.libsdl.org&#34;&gt;SDL website&lt;/a&gt; and download it. At the SDL download site, you will see both runtime and development libraries for Mac OS X. Download both libraries. The runtime libraries contain the SDL framework. The development libraries contain documentation and Xcode project templates.&lt;/p&gt;&#xA;&lt;p&gt;The Xcode project templates do two nice things for you when you build the project. First, the templates create a proper Mac application bundle for you. Second, the templates copy the SDL framework to the application bundle. Including the SDL framework with your game lets people play your game without having to install SDL.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Adding Files to the Game&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Games contain many external files, such as graphics, sound, and data files. Mac games store these files in the Resources folder inside the game’s application bundle. If you add graphics, sound, and data files to your project’s Resources folder, they will be copied to the application bundle’s Resources folder when you build your project.&lt;/p&gt;&#xA;&lt;p&gt;Go to the Groups and Files list on the left side of Xcode’s project window. The top entry should be the name of your project. Click the disclosure triangle next to the project name to see a series of folders. Right-click the Resources folder and choose Add &amp;gt; Existing Files. Select the files you want to add and click the Add button.&lt;/p&gt;&#xA;&lt;p&gt;A second sheet will open. If you are adding individual files, click the Add button. If you’re adding a folder of files, click the Create Folder References for any added folders radio button before clicking the Add button. Creating a folder reference copies the folder to the Resources folder inside the application bundle when Xcode builds your project.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Changing the Working Directory&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Mac OS X version of SDL sets the working directory to the directory containing the application bundle. This default behavior makes loading images and sounds more difficult because the images and sounds usually reside in the application bundle’s Resources folder. You can make file loading simpler by changing the working directory to the Resources folder.&lt;/p&gt;&#xA;&lt;p&gt;Open the file SDLMain.m and modify the setupWorkingDirectory: method. The following code changes the working directory to the application bundle’s Resources folder:&lt;/p&gt;&#xA;&lt;pre&gt;NSString *resourcePath = [[NSBundle mainBundle] resourcePath];&#xA;[[NSFileManager defaultManager] changeCurrentDirectoryPath:resourcePath];&lt;/pre&gt;&#xA;&lt;p&gt;By changing the working directory to the application’s Resources folder, you should be able to use the same code to load files on Linux, Mac OS X, and Windows.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Downloading Older Versions of Xcode</title>
      <link>https://www.meandmark.com/downloading-older-versions-of-xcode/</link>
      <pubDate>Wed, 21 Oct 2009 21:10:20 +0000</pubDate>
      <guid>https://www.meandmark.com/downloading-older-versions-of-xcode/</guid>
      <description>&lt;p&gt;Apple makes it easy to download the latest version of Xcode. But older versions of Xcode are harder to find. I’ve read many questions on Mac programming forums from people who have trouble finding older versions of Xcode on Apple’s site. Take the following steps to find older versions of Xcode:&lt;/p&gt;&#xA;&lt;ol class=&#34;arabic-numbers&#34;&gt;&#xA;  &lt;li&gt;&#xA;    Go to the &lt;a href=&#34;https://developer.apple.com/downloads/index.action&#34; rel=&#34;self&#34;&gt;Apple Developer Connection site&lt;/a&gt;.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    If you do not have an ADC membership, click the Join Now button.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Login to ADC with your Apple ID and password.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Click the Downloads link.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Click the Developer Tools link on the right side of the page.&#xA;  &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Now you will find every version of Xcode Apple has released. Those of you running Leopard will want to download Xcode 3.1.4. Those of you running Tiger will want Xcode 2.5. Those of you running Panther will want Xcode 1.5.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Interface Builder 3.2: Outlets and Actions</title>
      <link>https://www.meandmark.com/interface-builder-3-2-outlets-and-actions/</link>
      <pubDate>Mon, 21 Sep 2009 04:05:58 +0000</pubDate>
      <guid>https://www.meandmark.com/interface-builder-3-2-outlets-and-actions/</guid>
      <description>&lt;p&gt;In previous versions of Interface Builder, you used the identity inspector to add outlets and actions to a user interface element. Interface Builder 3.2 moved this functionality to the Library. If the Library window isn’t open, choose Tools &amp;gt; Library to open it. Click the Classes tab in the Library window. Select a class. Use the Outlets and Actions tabs to view, add, and remove outlets and actions for the selected class.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; class=&#34;alignnone size-full wp-image-74&#34; title=&#34;InterfaceBuilderActions&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2009/09/InterfaceBuilderActions.jpg&#34; alt=&#34;InterfaceBuilderActions&#34; width=&#34;315&#34; height=&#34;758&#34; /&gt;</description>
    </item>
    <item>
      <title>Xcode 3.2: Project Templates Removed</title>
      <link>https://www.meandmark.com/xcode-3-2-project-templates-removed/</link>
      <pubDate>Wed, 16 Sep 2009 04:25:21 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-2-project-templates-removed/</guid>
      <description>&lt;p&gt;In Xcode 3.2 Apple removed all Carbon project templates as well as the Cocoa projects that used Python and Ruby. You can install Xcode 3.1 alongside 3.2 if you need the templates Apple removed. Apple doesn’t officially support Xcode 3.1 on Snow Leopard, but Xcode 3.1 can be installed and run on Snow Leopard. If Xcode 3.1 doesn’t work well for you, you can copy the project templates to the user templates location so you can use them in Xcode 3.2. Refer to &lt;a href=&#34;http://meandmarkpublishing.blogspot.com/2008/01/xcode-3-template-location-clarification.html&#34; rel=&#34;self&#34;&gt;this blog post&lt;/a&gt; from the old blog for more information on where the templates should be copied.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;a href=&#34;http://pyobjc.sourceforge.net&#34; rel=&#34;self&#34;&gt;PyObjC&lt;/a&gt; and &lt;a href=&#34;http://rubycocoa.sourceforge.net&#34; rel=&#34;self&#34;&gt;Ruby Cocoa&lt;/a&gt; websites are the places to visit for the latest Python and Ruby project templates. For those of you interested in writing Cocoa applications in Ruby, &lt;a href=&#34;http://www.macruby.org&#34; rel=&#34;self&#34;&gt;Mac Ruby&lt;/a&gt; is another project to check out.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 3.2: Creating Java Projects</title>
      <link>https://www.meandmark.com/xcode-3-2-creating-java-projects/</link>
      <pubDate>Mon, 14 Sep 2009 03:05:30 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-2-creating-java-projects/</guid>
      <description>&lt;p&gt;In Xcode 3.2 when you choose File &amp;gt; New Project, there are no Java templates in the New Project Assistant. To create Java projects you must open the organizer by choosing Window &amp;gt; Organizer. At the bottom of the Organizer, you will see three buttons.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; class=&#34;alignnone size-full wp-image-80&#34; title=&#34;OrganizerBottomBar&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2009/09/OrganizerBottomBar.jpg&#34; alt=&#34;OrganizerBottomBar&#34; width=&#34;216&#34; height=&#34;30&#34; /&gt; &#xA;&lt;p&gt;Click the + button on the left and choose New From Template &amp;gt; Java Templates to create a Java project. Click the right button at the bottom of the Organizer to show the editor. Use the editor to write your code.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 3.2: Changing the Organization Name</title>
      <link>https://www.meandmark.com/xcode-3-2-changing-the-organization-name/</link>
      <pubDate>Fri, 11 Sep 2009 05:15:34 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-2-changing-the-organization-name/</guid>
      <description>&lt;p&gt;In Xcode 3.2 Apple made it easier to change the organization name so the copyright notice at the top of newly created files doesn’t say __MyCompanyName__. Choose Project &amp;gt; Edit Project Settings and click the General tab in the inspector. At the bottom of the inspector is a text field to enter the organization name. This name will appear in the copyright notice for any new files you create for this project.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; class=&#34;alignnone size-full wp-image-82&#34; title=&#34;OrganizationName&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2009/09/OrganizationName.jpg&#34; alt=&#34;OrganizationName&#34; width=&#34;390&#34; height=&#34;593&#34; /&gt;</description>
    </item>
    <item>
      <title>Xcode 3.2: Where Did the Build Transcript Go?</title>
      <link>https://www.meandmark.com/xcode-3-2-where-did-the-build-transcript-go/</link>
      <pubDate>Thu, 10 Sep 2009 01:26:13 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-2-where-did-the-build-transcript-go/</guid>
      <description>&lt;p&gt;The build transcript lets you see the details of how Xcode built your project. If you upgraded to Xcode 3.2 and looked at the build results window, you noticed the group of four buttons that let you open the build transcript was missing. How do you access the build transcript?&lt;/p&gt;&#xA;&lt;p&gt;In the build results window you should see a listing for each step in the build. At a minimum, you shoud see one listing for each source code file in your project. Selecting a listing displays the build transcript button on the right side of the window. In the screenshot below, you can see the build transcript button next to the icon saying the file GameApp.cpp has 6 warnings.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; class=&#34;alignnone size-full wp-image-85&#34; title=&#34;BuildResultsWindow&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2009/09/BuildResultsWindow.jpg&#34; alt=&#34;BuildResultsWindow&#34; width=&#34;579&#34; height=&#34;301&#34; /&gt; &#xA;&lt;p&gt;Click the button to see the build transcript.&lt;/p&gt;&#xA;&lt;img loading=&#34;lazy&#34; decoding=&#34;async&#34; class=&#34;alignnone size-full wp-image-87&#34; title=&#34;BuildTranscript&#34; src=&#34;http://meandmark.com/blog/wp-content/uploads/2009/09/BuildTranscript.jpg&#34; alt=&#34;BuildTranscript&#34; width=&#34;558&#34; height=&#34;336&#34; /&gt; &#xA;&lt;p&gt;If a step in the build process generates errors or warnings, the build transcript button appears automatically.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Supporting Older Versions of Mac OS X</title>
      <link>https://www.meandmark.com/supporting-older-versions-of-mac-os-x/</link>
      <pubDate>Wed, 27 May 2009 20:12:49 +0000</pubDate>
      <guid>https://www.meandmark.com/supporting-older-versions-of-mac-os-x/</guid>
      <description>&lt;p&gt;A common question I see on Mac programming forums involves getting your program to run on older versions of Mac OS X. Suppose you’re writing a Mac application and you want it to run on Leopard (10.5) and Tiger (10.4). How do you get it to run on multiple versions of Mac OS X? Change the deployment target.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What’s the Deployment Target?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The deployment target is the earliest version of Mac OS X that can run your program. When you create an Xcode project, it sets the deployment target to the version of Mac OS X you’re using, which will be 10.5 if you’re using Xcode 3. The initial deployment target is fine if you’re writing programs for personal use, but your program won’t run if you give it to someone running an older version of Mac OS X. If you want your application to run on Leopard and Tiger, you must set the deployment target to 10.4.&lt;/p&gt;&#xA;&lt;p&gt;In Xcode choose Project &amp;gt; Edit Project Settings to edit your project’s build settings. The Deployment Target build setting is in the Deployment build settings collection. If you set the deployment target to 10.4, your application will run on any Mac running Mac OS X 10.4 or higher. The previous sentence assumes your application is not using any technologies Apple introduced in Leopard, such as Core Animation.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What About the SDK?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;When you installed Xcode, you installed one or more Mac OS SDKs (software development kit). The default installation of Xcode 3 installs the 10.4 and 10.5 SDKs. An SDK contains everything you need to build an application for a particular version of Mac OS X. The SDK for a particular version of Mac OS X contains the latest technologies your application can use. If you use the 10.5 SDK, your application can use Leopard technologies like toolbars created in Interface Builder and the new HID Manager APIs.&lt;/p&gt;&#xA;&lt;p&gt;Xcode 3 projects initially use the 10.5 SDK. In most cases there is no need to change SDKs. The SDK has no effect on what versions of Mac OS X can run your program. You can use the 10.5 SDK and still support Tiger. Just set the deployment target to 10.4. By using the 10.5 SDK, your application can take advantage of any bug fixes Apple made in the 10.5 SDK. Normally the best course of action is to use the latest SDK while using the earliest deployment target you want to support.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;When to Use an Earlier SDK?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Last section I said there was rarely a need to change SDKs. When would you want to use an earlier SDK? I can think of two reasons why you might want to use an earlier SDK. The first reason is if you want to build a version of your application for a specific version of Mac OS X. Suppose you had two versions of your application: one for Leopard and one for Tiger. You might want to use the 10.5 SDK for the Leopard version and the 10.4 SDK for the Tiger version.&lt;/p&gt;&#xA;&lt;p&gt;The second reason is for testing purposes. Suppose you’re supporting Leopard and Tiger and you want to make sure you didn’t use any Leopard-specific function calls. You would temporarily use the 10.4 SDK so you could discover any compatibility errors when you build the project . Once your code compiled without any problems with the 10.4 SDK, you could switch to the 10.5 SDK. The Base SDK build setting lets you temporarily change the SDK. You could use the 10.4 SDK for the Debug build configuration and the 10.5 SDK for the Release build configuration.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;To support earlier versions of Mac OS X, change the deployment target, not the SDK.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>OpenGL Book Status Update</title>
      <link>https://www.meandmark.com/opengl-book-status-update/</link>
      <pubDate>Tue, 04 Nov 2008 20:18:28 +0000</pubDate>
      <guid>https://www.meandmark.com/opengl-book-status-update/</guid>
      <description>&lt;p&gt;I’ve received several emails from people inquiring about the status of my OpenGL 2D programming book. What is the book’s status? The OpenGL book is currently on hold while I finish up the Xcode book. When the Xcode book is finished, I’ll return to the OpenGL book.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Two Setbacks</title>
      <link>https://www.meandmark.com/two-setbacks/</link>
      <pubDate>Tue, 23 Sep 2008 18:01:44 +0000</pubDate>
      <guid>https://www.meandmark.com/two-setbacks/</guid>
      <description>&lt;p&gt;People have been emailing me about how things are going on the new edition of Xcode Tools Sensei for Xcode 3. I’m still working on the book, but there have been two setbacks that have slowed me down.&lt;/p&gt;&#xA;&lt;p&gt;The first setback is health-related. For the past six weeks I’ve been battling an injury to my lower back. Because of the injury, my back stiffens up and causes a lot of pain when I sit for more than 10-15 minutes. This makes writing difficult because writing, like programming, requires blocks of uninterrupted time to be done at its best. I’m not able to finish as much as I could if I were able to sit down for 3-4 hours and crank out some material.&lt;/p&gt;&#xA;&lt;p&gt;The second setback is Apple’s continuation of the non-disclosure agreement (NDA) on the iPhone SDK. I’m surprised the SDK is still under NDA after the opening of the iPhone App Store, but the NDA still stands, and it’s causing me two problems. First, I can’t ask any questions about the SDK, which makes writing the iPhone material take longer than it normally would. I can live with that, but I can’t live with the second problem. I can’t release the book until the NDA is lifted. Even if I had the book finished today, you couldn’t read it. I have no idea when Apple will lift the NDA.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Avoiding Xcode</title>
      <link>https://www.meandmark.com/avoiding-xcode/</link>
      <pubDate>Tue, 16 Sep 2008 19:46:23 +0000</pubDate>
      <guid>https://www.meandmark.com/avoiding-xcode/</guid>
      <description>&lt;p&gt;Xcode provides a front end for command-line tools like the GCC compiler and the GDB debugger. What this means is you can avoid Xcode and use the command-line tools if you want. There are several situations where you might want to bypass Xcode. If you’re learning C or C++, you’ll start out by writing small programs that contain one source code file. Invoking GCC directly would be easier for you than creating an Xcode project, especially if you’re familiar with the Unix command line. People writing cross-platform applications might want to run build scripts so their application builds the same way on multiple operating systems. Or you just might hate Xcode.&lt;/p&gt;&#xA;&lt;p&gt;This post shows you how you can program on Mac OS X and avoid Xcode. By avoiding Xcode, I mean not having to use it. You still have to install Xcode. I’m sure it’s possible to install gcc without installing Xcode, but you’ll save yourself time and aggravation by just installing Xcode and not using it.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Writing and Compiling Your Code&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Write your source code in the text editor of your choice. There are many text editors available for Mac OS X. TextWrangler and Smultron are free. TextMate, BBEdit, and ForgEdit aren’t free. If you search the Internet, I’m sure you’ll find more editors.&lt;/p&gt;&#xA;&lt;p&gt;When you’ve finished writing your code, it’s time to compile it into a running program. Launch the Terminal application and navigate to the directory where your source code files are. Now you can compile your code. The simplest way to compile your code with GCC is to use the -o option. It takes the following form:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;gcc -o AppName FilesToCompile (C programs)&amp;lt;br /&amp;gt;g++ -o AppName FilesToCompile (C++ programs)&amp;lt;br /&amp;gt;&lt;/code&gt;&lt;br&gt;&#xA;If you wrote a Hello World program in C++ and saved your file as main.cpp, you would enter the following command to compile your program:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;g++ -o HelloWorld main.cpp&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;GCC will compile your code and create an executable file named HelloWorld. You can run the program by double-clicking the executable file in the Finder.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Makefiles&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Running GCC directly is fine when you’re writing small programs, but problems arise with larger programs. Imagine you’re writing a program that has 12 source files, links to four libraries, and uses six compiler flags. Having to type in the names of the source files, libraries, and compiler flags every time you want to compile your program would be tedious and error prone.&lt;/p&gt;&#xA;&lt;p&gt;The solution is to use a makefile, which is a text file. Instead of running GCC directly, you put everything you need to compile your program in the makefile: source file names, compiler flags, paths to libraries, and paths to headers. Run the make command to compile your program using the makefile.&lt;/p&gt;&#xA;&lt;p&gt;I’m not an expert on makefiles so I’m not going to show you how to create a makefile, but there are many tutorials on the Internet. Do a Google search for makefiles and you’ll find the tutorials.&lt;/p&gt;&#xA;&lt;p&gt;If you don’t want to use makefiles, there are several cross-platform, open source build systems available. Three of the more popular systems are &lt;a href=&#34;http://www.scons.org&#34; rel=&#34;self&#34;&gt;SCons&lt;/a&gt;, &lt;a href=&#34;http://www.cmake.org&#34; rel=&#34;self&#34;&gt;CMake&lt;/a&gt;, and &lt;a href=&#34;http://www.gnu.org/software/autoconf&#34; rel=&#34;self&#34;&gt;autoconf&lt;/a&gt;. Those of you writing larger programs should look into these build systems if you don’t want to use Xcode.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Every Xcode Program Needs a Project</title>
      <link>https://www.meandmark.com/every-xcode-program-needs-a-project/</link>
      <pubDate>Tue, 26 Aug 2008 02:44:33 +0000</pubDate>
      <guid>https://www.meandmark.com/every-xcode-program-needs-a-project/</guid>
      <description>&lt;p&gt;I’m not sure why, but an old blog post about &lt;a href=&#34;http://meandmarkpublishing.blogspot.com/2007/01/writing-c-programs-on-mac-os-x.html&#34; rel=&#34;self&#34;&gt;writing C++ programs on Mac OS X&lt;/a&gt; has been generating a lot of activity recently. In the comments about the blog post, I got a question that is fairly common among people who are new to Xcode. They start Xcode, create a file and write some code. They want to compile the code and run the program they wrote, and either they don’t know how to compile it or they find that all the menu items in the Build menu are disabled. If you find yourself in a similar situation, a question comes to mind.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Why Can’t I Compile My Code?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;The reason you can’t compile the code is that Xcode deals with projects. You can’t just create a source code file in Xcode and compile it into a working program. If you want to use Xcode to write a program, you must create a project.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;But My Program Is Only a Few LInes of Code!&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;It doesn’t matter how many lines of code are in the program. Every program written with Xcode requires a project, no matter how small the program is.&lt;/p&gt;&#xA;&lt;p&gt;This is very important so I will repeat it. Every program written with Xcode requires a project.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;How Do I Create an Xcode Project?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Choose File &amp;gt; New Project. A window containing a list of project templates will open. Select one of the templates and click the Next button (or the Choose button in Xcode 3.1). You will be asked to name the project and to choose where to save it on your hard disk.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;What Project Template Should I Select?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;When you create a new project, you will notice there are a lot of project templates. The following templates are the ones Xcode beginners are most likely to select:&lt;/p&gt;&#xA;&lt;ul class=&#34;disc&#34;&gt;&#xA;  &lt;li&gt;&#xA;    People learning C++ normally select the C++ Tool project template.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    People learning C normally select the Standard Tool project template.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    People learning Objective C normally select the Foundation Tool project template.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    People learning Java normally select the Java Tool project template.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    People learning Mac GUI programming normally select the Cocoa Application project template.&#xA;  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The C++ Tool, Standard Tool, and Foundation Tool project templates are in the Command LIne Utility section. The Java Tool project template is in the Java section. The Cocoa Application project template is in the Application section.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;How Do I Compile My Program?&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;You compile your program in Xcode by building the project. You build your project by using the Build menu or the shortcut buttons in the project window toolbar. There are three options.&lt;/p&gt;&#xA;&lt;ul class=&#34;disc&#34;&gt;&#xA;  &lt;li&gt;&#xA;    Build, which compiles your code into a working program.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Build and Run, which compiles your code and runs the program in Xcode.&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Build and Debug, which compiles your code and runs the program in Xcode&amp;rsquo;s debugger.&#xA;  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you wrote a command-line program and you’re using Xcode 3, you must open Xcode’s debugger console to see the output of the program. Choose Run &amp;gt; Console to open the console.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 3.1: Setting the Compiler Version</title>
      <link>https://www.meandmark.com/xcode-3-1-setting-the-compiler-version/</link>
      <pubDate>Mon, 04 Aug 2008 17:20:35 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-1-setting-the-compiler-version/</guid>
      <description>&lt;p&gt;Xcode 3.1 adds the Compiler Version build settings collection, which provides a GUI to set the compiler version for C, C++, and Objective C programs. Prior to the release of Xcode 3.1, there wasn’t a big need to set the compiler version. GCC 4.0, Xcode’s default compiler for Xcode 2 and 3, was the right choice for most people. You had to use GCC 4 to compile for Intel Macs. Unless you were writing an appliction in C++ and wanted to support versions of Mac OS X older than 10.3.9, there wasn’t much of a reason not to use GCC 4.0.&lt;/p&gt;&#xA;&lt;p&gt;But with the release of Xcode 3.1 comes two new compiler choices: GCC 4.2 and &lt;a href=&#34;http://llvm.org&#34; rel=&#34;self&#34;&gt;LLVM&lt;/a&gt; (Low Level Virtual Machine)-GCC 4.2. Programs compiled with GCC 4.2 and LLVM-GCC 4.2 will not run on anything older than Mac OS X 10.5. If you want to support Mac OS X 10.4, you’ll still have to use GCC 4.0.&lt;/p&gt;&#xA;&lt;p&gt;Of the two new compiler choices, LLVM-GCC 4.2 is the more intriguing choice. LLVM-GCC 4.2 uses GCC as the front end parser, which does the syntax checking. It uses LLVM for the back end to do optimization and create object code. Code compiled with LLVM-GCC should run faster than code compiled with GCC. Apple is providing a lot of support for the LLVM project so don’t be surprised if LLVM becomes a big part of Mac development in the future. You can learn more about LLVM-GCC by reading the &lt;a href=&#34;http://developer.apple.com/releasenotes/DeveloperTools/RN-llvm-gcc/index.html&#34; rel=&#34;self&#34;&gt;release notes&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 3.1 Addition: Adding Libraries to Target</title>
      <link>https://www.meandmark.com/xcode-3-1-addition-adding-libraries-to-target/</link>
      <pubDate>Thu, 31 Jul 2008 19:16:35 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-1-addition-adding-libraries-to-target/</guid>
      <description>&lt;p&gt;Xcode 3.1 added a feature that simplifies adding dynamic libraries to an Xcode project. When you open a target’s information panel and click the General tab, the information panel shows the frameworks and libraries that will be linked to the target when you build it.&lt;/p&gt;&#xA;&lt;p&gt;To add a library or framework to the target, click the + button. A sheet opens with a list of all the frameworks, dynamic libraries, and object files for the active SDK you’re using. Select the libraries and frameworks you want to add, and click the Add button.&lt;/p&gt;&#xA;&lt;p&gt;If you want to add a third party library or framework that’s not part of the SDK you’re using, click the Add Other. An Open File dialog box will open, which you will use to navigate to the location where the library or framework resides.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Installing Xcode in Non-Default Location</title>
      <link>https://www.meandmark.com/installing-xcode-in-non-default-location/</link>
      <pubDate>Sat, 12 Jul 2008 02:32:06 +0000</pubDate>
      <guid>https://www.meandmark.com/installing-xcode-in-non-default-location/</guid>
      <description>&lt;p&gt;When you install Xcode the default install location is the Developer folder on your startup disk.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;/Developer&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Xcode 3.x gives you the option of installing Xcode wherever you want. This feature comes in handy if you want to have two versions of Xcode installed on your Mac. To install Xcode in a different location, choose a custom install. You will see a column titled Location with a pop-up button cell with the value Developer. Click the button and choose Other. You will be prompted for a location to install Xcode.&lt;/p&gt;&#xA;&lt;p&gt;If you choose to install Xcode in a location other than /Developer, make sure the path to your install location contains no spaces. If there are spaces in the path, you can get hangs and crashes in the Xcode Tools. I made the mistake of installing Xcode 3.1 into a folder titled &lt;strong&gt;Xcode 3.1&lt;/strong&gt;. Interface Builder 3.1 would hang and give me the spinning beach ball with certain nib files. I couldn’t figure out what was causing the hang until I read on Apple’s Xcode mailing list about Interface Builder crashing when there were spaces in the installation path. I changed my folder name from &lt;strong&gt;Xcode 3.1&lt;/strong&gt; to &lt;strong&gt;Xcode3-1&lt;/strong&gt;, and the Interface Builder hangs went away.&lt;/p&gt;&#xA;&lt;p&gt;Hopefully this post will save someone the pain and aggravation I went through.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode Book Status Report</title>
      <link>https://www.meandmark.com/xcode-book-status-report/</link>
      <pubDate>Wed, 11 Jun 2008 21:23:33 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-book-status-report/</guid>
      <description>&lt;p&gt;It’s WWDC time, and many of you are wondering how things are progressing on the new edition of Xcode Tools Sensei. I’ve made a lot of progress on the Xcode material. I’ve decided to break up the huge Xcode chapter (Chapter 1 in the current version of the book) into smaller chapters. I currently have the Xcode material divided into the following chapters:&lt;/p&gt;&#xA;&lt;ul class=&#34;square&#34;&gt;&#xA;  &lt;li&gt;&#xA;    Projects&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Source Code Editing&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Modeling Tools&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Building Projects&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Debugging&#xA;  &lt;/li&gt;&#xA;  &lt;li&gt;&#xA;    Version Control&#xA;  &lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The chapters with the most remaining work are the Interface Builder and Instruments chapters. I was vaugely dissatisfied with the original Interface Builder chapter. I am looking at ways to improve the material for Interface Builder 3.&lt;/p&gt;&#xA;&lt;p&gt;The Instruments chapter has been the biggest problem for me. Instruments is huge. I could write an entire book just on Instruments. Plus in Xcode 3, ObjectAlloc and Sampler are Instruments trace templates instead of separate applications so I have to merge material from the ObjectAlloc and Sampler chapters into an Instruments chapter. It’s a tough chapter to organize.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Blog Moved</title>
      <link>https://www.meandmark.com/blog-moved/</link>
      <pubDate>Mon, 02 Jun 2008 23:45:00 +0000</pubDate>
      <guid>https://www.meandmark.com/blog-moved/</guid>
      <description>&lt;p&gt;I moved the blog. Here’s the &lt;a href=&#34;http://www.meandmark.com/blog&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;new blog location&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>New Blog Home</title>
      <link>https://www.meandmark.com/new-blog-home/</link>
      <pubDate>Mon, 02 Jun 2008 21:08:06 +0000</pubDate>
      <guid>https://www.meandmark.com/new-blog-home/</guid>
      <description>&lt;p&gt;I’m sure you’ve noticed the blog now looks like the rest of the website. That’s because I’ve moved the blog from Blogger to my domain. Besides the new look, the switch will let me have blog categories so you can read only the posts that are interesting to you. The categories are currently irrelevant as I’m just starting with the new location, but the categories will eventually be useful.&lt;/p&gt;&#xA;&lt;p&gt;I would like to eventually move the more interesting posts from the old blog to the new one, but for now, I’ve placed a link to the old blog on the site map. The link to the old blog appears only on the blog page. I didn’t want to litter the whole site with links to an old blog.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 3 Book in the Works</title>
      <link>https://www.meandmark.com/xcode-3-book-in-the-works/</link>
      <pubDate>Sat, 26 Apr 2008 18:05:00 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-book-in-the-works/</guid>
      <description>&lt;p&gt;You may have noticed I have not updated my site or this blog much recently. I’ve hinted at the reason in the past, but a bunch of people emailed me with questions about it so I figured I should write about it here. I am working on a new edition of Xcode Tools Sensei, specifically written for Xcode 3. Two questions come to mind.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight:bold;&#34;&gt;What’s Going to be in the New Edition?&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;There will be a lot of new material in the new edition, and I don’t want to drone on and on about the new material. Some of the highlights include the following:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Xcode 3’s new features, including refactoring tools, code folding, and the Research Assistant.&lt;/li&gt;&#xA;&lt;li&gt;Interface Builder 3.&lt;/li&gt;&#xA;&lt;li&gt;A new chapter on Instruments.&lt;/li&gt;&#xA;&lt;li&gt;The version control chapter will use Subversion instead of CVS.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight:bold;&#34;&gt;When Will the New Edition be Released?&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I don’t know the exact date, but I hope to have it finished this summer (winter for those of you in the Southern Hemisphere). I do know it will not be released before Apple’s Worldwide Developer Conference (WWDC), which runs from June 9 to June 13. Apple is expected to release Xcode 3.1 and the iPhone SDK at WWDC. Because WWDC is less than two months away, it would be a waste of time to rush to release an Xcode 3 book, then put out a big update covering Xcode 3.1 and iPhone development. Doing so would also be a disservice to people buying the print version of the book.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>SDL File Loading When Running from Visual C&#43;&#43;’s Debugger</title>
      <link>https://www.meandmark.com/sdl-file-loading-when-running-from-visual-cs-debugger/</link>
      <pubDate>Thu, 07 Feb 2008 06:55:00 +0000</pubDate>
      <guid>https://www.meandmark.com/sdl-file-loading-when-running-from-visual-cs-debugger/</guid>
      <description>&lt;p&gt;I was testing some texture loading code on Visual C++ 2005 and 2008. The code compiled fine, but when I ran it from Visual C++’s debugger, it crashed every time. The code crashed because the program could not find my image file so it could not read the file and load the image. But the code ran file when I ran it from Windows Explorer. Why could my image file be found when I ran my program from Windows Explorer, but not from Visual C++’s debugger?&lt;/p&gt;&#xA;&lt;p&gt;The reason was that Visual C++’s debugger uses a different working directory. Windows normally sets the working directory to the same directory as the executable file, which is where I had my image file. But Visual C++’s debugger sets the working directory to the directory containing the project file. Where is the project file? When you create a Visual C++ project, Visual C++ creates a folder that has the same name as the project name. Inside this folder is a second folder that has the same name as the project name. The project file resides in the second folder. The second folder is where the image file needed to be to debug my program. Moving my image file to the second folder fixed the crashing problem inside the Visual C++ debugger.&lt;/p&gt;&#xA;&lt;p&gt;If you’re using Visual C++ to write a game and you want to run the game inside the debugger, make sure your game’s files are in the same directory as the project file.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>XcodeTemplateFactory</title>
      <link>https://www.meandmark.com/xcodetemplatefactory/</link>
      <pubDate>Mon, 04 Feb 2008 20:30:00 +0000</pubDate>
      <guid>https://www.meandmark.com/xcodetemplatefactory/</guid>
      <description>&lt;p&gt;Hog Bay Software recently released &lt;a href=&#34;http://hogbaysoftware.com/products/xcodetemplatefactory&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;XcodeTemplateFactory&lt;/a&gt;, a utility that converts an Xcode project to a project template. I tried XcodeTemplateFactory, and it is an easy way to create Xcode project templates.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight:bold;&#34;&gt;Building XcodeTemplateFactory&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;When you download XcodeTemplateFactory, you get an Xcode project file called XcodeTemplateFactory. Open the project in Xcode and build it to create the XcodeTemplateFactory app.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight:bold;&#34;&gt;Creating a Project Template with XcodeTemplateFactory&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;To convert a project to a project template, run the XcodeTemplateFactory app that you built. Click the Choose button to open an Open File dialog box. Navigate to the folder containing your project and click the Open button. Enter a description of your project in the Project Description field. Make the description a good one. When you create a new Xcode project and select your template from the template list, your description is going to appear underneath the template list. Click the Generate Template button, and you’ve created an Xcode project template.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 3 Template Location Clarification</title>
      <link>https://www.meandmark.com/xcode-3-template-location-clarification/</link>
      <pubDate>Wed, 23 Jan 2008 05:00:00 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-template-location-clarification/</guid>
      <description>&lt;p&gt;In a previous post on &lt;a href=&#34;http://meandmarkpublishing.blogspot.com/2008/01/xcode-3-change-new-template-locations.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; 3’s new locations for project and file templates&lt;/a&gt;, I said project and file templates needed to be in the following locations:&lt;/p&gt;&#xA;&lt;pre&gt;Developer/Library/Xcode/Project Templates&#xA;Developer/Library/Xcode/File Templates&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;Those locations are for Apple’s templates. While it is technically possible to place your templates with Apple’s (I placed some of my &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;SDL&lt;/span&gt; and &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_4&#34;&gt;OpenGL&lt;/span&gt; project templates with Apple’s project templates and had no problems), the &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_5&#34;&gt;Xcode&lt;/span&gt; 3 release notes say you’re supposed to place your templates in a different location. Project templates belong in the following location:&lt;/p&gt;&#xA;&lt;pre&gt;Library/Application Support/Developer/Shared/Xcode/Project Templates&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;File templates belong in the following location:&lt;/p&gt;&#xA;&lt;pre&gt;Library/Application Support/Developer/Shared/Xcode/File Templates&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;You’re going to have manually create all the folders after Application Support in the path.&lt;/p&gt;&#xA;&lt;p&gt;If you use the paths I just mentioned, your project and file templates will be available for all users on your Mac and be available for use in both &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_8&#34;&gt;Xcode&lt;/span&gt; 3 and &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_9&#34;&gt;Xcode&lt;/span&gt; 2.5. If you want to restrict your templates to a specific version of &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_10&#34;&gt;Xcode&lt;/span&gt;, replace Shared with the &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_11&#34;&gt;Xcode&lt;/span&gt; version number. If you want only a single user to be able to use your templates, start the path with Username/Library.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 3 Addition: Python and Ruby Cocoa Project Templates</title>
      <link>https://www.meandmark.com/xcode-3-addition-python-and-ruby-cocoa-project-templates/</link>
      <pubDate>Fri, 18 Jan 2008 05:45:00 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-addition-python-and-ruby-cocoa-project-templates/</guid>
      <description>&lt;p&gt;Xcode 3 includes project templates for writing Cocoa applications in Python and Ruby. Those of you who were turned off of Cocoa by Objective C’s syntax can now give Cocoa development a try.&lt;/p&gt;&#xA;&lt;p&gt;If you installed the developer examples when you installed Xcode 3, you will find on your hard drive many examples of Cocoa programs written in Python and Ruby. You can find the Python examples at the following location:&lt;/p&gt;&#xA;&lt;pre&gt;Developer/Examples/Python/PyObjC&#xA;&lt;/pre&gt;&#xA;&lt;p&gt;You can find the Ruby examples at the following location:&lt;/p&gt;&#xA;&lt;pre&gt;Developer/Examples/Ruby/RubyCocoa&#xA;&lt;/pre&gt;</description>
    </item>
    <item>
      <title>Interface Builder 3 Change: No Subclass Creation</title>
      <link>https://www.meandmark.com/interface-builder-3-change-no-subclass-creation/</link>
      <pubDate>Wed, 16 Jan 2008 20:25:00 +0000</pubDate>
      <guid>https://www.meandmark.com/interface-builder-3-change-no-subclass-creation/</guid>
      <description>&lt;p&gt;Older versions of Interface Builder let you create subclasses for Cocoa applications and generate source code files for the subclasses you created. As an example, you could drag an OpenGL view to a window, subclass the OpenGL view, and have Interface Builder create .h and .m files for the subclass. But Interface Builder 3 no longer lets you create subclasses. How do you create the subclasses?&lt;/p&gt;&#xA;&lt;p&gt;You create the subclasses the old-fashioned way: with source code. Create your subclasses in Xcode. Interface Builder and Xcode are synchronized so the subclasses you create in Xcode appear in Interface Builder as well.&lt;/p&gt;&#xA;&lt;p&gt;Choose File &amp;gt; New File to create a new file. A window will open containing many file types for you to choose from. For a Cocoa program you would want one of the Cocoa files unless you’re writing a Cocoa program in Ruby, in which case you would use one of the Ruby files. Name your file and click the Finish button. You’ve created a subclass file.&lt;/p&gt;&#xA;&lt;h3 id=&#34;instantiating-your-class&#34; class=&#34;relative group&#34;&gt;Instantiating Your Class &lt;span class=&#34;absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100&#34;&gt;&lt;a class=&#34;group-hover:text-primary-300 dark:group-hover:text-neutral-700&#34; style=&#34;text-decoration-line: none !important;&#34; href=&#34;#instantiating-your-class&#34; aria-label=&#34;Anchor&#34;&gt;#&lt;/a&gt;&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;After creating your class in Xcode, you may need to add an instance of your class to the nib file so you can make connections in Interface Builder. If Interface Builder’s library window is not open, open it by choosing Tools &amp;gt; Library. The library window contains Interface Builder’s user interface elements.&lt;br&gt;&#xA;&lt;a onblur=&#34;try {parent.deselectBloggerImageGracefully();} catch(e) {}&#34; href=&#34;http://2.bp.blogspot.com/_43mxm9V6l5Q/R42eoSkNUFI/AAAAAAAAABU/cEW33LthoG4/s1600-h/LibraryWindow.jpg&#34;&gt;&lt;img decoding=&#34;async&#34; style=&#34;cursor:pointer; cursor:hand;&#34; src=&#34;http://2.bp.blogspot.com/_43mxm9V6l5Q/R42eoSkNUFI/AAAAAAAAABU/cEW33LthoG4/s320/LibraryWindow.jpg&#34; border=&#34;0&#34; alt=&#34;&#34; id=&#34;BLOGGER_PHOTO_ID_5155951563424747602&#34; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Select an NSObject from the library window. NSObject is a blue cube. Drag NSObject to the nib file window. An NSObject named Object should now appear in the nib file window. Choose Tools &amp;gt;Identity Inspector to open the identity inspector. Select the NSObject in the nib file window.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a onblur=&#34;try {parent.deselectBloggerImageGracefully();} catch(e) {}&#34; href=&#34;http://3.bp.blogspot.com/_43mxm9V6l5Q/R42exikNUGI/AAAAAAAAABc/G4jBQekyDmM/s1600-h/IdentityInspector.jpg&#34;&gt;&lt;img decoding=&#34;async&#34; style=&#34;cursor:pointer; cursor:hand;&#34; src=&#34;http://3.bp.blogspot.com/_43mxm9V6l5Q/R42exikNUGI/AAAAAAAAABc/G4jBQekyDmM/s320/IdentityInspector.jpg&#34; border=&#34;0&#34; alt=&#34;&#34; id=&#34;BLOGGER_PHOTO_ID_5155951722338537570&#34; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The top of identity inspector should have a combo box labeled Class. Choose your class from the list of classes in the combo box. The name of the NSObject instance in the nib file window will change from Object to the name of your class. Any outlets and actions in your class should appear in the identity inspector.&lt;/p&gt;&#xA;&lt;p&gt;If your classes are not appearing in Interface Builder, choose File &amp;gt; Synchronize With &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; in Interface Builder.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 3 Change: Run Log</title>
      <link>https://www.meandmark.com/xcode-3-change-run-log/</link>
      <pubDate>Mon, 14 Jan 2008 19:20:00 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-change-run-log/</guid>
      <description>&lt;p&gt;Older versions of Xcode had a run log window that let you view the output of command-line programs. Where did it go in Xcode 3?&lt;/p&gt;&#xA;&lt;div&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;  In Xcode 3 the run log&amp;#8217;s name has changed to Console and has become part of the debugger window. The console is initially invisible, which makes locating it difficult. There are two ways to reveal the console. First, you can choose Run &gt; Console to show the console, and you will see the console at the bottom of the debugger window. Second, you can drag the splitter bar at the bottom of the debugger window to reveal the console.&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;  &lt;span class=&#34;Apple-style-span&#34; style=&#34;font-weight: bold;&#34;&gt;Update (January 16, 2008)&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;  Xcode&amp;#8217;s debugger window has a splitter bar for the console only if you&amp;#8217;re using Xcode&amp;#8217;s All-In-One layout. If you&amp;#8217;re using the Default or Condensed layouts, the console is a separate window. Clicking the Console button on the debugger window toolbar opens the console for the Default and Condensed layouts. &#xA;&lt;/div&gt;</description>
    </item>
    <item>
      <title>Xcode 3 Change: Universal Binaries</title>
      <link>https://www.meandmark.com/xcode-3-change-universal-binaries/</link>
      <pubDate>Fri, 11 Jan 2008 18:40:00 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-change-universal-binaries/</guid>
      <description>&lt;p&gt;The Release build configuration for &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; 3 is set to create 32-bit universal binaries for Cocoa and Carbon application projects. All you have to do is create a Cocoa or Carbon application project, and you’re set to build a universal binary. You’ll have to modify the Architectures build setting if you want to build a 64-bit version of your application.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 3 Change: Release is the Default Build Configuration</title>
      <link>https://www.meandmark.com/xcode-3-change-release-is-the-default-build-configuration/</link>
      <pubDate>Thu, 10 Jan 2008 20:20:00 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-change-release-is-the-default-build-configuration/</guid>
      <description>&lt;p&gt;In &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; 3 Apple changed the default build configuration from Debug to Release. This decision does not make much sense. Unless you’re writing a simple program, you’re going to want to debug your program when you start writing it. Wanting to debug your program means that you want the Debug build configuration, not the Release configuration.&lt;/p&gt;&#xA;&lt;div&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;  When you create a project with &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;Xcode&lt;/span&gt; 3, the first thing you will want to do is change the active build configuration from Release to Debug.&#xA;&lt;/div&gt;</description>
    </item>
    <item>
      <title>Xcode 3 Feature: Version Control Repository Access</title>
      <link>https://www.meandmark.com/xcode-3-feature-version-control-repository-access/</link>
      <pubDate>Tue, 08 Jan 2008 21:10:00 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-feature-version-control-repository-access/</guid>
      <description>&lt;p&gt;Xcode 3 adds support for configuring and viewing version control repositories. With Xcode 3 you can import projects and checkout files inside Xcode. All you have to do from the command line is create the repository. This article will show you how to take advantage of Xcode 3’s enhanced version control capabilities. One word of caution. If you hated Xcode’s version control support in earlier versions of Xcode, you’ll want to stick with the command line. Xcode 3 repository features are a little flaky.&lt;/p&gt;&#xA;&lt;p&gt;Xcode supports Subversion, Perforce, and CVS. I’m going to focus on Subversion because Mac OS X 10.5 ships with Subversion, and CVS seems to be losing popularity with developers.&lt;/p&gt;&#xA;&lt;div&gt;&#xA;  &lt;span style=&#34;font-weight: bold;&#34;&gt;Step 1: Create the Repository&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;If you haven’t done so already, open the Terminal application and create a repository by running the svnadmin create command. I have &lt;a href=&#34;http://www.meandmark.com/subversion.pdf&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;detailed instructions you can read&lt;/a&gt; (PDF) on creating a repository if you need them. One thing to note is that because Mac OS X 10.5 ships with Subversion, you don’t have to install it, and in Mac OS X 10.5 Subversion is in /usr/bin instead of /usr/local/bin.&lt;/p&gt;&#xA;&lt;div&gt;&#xA;  &lt;span style=&#34;font-weight: bold;&#34;&gt;Step 2: Configure Your Repository&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;Before you can take advantage of Xcode’s repository features, you must configure your repository in Xcode. Launch Xcode and choose SCM &amp;gt; Configure SCM Repositories. A window similar to the following figure will open:&lt;/p&gt;&#xA;&lt;div&gt;&#xA;  &lt;a href=&#34;http://3.bp.blogspot.com/_43mxm9V6l5Q/R4Pl3CkNUDI/AAAAAAAAABE/nagp2rfxjcA/s1600-h/RepositoryConfig.png&#34; onblur=&#34;try {parent.deselectBloggerImageGracefully();} catch(e) {}&#34;&gt;&lt;img decoding=&#34;async&#34; id=&#34;BLOGGER_PHOTO_ID_5153215132386283570&#34; style=&#34;cursor:pointer; cursor:hand;&#34; src=&#34;http://3.bp.blogspot.com/_43mxm9V6l5Q/R4Pl3CkNUDI/AAAAAAAAABE/nagp2rfxjcA/s320/RepositoryConfig.png&#34; border=&#34;0&#34; alt=&#34;&#34; /&gt;&lt;/a&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;Click the + button to add a repository. You will be asked to name the repository and specify what version control system you’re using.&lt;/p&gt;&#xA;&lt;p&gt;Now you must specify the URL for the repostiory. A local repository’s URL starts with file:// and follows with the path to the repository on your hard drive. If the path you specify does not show up in the Path field, you’ll have to enter the path to your repository in the Path field.&lt;/p&gt;&#xA;&lt;div&gt;&#xA;  I have not tried configuring a remote repository, but Xcode&amp;#8217;s repository configuration window has Host, Port, User, and Password fields. I assume you would fill these fields to configure a remote repository. If you&amp;#8217;re going to connect to a remote repository using SSH, click the SSH tab in the window.&#xA;&lt;/div&gt;&#xA;&lt;p&gt;Click the OK button, and you’ve configured the repository.&lt;/p&gt;&#xA;&lt;div&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;  &lt;span style=&#34;font-weight: bold;&#34;&gt;Step 3: Open the Repositories Window&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;Choose SCM &amp;gt; Repositories to open &lt;span id=&#34;SPELLING_ERROR_0&#34; class=&#34;blsp-spelling-error&#34;&gt;Xcode’s&lt;/span&gt; repositories window, which you can see in the figure below. The repositories window lets you examine the directories inside your version control repositories. Select a repository from the list on the left to examine that repository’s directories. Some things you can do from the repositories window is import projects, check files out of the repository, create directories, move directories, and delete directories.&lt;/p&gt;&#xA;&lt;div&gt;&#xA;  &lt;a href=&#34;http://3.bp.blogspot.com/_43mxm9V6l5Q/R4Pl-CkNUEI/AAAAAAAAABM/_iuqBS5v3g4/s1600-h/RepositoriesWindow.png&#34; onblur=&#34;try {parent.deselectBloggerImageGracefully();} catch(e) {}&#34;&gt;&lt;img decoding=&#34;async&#34; id=&#34;BLOGGER_PHOTO_ID_5153215252645367874&#34; style=&#34;cursor:pointer; cursor:hand;&#34; src=&#34;http://3.bp.blogspot.com/_43mxm9V6l5Q/R4Pl-CkNUEI/AAAAAAAAABM/_iuqBS5v3g4/s320/RepositoriesWindow.png&#34; border=&#34;0&#34; alt=&#34;&#34; /&gt;&lt;/a&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;If you’ve created a fresh repository, I strongly recommend creating a directory inside the repository and storing your projects inside that directory. In my experience using &lt;span id=&#34;SPELLING_ERROR_1&#34; class=&#34;blsp-spelling-error&#34;&gt;Xcode’s&lt;/span&gt; repository features on a fresh repository, I noticed &lt;span id=&#34;SPELLING_ERROR_2&#34; class=&#34;blsp-spelling-error&#34;&gt;Xcode&lt;/span&gt; let me add only one directory to the root of the repository. Any additional directories I tried to create were created inside the first directory I created. This is why I recommend creating a directory, naming it something like Projects, and import your individual &lt;span id=&#34;SPELLING_ERROR_3&#34; class=&#34;blsp-spelling-error&#34;&gt;Xcode&lt;/span&gt; projects into the Projects directory.&lt;/p&gt;&#xA;&lt;p&gt;If you have a repository that you’ve been using for some time, you’ll see directories inside the repository root for the projects you have in your repository. If you try to add or import a directory to the repository root, the directory will get added to one of the &lt;span id=&#34;SPELLING_ERROR_4&#34; class=&#34;blsp-spelling-error&#34;&gt;subdirectories&lt;/span&gt; inside the root. There are two solutions.&lt;/p&gt;&#xA;&lt;p&gt;First, you can fire up Terminal and create a directory from the command line using the &lt;span id=&#34;SPELLING_ERROR_5&#34; class=&#34;blsp-spelling-error&#34;&gt;svn&lt;/span&gt; &lt;span id=&#34;SPELLING_ERROR_6&#34; class=&#34;blsp-spelling-error&#34;&gt;mkdir&lt;/span&gt; command. I had difficulty getting my created directory to appear in the repositories window, but after a few attempts I did get the directory to appear. Second, you can create a fresh repository for your new projects, add a Projects directory to the new repository, and use the new repository for any new projects you want to place under version control.&lt;/p&gt;&#xA;&lt;div&gt;&#xA;  &lt;span style=&#34;font-weight: bold;&#34;&gt;Step 4: Import the Project&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;Before importing a project, you must create an &lt;span id=&#34;SPELLING_ERROR_7&#34; class=&#34;blsp-spelling-error&#34;&gt;Xcode&lt;/span&gt; project and move the project’s files to a folder. If you follow Subversion conventions, you’ll go to your project folder in the Finder and add three folders named branches, tags, and trunk. Move your project files to the trunk folder.&lt;/p&gt;&#xA;&lt;p&gt;To import a project, select the directory in the repositories window where you want to import the project (If you’re following along, this will be the Projects directory you created in &lt;span id=&#34;SPELLING_ERROR_8&#34; class=&#34;blsp-spelling-error&#34;&gt;Xcode’s&lt;/span&gt; repositories window) and click the Import button. An Open File dialog opens. Navigate to your project folder, type a comment, and click the Import button.&lt;/p&gt;&#xA;&lt;p&gt;There should be a directory inside the Projects directory with the name of your project. Inside the project name directory should be the branches, tags, and trunk folders. The trunk folder should contain your project’s files. If these folders don’t show up, click the Reload button to refresh the repositories window.&lt;/p&gt;&#xA;&lt;div&gt;&#xA;  &lt;span style=&#34;font-weight: bold;&#34;&gt;Step 5: Check Out Files&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;After importing a project, you want to check out the source code files in your project. Select your trunk folder in the repositories window and click the Checkout button. A dialog box opens asking you where you want to store the checked out files on your hard drive. Navigate to where you want to store the checked out files. Normally you will store the checked out files in a folder inside your &lt;span id=&#34;SPELLING_ERROR_9&#34; class=&#34;blsp-spelling-error&#34;&gt;Xcode&lt;/span&gt; project’s folder. Click the Checkout button. You’ll be asked if you want to open the &lt;span id=&#34;SPELLING_ERROR_10&#34; class=&#34;blsp-spelling-error&#34;&gt;Xcode&lt;/span&gt; project. Open it if you want.&lt;/p&gt;&#xA;&lt;div&gt;&#xA;  &lt;span style=&#34;font-weight: bold;&#34;&gt;Step 6: Turn on Version Control&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;p&gt;Although you’ve imported a project and checked out files, you still have to tell &lt;span id=&#34;SPELLING_ERROR_11&#34; class=&#34;blsp-spelling-error&#34;&gt;Xcode&lt;/span&gt; to use version control for the project you imported. Open the &lt;span id=&#34;SPELLING_ERROR_12&#34; class=&#34;blsp-spelling-error&#34;&gt;Xcode&lt;/span&gt; project (the project file you checked out in Step 5, not the original one you created in Xcode). Select the name of the project from the Groups and Files list and click the Info button on the project window toolbar. An information panel will open. Click the General button in the information panel. Choose your repository from the &lt;span id=&#34;SPELLING_ERROR_13&#34; class=&#34;blsp-spelling-error&#34;&gt;SCM&lt;/span&gt; Repository pop-up menu, and you’re ready to use version control with &lt;span id=&#34;SPELLING_ERROR_14&#34; class=&#34;blsp-spelling-error&#34;&gt;Xcode&lt;/span&gt; in Mac OS X 10.5.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Xcode 3 Change: New Template Locations</title>
      <link>https://www.meandmark.com/xcode-3-change-new-template-locations/</link>
      <pubDate>Fri, 04 Jan 2008 20:35:00 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-change-new-template-locations/</guid>
      <description>&lt;p&gt;If you create your own &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; project and file templates, you should know that Apple changed the location for templates in &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;Xcode&lt;/span&gt; 3. For your project templates to show up in &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;Xcode’s&lt;/span&gt; list when you create a new project, make sure your templates are in the following location:&lt;/p&gt;&#xA;&lt;div&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;  &lt;span class=&#34;Apple-style-span&#34;  style=&#34;font-family:&#39;courier new&#39;;&#34;&gt;Developer/Library/&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;Xcode&lt;/span&gt;/Project Templates&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;  File templates need to be in the following location:&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;  &lt;span class=&#34;Apple-style-span&#34;  style=&#34;font-family:&#39;courier new&#39;;&#34;&gt;Developer/Library/&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_4&#34;&gt;Xcode&lt;/span&gt;/File Templates&lt;/span&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;&lt;/div&gt;</description>
    </item>
    <item>
      <title>Xcode 3 Change: No ZeroLink</title>
      <link>https://www.meandmark.com/xcode-3-change-no-zerolink/</link>
      <pubDate>Thu, 03 Jan 2008 21:20:00 +0000</pubDate>
      <guid>https://www.meandmark.com/xcode-3-change-no-zerolink/</guid>
      <description>&lt;p&gt;Apple removed &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;ZeroLink&lt;/span&gt; in &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;Xcode&lt;/span&gt; 3, which makes &lt;a href=&#34;http://meandmarkpublishing.blogspot.com/2007/01/zerolink.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;my &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;ZeroLink&lt;/span&gt; post&lt;/a&gt; obsolete for those of you using &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;Xcode&lt;/span&gt; 3. Apple says it improved the speed of the linker in &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_4&#34;&gt;Xcode&lt;/span&gt; 3 so &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_5&#34;&gt;ZeroLink&lt;/span&gt; is no longer needed. &lt;/p&gt;&#xA;&lt;div&gt;&#xA;&lt;/div&gt;&#xA;&lt;div&gt;&#xA;  For the vast majority of developers, getting rid of &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_6&#34;&gt;ZeroLink&lt;/span&gt; is a good thing. When you use &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_7&#34;&gt;Xcode&lt;/span&gt; 3 to build your project, you will know if you have any link errors. No more &lt;span class=&#34;Apple-style-span&#34; style=&#34;font-weight: bold;&#34;&gt;Build Succeeded&lt;/span&gt; messages followed by crashes and cryptic error messages when your application runs. Another bonus is that you will be able to run the debug versions of your programs outside of &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_8&#34;&gt;Xcode&lt;/span&gt; and run them on other people&amp;#8217;s Macs.&#xA;&lt;/div&gt;&#xA;</description>
    </item>
    <item>
      <title>Setting Up SDL with Visual C&#43;&#43; 2008 Express</title>
      <link>https://www.meandmark.com/setting-up-sdl-with-visual-c-2008-express/</link>
      <pubDate>Thu, 27 Dec 2007 18:15:00 +0000</pubDate>
      <guid>https://www.meandmark.com/setting-up-sdl-with-visual-c-2008-express/</guid>
      <description>&lt;p&gt;Microsoft recently released Visual Studio Express. I wanted to see if my &lt;a href=&#34;http://www.meandmark.com/sdlvisualc.pdf&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;SDL setup instructions for Visual C++ 2005 Express&lt;/a&gt; (PDF) worked with Visual C++ 2008 Express so I installed Visual C++ 2008 Express and went through my instructions. The good news is Microsoft did not make a lot of changes in Visual C++ 2008 Express so most of the instructions still apply. There are two differences.&lt;/p&gt;&#xA;&lt;div&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;    &lt;span style=&#34;font-weight: bold;&#34;&gt;Visual C++ 2008 Express Contains the Win32 SDK&lt;/span&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;p&gt;&#xA;    Unlike Visual C++ 2005 Express, Visual C++ 2008 Express ships with the Windows Platform SDK, also known as the Win32 SDK. Visual C++ 2008 Express&amp;#8217;s Win32 SDK support means you don&amp;#8217;t have to install the SDK separately, and you don&amp;#8217;t have to modify any files to get Win32 support.&#xA;  &lt;/p&gt;&#xA;  &lt;p&gt;&#xA;    If you&amp;#8217;re running Visual C++ 2008 Express, you can skip over the Installing the Windows Platform SDK, Updating the Visual C++ Properties File, and Updating the Application Wizard&amp;#8217;s Settings File sections in my instructions.&#xA;  &lt;/p&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;    &lt;span style=&#34;font-weight: bold;&#34;&gt;The Path to the Win32 SDK is Slightly Different&lt;/span&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;p&gt;&#xA;    In the section Telling Visual C++ Where to Find Your SDL Headers and Libraries, I said the path to the Win32 SDK was the following path:&#xA;  &lt;/p&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;    &lt;span style=&#34;font-family:&#39;courier new&#39;;&#34;&gt;C:\Program Files\Microsoft Platform SDK&lt;/span&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;p&gt;&#xA;    If you install Visual C++ 2008 Express, you&amp;#8217;ll find the Win32 SDK at the following path:&#xA;  &lt;/p&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;    &lt;span style=&#34;font-family:&#39;courier new&#39;;&#34;&gt;C:\Program Files\Microsoft SDKs\Windows\v6.0A&lt;/span&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;p&gt;&#xA;    The v6.0A is the Win32 SDK version. If you&amp;#8217;re reading this in the future, the version number may change.&#xA;  &lt;/p&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;div&gt;&#xA;  &lt;/div&gt;&#xA;&lt;/div&gt;&#xA;</description>
    </item>
    <item>
      <title>I’ve Installed Xcode 3</title>
      <link>https://www.meandmark.com/ive-installed-xcode-3/</link>
      <pubDate>Wed, 26 Dec 2007 23:20:00 +0000</pubDate>
      <guid>https://www.meandmark.com/ive-installed-xcode-3/</guid>
      <description>&lt;p&gt;I installed Mac OS X 10.5 and &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; 3 last night so I can now answer &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;Xcode&lt;/span&gt; 3 questions. As I spend more time with the new &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;Xcode&lt;/span&gt; Tools, I will take note of changes Apple made in &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;Xcode&lt;/span&gt; 3 and write about them here.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Changing SDL’s Working Directory on Mac OS X</title>
      <link>https://www.meandmark.com/changing-sdls-working-directory-on-mac-os-x/</link>
      <pubDate>Tue, 11 Dec 2007 20:45:00 +0000</pubDate>
      <guid>https://www.meandmark.com/changing-sdls-working-directory-on-mac-os-x/</guid>
      <description>&lt;p&gt;The Mac OS X version of &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;SDL&lt;/span&gt; sets the working directory to the directory containing the application bundle. This default behavior makes loading images and sounds more difficult because the images and sounds most likely reside in the application bundle’s Resources folder. What would be nice would be to set the working directory to the Resources folder. How do you do this?&lt;/p&gt;&#xA;&lt;p&gt;You change the working directory by modifying the method –&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;setupWorkingDirectory&lt;/span&gt;: in the file &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;SDLMain&lt;/span&gt;.m. You’ll want to change the code in &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;SDLMain&lt;/span&gt;.m in &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_4&#34;&gt;SDL’s&lt;/span&gt; &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_5&#34;&gt;Xcode&lt;/span&gt; templates so your changes take effect for any new &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_6&#34;&gt;SDL&lt;/span&gt; projects you create. Just to be safe, you should comment out the original code or save a copy of it so you can go back to the original if things go wrong. Enter the following code in the –&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_7&#34;&gt;setupWorkingDirectory&lt;/span&gt;: method:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_8&#34;&gt;NSString&lt;/span&gt; *&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_9&#34;&gt;resourcePath&lt;/span&gt; = [[&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_10&#34;&gt;NSBundle&lt;/span&gt; &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_11&#34;&gt;mainBundle&lt;/span&gt;] &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_12&#34;&gt;resourcePath&lt;/span&gt;];&#xA;[[&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_13&#34;&gt;NSFileManager&lt;/span&gt; &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_14&#34;&gt;defaultManager&lt;/span&gt;] &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_15&#34;&gt;&#xA;changeCurrentDirectoryPath&lt;/span&gt;:&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_16&#34;&gt;resourcePath&lt;/span&gt;];&lt;/pre&gt;&#xA;&lt;p&gt;Thanks to Keith Bauer, aka &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_17&#34;&gt;OneSadCookie&lt;/span&gt;, for the source code to change the working directory.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>New Article: Playing Audio Files with QTKit</title>
      <link>https://www.meandmark.com/new-article-playing-audio-files-with-qtkit/</link>
      <pubDate>Thu, 06 Dec 2007 17:55:00 +0000</pubDate>
      <guid>https://www.meandmark.com/new-article-playing-audio-files-with-qtkit/</guid>
      <description>&lt;p&gt;I have a &lt;a href=&#34;http://www.meandmark.com/qtkitaudiopart1.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;new article&lt;/a&gt; on my website that explains how to load and play audio files using the &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;QTKit&lt;/span&gt; framework. It should be especially helpful to any Cocoa developer who wants to loop an audio file because information on looping was hard to find in Apple’s &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;QTKit&lt;/span&gt; documentation.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>I Don’t Have Leopard Yet</title>
      <link>https://www.meandmark.com/i-dont-have-leopard-yet/</link>
      <pubDate>Mon, 29 Oct 2007 20:00:00 +0000</pubDate>
      <guid>https://www.meandmark.com/i-dont-have-leopard-yet/</guid>
      <description>&lt;p&gt;Because I don’t have Leopard yet, I don’t have &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; 3 so I can’t answer your &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;Xcode&lt;/span&gt; 3 questions. You can still ask them if you want, if you don’t mind the response “I don’t know”. Apple has an &lt;a href=&#34;http://lists.apple.com/mailman/listinfo/xcode-users&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;Xcode&lt;/span&gt; mailing list&lt;/a&gt; where you can ask &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;Xcode&lt;/span&gt; 3 questions as well as questions on other Apple developer tools like Interface Builder.&lt;/p&gt;&#xA;&lt;p&gt;I will post on the blog when I get Leopard, also known as Mac OS X 10.5.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>New Article: Mac Game Programming Roadmap</title>
      <link>https://www.meandmark.com/new-article-mac-game-programming-roadmap/</link>
      <pubDate>Thu, 11 Oct 2007 20:15:00 +0000</pubDate>
      <guid>https://www.meandmark.com/new-article-mac-game-programming-roadmap/</guid>
      <description>&lt;p&gt;I have a &lt;a href=&#34;http://www.meandmark.com/macgamedevroadmappart1.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;new article&lt;/a&gt; available that provides an overview of the technologies to learn to write Mac games. The article was motivated by a discussion that has been brewing on Apple’s game development mailing list for several list. The discussion revolved around Apple’s lack of support for games, and one complaint was that Apple did not have a game library like &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;DirectX&lt;/span&gt;. Without a game library getting started with Mac game development can be difficult because he or she may not know where to begin. My article helps them know where to begin. If you’re new to Mac game development, check out the article.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Changing the Application Name for an Xcode Project</title>
      <link>https://www.meandmark.com/changing-the-application-name-for-an-xcode-project/</link>
      <pubDate>Mon, 10 Sep 2007 19:20:00 +0000</pubDate>
      <guid>https://www.meandmark.com/changing-the-application-name-for-an-xcode-project/</guid>
      <description>&lt;p&gt;Note: I got about 95% finished with this post when I realized it should be on the &lt;a href=&#34;http://www.meandmark.com/xcodetips.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; Tools Tips page&lt;/a&gt;. Because I was almost finished, I decided to also post it on the blog.&lt;/p&gt;&#xA;&lt;p&gt;When you create an &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;Xcode&lt;/span&gt; project, &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;Xcode&lt;/span&gt; uses the project name as the title of whatever it builds. If you create an &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;Xcode&lt;/span&gt; application project named &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_4&#34;&gt;MyProject&lt;/span&gt;, &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_5&#34;&gt;Xcode&lt;/span&gt; will create an application named &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_6&#34;&gt;MyProject&lt;/span&gt; when you build the project.&lt;/p&gt;&#xA;&lt;p&gt;Suppose you’re working on your application for a few weeks when you discover the perfect name for your application. You change the name of your project from &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_7&#34;&gt;MyProject&lt;/span&gt; to &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_8&#34;&gt;PerfectName&lt;/span&gt;, clean your project, and rebuild it. You expect to find an application named &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_9&#34;&gt;PerfectName&lt;/span&gt; in your build folder, but the application is still called &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_10&#34;&gt;MyProject&lt;/span&gt;. How do you get &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_11&#34;&gt;Xcode&lt;/span&gt; to build the project so the application name is &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_12&#34;&gt;PerfectName&lt;/span&gt;?&lt;/p&gt;&#xA;&lt;p&gt;The answer is to modify the Product Name build setting, which you can find in the Packaging build settings collection. Product Name is the name of what &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_13&#34;&gt;Xcode&lt;/span&gt; builds, such as an application, a framework, or a library. &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_14&#34;&gt;Xcode&lt;/span&gt; initially uses the project name as the product name so when you look at the Product Name build setting, it will most likely be blank. Change the value of the Product Name to what you want, which would be &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_15&#34;&gt;PerfectName&lt;/span&gt; in this ongoing example.&lt;/p&gt;&#xA;&lt;p&gt;When you change the Product Name build setting, you’ll want to change it for the target, not a single build configuration. Changing the Product Name build setting for the target makes sure the change takes effect for all build configurations.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Setting up Visual C&#43;&#43; on Windows Vista</title>
      <link>https://www.meandmark.com/setting-up-visual-c-on-windows-vista/</link>
      <pubDate>Mon, 20 Aug 2007 23:55:00 +0000</pubDate>
      <guid>https://www.meandmark.com/setting-up-visual-c-on-windows-vista/</guid>
      <description>&lt;p&gt;I have instructions on setting up Visual C++ 2005 Express for SDL and OpenGL on my &lt;a href=&#34;http://www.meandmark.com/opengl2dbook.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;OpenGL 2D book site&lt;/a&gt;. I based those instructions on what I had to do to set up Visual C++ on my brother’s computer running Windows XP. When I used the instructions to set up Visual C++ on my Windows Vista virtual machine, a major problem occurred. Visual C++ crashed every time I tried to add an existing file to a project. The crashes occurred because I hadn’t installed the necessary service packs.&lt;/p&gt;&#xA;&lt;p&gt;There are two service packs you must install for Visual C++ to work with Vista. The first is Visual C++ 2005 Express Service Pack 1. The second is Visual Studio 2005 Service Pack 1 Update for Windows Vista. Both of these service packs can be downloaded at Microsoft’s developer site.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Moving a Subversion Repository to a New Computer</title>
      <link>https://www.meandmark.com/moving-a-subversion-repository-to-a-new-computer/</link>
      <pubDate>Sat, 18 Aug 2007 04:35:00 +0000</pubDate>
      <guid>https://www.meandmark.com/moving-a-subversion-repository-to-a-new-computer/</guid>
      <description>&lt;p&gt;I recently got one of the new iMacs, and I had to move my local Subversion repository to the new Mac. Getting the repository to the new Mac was a little tricky. Most of the Subversion tutorials on the Internet deal with creating a repository from scratch so I figured an article on moving a Subversion repository to a new computer would help people.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Moving the Repository&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Moving a repository to a new computer requires three steps.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Dump the repository’s contents to a file.&lt;/li&gt;&#xA;&lt;li&gt;Create a repository on the new computer.&lt;/li&gt;&#xA;&lt;li&gt;Load the repository with the contents of the dumped file’s contents.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Run the command svnadmin dump to dump the contents of a repository to a text file. Navigate to the directory above the repository, and run svndadmin dump.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-family: courier new;&#34;&gt;svnadmin dump RepositoryName &amp;gt; &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;DumpFile&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Running &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;svnadmin&lt;/span&gt; dump like I just did will write the contents of your repository to a file called &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;DumpFile&lt;/span&gt;. Ideally you would dump the repository contents before you get your new computer and copy the dump file to your new computer. But I was able to copy my repository folder to the new computer and run &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;svnadmin&lt;/span&gt; dump on the new computer.&lt;/p&gt;&#xA;&lt;p&gt;After creating the dump file, run the command &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_4&#34;&gt;svnadmin&lt;/span&gt; create to create a new repository. Navigate to where you want the repository to reside and enter the following command:&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-family: courier new;&#34;&gt;&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_5&#34;&gt;svnadmin&lt;/span&gt; create &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_6&#34;&gt;RepositoryName&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now it’s time to fill the newly created repository with the contents of the dump file. Run the command &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_7&#34;&gt;svnadmin&lt;/span&gt; load to fill the repository.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-family: courier new;&#34;&gt;&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_8&#34;&gt;svnadmin&lt;/span&gt; load &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_9&#34;&gt;RepositoryName&lt;/span&gt; &amp;lt; &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_10&#34;&gt;DumpFile&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now you’ve managed to copy the repository over to the new computer.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Changing the Repository’s Path&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After recreating my old repository, I opened an &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_11&#34;&gt;Xcode&lt;/span&gt; project that was in the repository to see if the version control information was appearing in &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_12&#34;&gt;Xcode&lt;/span&gt;. The only information that was appearing was the files’ local revision numbers. There was no information on previous versions of the project’s files.&lt;/p&gt;&#xA;&lt;p&gt;The cause of the problem was the repository path on the new computer did not match the path on the old computer. I needed to tell the files in the repository the new path to the repository.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_13&#34;&gt;svn&lt;/span&gt; switch command accomplished this task. To tell the files the new repository path, move to the directory where the project’s files reside and run the &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_14&#34;&gt;svn&lt;/span&gt; switch command using the –relocate option. When using the –relocate option, you first supply the old repository path, then the new path.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-family: courier new;&#34;&gt;&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_15&#34;&gt;svn&lt;/span&gt; switch –relocate /Path/On/Old/Computer /Path/On/New/Computer&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After running &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_16&#34;&gt;svn&lt;/span&gt; switch, all the version control information began to appear in &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_17&#34;&gt;Xcode&lt;/span&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>SDL 1.2.12</title>
      <link>https://www.meandmark.com/sdl-1-2-12/</link>
      <pubDate>Wed, 01 Aug 2007 02:50:00 +0000</pubDate>
      <guid>https://www.meandmark.com/sdl-1-2-12/</guid>
      <description>&lt;p&gt;The latest version of &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;SDL&lt;/span&gt;, 1.2.12, is available to download from the &lt;a href=&#34;http://www.libsdl.org/index.php&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;SDL&lt;/span&gt;&lt;/a&gt; website. Anyone using Mac OS X and supporting joysticks in their game should download the update because it fixes a joystick calibration bug. When starting a game, &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;SDL&lt;/span&gt; would record joystick axis events when the joystick was not moved, causing movement in the game with no joystick movement. The only way to stop the unwanted movement was to move the joystick up, down, left, and right. The 1.2.12 update eliminates the unwanted movement, making joysticks work the way you would expect on Mac OS X.&lt;span class=&#34;on&#34; style=&#34;display: block;&#34; id=&#34;formatbar_CreateLink&#34; title=&#34;Link&#34; onmouseover=&#34;ButtonHoverOn(this);&#34; onmouseout=&#34;ButtonHoverOff(this);&#34; onmouseup=&#34;&#34; onmousedown=&#34;CheckFormatting(event);FormatbarButton(&#39;richeditorframe&#39;, this, 8);ButtonMouseDown(this);&#34;&gt;&lt;/span&gt;&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Reducing Xcode’s Window Clutter</title>
      <link>https://www.meandmark.com/reducing-xcodes-window-clutter/</link>
      <pubDate>Thu, 21 Jun 2007 02:15:00 +0000</pubDate>
      <guid>https://www.meandmark.com/reducing-xcodes-window-clutter/</guid>
      <description>&lt;p&gt;If you do a lot of work in Xcode, your desktop can quickly become cluttered with windows, which can make finding the window you want difficult. This post shows you what you can do to reduce the number of open windows in Xcode.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Grouped Editor Windows&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;When you open an editor window by double-clicking a source code file in the project window, you will notice a toolbar button in the upper right corner of the window. The button’s text will say either Grouped or Ungrouped. Clicking the button changes the text from Grouped to Ungrouped and vice versa.&lt;/p&gt;&#xA;&lt;p&gt;Grouped editor windows tell Xcode to open only one editor window. When you double-click a source code file in the project window, Xcode places the contents of the file in the single editor window. Ungrouped editor windows tell Xcode to open a new editor window every time you double-click a source code file in the project window. Grouping editor windows eliminates a lot of window clutter.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Editing in the Project Window&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If a single editor window is too much clutter for you, you can edit source code in the project window. Click the Editor button in the project window toolbar to open an editor in the project window’s detail view. Clicking the Editor button a second time brings back the original detail view.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;All-In-One Layout&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The first two tips eliminate the clutter of editor windows. But Xcode’s default layout still creates lot of external windows: run log, debugger window, build results window, search results, and SCM results. How do you keep all these windows from opening? The solution is to switch to Xcode’s All-In-One layout, which places all the external windows in the project window.&lt;/p&gt;&#xA;&lt;p&gt;To switch to the All-In-One layout, open Xcode’s preferences window by choosing Xcode &amp;gt; Preferences. Click the General button in the preferences window toolbar. Choose All-In-One from the Layout pop-up menu. The following screenshot shows what the All- In-One layout looks like.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a onblur=&#34;try {parent.deselectBloggerImageGracefully();} catch(e) {}&#34; href=&#34;http://2.bp.blogspot.com/_43mxm9V6l5Q/RnnQT74vD1I/AAAAAAAAAA8/eoMceM-Tpmc/s1600-h/XcodeProjectWindowAllInOne.jpg&#34;&gt;&lt;img decoding=&#34;async&#34; style=&#34;cursor: pointer;&#34; src=&#34;http://2.bp.blogspot.com/_43mxm9V6l5Q/RnnQT74vD1I/AAAAAAAAAA8/eoMceM-Tpmc/s320/XcodeProjectWindowAllInOne.jpg&#34; alt=&#34;&#34; id=&#34;BLOGGER_PHOTO_ID_5078319095748693842&#34; border=&#34;0&#34; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The All-In-One layout looks similar to the default layout, but you will notice a Page area in the upper left corner of the project window with three buttons. The left button is the Project page, which looks like the default layout, but with two tabs for search results and &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;SCM&lt;/span&gt;&lt;/span&gt; results. The center button is the Build page, which gives you access to the run log and build results window. The right button is the Debug page, which gives you access to the debugger window.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>New Xcode Tip: Supplying Launch Arguments for Command-Line Programs</title>
      <link>https://www.meandmark.com/new-xcode-tip-supplying-launch-arguments-for-command-line-programs/</link>
      <pubDate>Thu, 31 May 2007 20:57:00 +0000</pubDate>
      <guid>https://www.meandmark.com/new-xcode-tip-supplying-launch-arguments-for-command-line-programs/</guid>
      <description>&lt;p&gt;I added a tip to the &lt;a href=&#34;http://www.meandmark.com/xcodetips.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; Tools Tips page&lt;/a&gt; on supplying launch arguments for command-line programs from &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;Xcode&lt;/span&gt;. This information is tucked away in the excerpt from the &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;Xcode&lt;/span&gt; chapter, but it’s difficult to find. I saw a question about supplying launch arguments on a message board, and another person emailed me about it. When multiple people have the same question, it makes sense to add a tip so everyone can benefit.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>New Xcode Tip: Changing the Executable Name</title>
      <link>https://www.meandmark.com/new-xcode-tip-changing-the-executable-name/</link>
      <pubDate>Wed, 16 May 2007 21:45:00 +0000</pubDate>
      <guid>https://www.meandmark.com/new-xcode-tip-changing-the-executable-name/</guid>
      <description>&lt;p&gt;I added a new tip to the &lt;a href=&#34;http://www.meandmark.com/xcodetips.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;&lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; Tools Tips&lt;/a&gt; page on changing the executable name in your &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;Xcode&lt;/span&gt; projects. If you don’t want to read the whole tip, I can summarize it in one sentence. Change your target’s Product name build setting, which is part of the Packaging collection.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>New Bundles Article</title>
      <link>https://www.meandmark.com/new-bundles-article/</link>
      <pubDate>Thu, 10 May 2007 06:39:00 +0000</pubDate>
      <guid>https://www.meandmark.com/new-bundles-article/</guid>
      <description>&lt;p&gt;I have a new &lt;a href=&#34;http://www.meandmark.com/bundlespart1.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;article on bundles&lt;/a&gt; available. It introduces bundles, focusing on application bundles. After reading the article, you will know how to create a bundle, add files to the bundle, and retrieve files from the bundle.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Leopard Delay a Blessing for Me</title>
      <link>https://www.meandmark.com/leopard-delay-a-blessing-for-me/</link>
      <pubDate>Mon, 23 Apr 2007 19:23:00 +0000</pubDate>
      <guid>https://www.meandmark.com/leopard-delay-a-blessing-for-me/</guid>
      <description>&lt;p&gt;Apple did me a favor as a writer by delaying the release of Mac OS X 10.5 from June to October. With a June release I would have had a difficult decision to make: delay updating &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; Tools &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;Sensei&lt;/span&gt; until I finished the &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;OpenGL&lt;/span&gt; book, or delay development on the &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;OpenGL&lt;/span&gt; book to update the &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_4&#34;&gt;Xcode&lt;/span&gt; book. Apple gave me another four months to finish the &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_5&#34;&gt;OpenGL&lt;/span&gt; book.&lt;/p&gt;&#xA;&lt;p&gt;All updates for &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_6&#34;&gt;Xcode&lt;/span&gt; 3 and Leopard will come in a new edition of &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_7&#34;&gt;Xcode&lt;/span&gt; Tools &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_8&#34;&gt;Sensei&lt;/span&gt;. &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_9&#34;&gt;Xcode&lt;/span&gt; and Interface Builder are going to have major updates. Trying to juggle &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_10&#34;&gt;Xcode&lt;/span&gt; 1.x, 2.x, and 3 in one text would be difficult for me to write and you to read. I also will have to take a bunch of new screenshots so it makes sense to have two versions of the book: the current version that supports &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_11&#34;&gt;Xcode&lt;/span&gt; 1.x and 2.x, and a new version specifically for &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_12&#34;&gt;Xcode&lt;/span&gt; 3. The electronic edition of the &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_13&#34;&gt;Xcode&lt;/span&gt; 3 version would be available at a discount for everyone who has the current version of the book.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Skim PDF Viewer</title>
      <link>https://www.meandmark.com/skim-pdf-viewer/</link>
      <pubDate>Wed, 04 Apr 2007 20:25:00 +0000</pubDate>
      <guid>https://www.meandmark.com/skim-pdf-viewer/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;http://skim-app.sourceforge.net/index.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Skim&lt;/a&gt; is a free, open-source PDF viewer for Mac OS X. Mac OS X comes with Preview, which views PDF files, and Adobe Acrobat Reader is freely available so what makes Skim special? Skim has features that make reading technical articles and academic papers easier.&lt;/p&gt;&#xA;&lt;p&gt;The first of these features is the ability to add notes to a PDF document. It’s the electronic equivalent of adding sticky notes to a paper document. When you’re reading difficult material, being able to make notes to yourself helps in understanding the material.&lt;/p&gt;&#xA;&lt;p&gt;A second useful feature is the ability to highlight areas of text by putting a circle or box around it. A third feature is snapshots, which let you keep important pieces of a document in easy reach.&lt;/p&gt;&#xA;&lt;p&gt;Skim is at version 0.2, which means it’s far from a finished product. But if you read a lot of PDF technical articles, you should give Skim a test drive.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Using Saturn on Intel Macs</title>
      <link>https://www.meandmark.com/using-saturn-on-intel-macs/</link>
      <pubDate>Mon, 02 Apr 2007 07:15:00 +0000</pubDate>
      <guid>https://www.meandmark.com/using-saturn-on-intel-macs/</guid>
      <description>&lt;p&gt;I read a post on Apple’s performance and optimization mailing list that tells you what to do to use Saturn on Intel Macs. This information may be useful to some of you so I am writing about it here.&lt;/p&gt;&#xA;&lt;p&gt;To use Saturn to profile your code, you must compile your code with either the &lt;span style=&#34;font-weight: bold;&#34;&gt;-pg&lt;/span&gt; compiler flag (Generate Profiling Code build setting in &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt;) or the &lt;span style=&#34;font-weight: bold;&#34;&gt;–&lt;/span&gt;&lt;span style=&#34;font-weight: bold;&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;finstrument&lt;/span&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;-functions&lt;/span&gt; compiler flag. The &lt;span style=&#34;font-weight: bold;&#34;&gt;-pg&lt;/span&gt; compiler flag is the flag most people use, but Apple hasn’t added the support for &lt;span style=&#34;font-weight: bold;&#34;&gt;-pg&lt;/span&gt; on Intel Macs yet so using the &lt;span style=&#34;font-weight: bold;&#34;&gt;-pg&lt;/span&gt; flag won’t allow you to run your code with Saturn on an Intel Mac.&lt;/p&gt;&#xA;&lt;p&gt;The solution is to use the &lt;span style=&#34;font-weight: bold;&#34;&gt;–&lt;/span&gt;&lt;span style=&#34;font-weight: bold;&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;finstrument&lt;/span&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;-functions&lt;/span&gt; flag to compile your code. I didn’t see an &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;Xcode&lt;/span&gt; build setting for this flag so you’ll have to add the flag to the Other C Flags or Other C++ Flags build setting in &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_4&#34;&gt;Xcode&lt;/span&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I don’t have an Intel Mac so I can’t test this for myself, but the information came from an Apple engineer so I will assume the information is accurate.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>OpenGL Book Progress Report for March 2007</title>
      <link>https://www.meandmark.com/opengl-book-progress-report-for-march-2007/</link>
      <pubDate>Fri, 30 Mar 2007 19:43:00 +0000</pubDate>
      <guid>https://www.meandmark.com/opengl-book-progress-report-for-march-2007/</guid>
      <description>&lt;p&gt;I haven’t posted anything about the &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;OpenGL&lt;/span&gt; book for a while, but I am writing to let you know I am still working on it. Progress has been excruciatingly slow, which has been very frustrating to me. On the code front, I’ve been working on the physics code. On the writing front, I have a lot of material written on several chapters, but I still don’t have a finished chapter. Whenever I write about something, it brings up several additional topics I have to write about. When I write about those topics, it brings up more things to write about, which makes finishing difficult.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>I’m Changing Website Hosts</title>
      <link>https://www.meandmark.com/im-changing-website-hosts/</link>
      <pubDate>Wed, 28 Feb 2007 20:57:00 +0000</pubDate>
      <guid>https://www.meandmark.com/im-changing-website-hosts/</guid>
      <description>&lt;p&gt;I have started moving the Me and Mark Publishing website to a new host. Everything should be transferred within the next 1-2 days. Hopefully there won’t be any problems. I will add an item to the Latest News section about the switch. If you see the item on the Me and Mark Publishing home page, you’re viewing the site with the new host.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Seeing Xcode’s Build Errors</title>
      <link>https://www.meandmark.com/seeing-xcodes-build-errors/</link>
      <pubDate>Mon, 19 Feb 2007 20:10:00 +0000</pubDate>
      <guid>https://www.meandmark.com/seeing-xcodes-build-errors/</guid>
      <description>&lt;p&gt;When you build an Xcode project, Xcode tells you whether or not the build succeeded. If the build succeeded, that’s all you need to know, but if the build failed, you want to know what the errors are so you can fix them. Xcode has two places to look at your errors: the Errors and Warnings smart group and the build results window.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Errors and Warnings Smart Group&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;In the project window’s Groups and Files list, you will see the Errors and Warnings smart group. Select the Error and Warnings group and the project window shows the build errors. Double-clicking an error or warning takes you to the line of code where the error occurred.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Build Results Window&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a onblur=&#34;try {parent.deselectBloggerImageGracefully();} catch(e) {}&#34; href=&#34;http://3.bp.blogspot.com/_43mxm9V6l5Q/RdoDR-IXomI/AAAAAAAAAAk/sPHZST4MNTg/s1600-h/BuildResults.jpg&#34;&gt;&lt;img decoding=&#34;async&#34; style=&#34;cursor: pointer;&#34; src=&#34;http://3.bp.blogspot.com/_43mxm9V6l5Q/RdoDR-IXomI/AAAAAAAAAAk/sPHZST4MNTg/s320/BuildResults.jpg&#34; alt=&#34;&#34; id=&#34;BLOGGER_PHOTO_ID_5033339140810711650&#34; border=&#34;0&#34; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;When you need to see more detailed information about your build, use the build results window. Choose Build &amp;gt; Build Results to open the build results window. The build results window has three sections. The top section is the build results, which shows the high-level build steps. The middle section is the build transcript, which shows the low-level steps &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; takes to build your project. The bottom section is the editor. Selecting an error from the build results or the build transcript shows the line of code in the editor where the error occurred.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Showing the Build Transcript&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you open the build results window for the first time, you won’t see the build transcript. The build transcript is initially invisible, and you must tell &lt;span class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;Xcode&lt;/span&gt; to show it. Below the build results are four small buttons. Click the third button to show the build transcript.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Writing C&#43;&#43; Programs on Mac OS X</title>
      <link>https://www.meandmark.com/writing-c-programs-on-mac-os-x/</link>
      <pubDate>Thu, 01 Feb 2007 01:35:00 +0000</pubDate>
      <guid>https://www.meandmark.com/writing-c-programs-on-mac-os-x/</guid>
      <description>&lt;p&gt;A frequently asked question on Mac programming forums is “Can I write C++ programs on Mac OS X?”. Yes, you can write C++ programs on Mac OS X.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Install the Xcode Tools&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The Xcode Tools contain everything you need to write Mac OS X applications, including C++ programs. Every copy of Mac OS X contains the Xcode Tools. If you have Mac OS X 10.4, there should be an item called Xcode Tools on the Mac OS X DVD. This item contains the installer. Older versions of Mac OS X that ship on multiple CDs contain either an Xcode Tools or Developer Tools CD.&lt;/p&gt;&#xA;&lt;p&gt;Apple frequently updates the Xcode Tools so the version that shipped with your copy of Mac OS X is most likely not the most recent version. If you have a broadband Internet connection, I recommend going to &lt;a href=&#34;http://developer.apple.com/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Apple’s developer page&lt;/a&gt; and signing up for a free ADC membership. After signing up for an ADC membership, you can download the most recent version of the Xcode Tools.&lt;/p&gt;&#xA;&lt;p&gt;One common concern people have when installing the Xcode Tools is the size of the install. The easy install of the Xcode Tools is over 1.5 GB, which is overkill if all you want to do is learn C++. You can perform a custom install of the Xcode Tools to reduce the size of the install. If you are low on disk space, the easiest way to save space is to not install the developer documentation. The developer documentation takes about 1 GB of disk space, and you can view all the documentation online anyway.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Writing Standard C++ Programs&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;The people most likely to ask if they can write C++ programs on Mac OS X are Mac-using college students who are taking a class on C++ programming. C++ programming classes normally teach standard C++, which will run on most operating systems, including Mac OS X.&lt;/p&gt;&#xA;&lt;p&gt;To write a standard C++ program with Xcode, you must create a C++ Tool project. C++ Tool projects are used to write command-line programs without a GUI, which makes programming easier. You can read an article on the &lt;a href=&#34;http://www.meandmark.com/xcodebook.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode Tools Sensei&lt;/a&gt; page that contains detailed instructions on creating and building a C++ Tool project.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Writing C++ GUI Programs&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;After learning C++ you may want to use your newfound knowledge to write Mac OS X GUI programs. You have three options for writing Mac GUI applications in C++. First, you can use Cocoa, writing your user interface code in Objective C and the rest of your code in C++. You must give your Objective C files the extension .mm, which tells Xcode to treat them as Objective C++ files. Objective C++ lets you mix C++ and Objective C code in the same source file.&lt;/p&gt;&#xA;&lt;p&gt;Second, you can use Carbon, which is Apple’s C API for writing GUI applications. If you choose to use Carbon, you may want to look into &lt;a href=&#34;http://www.refnum.com/products/nano&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Nano&lt;/a&gt;, an open-source C++ framework built on top of Carbon.&lt;/p&gt;&#xA;&lt;p&gt;Third, you can use a C++ cross-platform GUI framework like &lt;a href=&#34;http://www.trolltech.com/products/qt&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Qt&lt;/a&gt; or &lt;a href=&#34;http://www.wxwidgets.org/&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;wxWidgets&lt;/a&gt;. I haven’t used either of these frameworks, but you should check them out if you are interested in supporting Linux and Windows as well as Mac OS X.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>TextWrangler and Interpreted Languages</title>
      <link>https://www.meandmark.com/textwrangler-and-interpreted-languages/</link>
      <pubDate>Mon, 15 Jan 2007 19:42:00 +0000</pubDate>
      <guid>https://www.meandmark.com/textwrangler-and-interpreted-languages/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;http://www.barebones.com/products/textwrangler&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;TextWrangler&lt;/a&gt; is a free text editor for Mac OS X. It also happens to be a nice development environment for interpreted languages, especially for Perl, Python, and Ruby programming.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;TextWrangler’s Advantage over Xcode for Interpreted Languages&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Xcode is designed for compiled languages like C++ and Java, not interpreted languages like Python and Ruby. You can create an external build system project in Xcode, but it is not very useful for interpreted languages because there is nothing to build for interpreted languages. You have to run the Terminal application and launch your program from the command line using your language’s interpreter.&lt;/p&gt;&#xA;&lt;p&gt;TextWrangler’s shebang (#!) menu allows you to run Unix scripts from TextWrangler so you don’t have to launch Terminal. TextWrangler has built-in support for Perl, Python, and Ruby, which means you can run and debug Perl, Python, and Ruby programs from TextWrangler. You can use TextWrangler to run programs in other interpreted languages, but you can’t debug them using TextWrangler’s Run in Debugger menu item.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Creating and Running a Program with TextWrangler&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Writing and running code in interpreted languages is easy in TextWrangler. The following steps show you how to write a simple Ruby program with TextWrangler:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Choose File &amp;gt; New Text Document.&lt;/li&gt;&#xA;&lt;li&gt;At the bottom of the document window are three pop-up menus. The left menu should say (none). Choose Ruby from the left pop-up menu. This tells TextWrangler that you are writing a Ruby program, which turns on Ruby syntax highlighting and enables the Run in Debugger menu item.&lt;/li&gt;&#xA;&lt;li&gt;Write your code. For a Hello World program, enter &lt;span style=&#34;font-weight: bold;&#34;&gt;puts “Hello World”&lt;/span&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Choose #! &amp;gt; Run to run the program.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The instructions for Perl and Python are similar. For Step 2 you would choose either Perl or Python from the pop-up menu and write Perl or Python code instead of Ruby.&lt;/p&gt;&#xA;&lt;p&gt;If you are using another interpreted language, the first line of code must specify the path to the interpreter.&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;#!/path/to/interpreter&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;The #! sequence is the start of a Unix script.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Using TextWrangler with Xcode&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Although you don’t need Xcode for small projects if you use TextWrangler, Xcode has its place for larger projects. You would use Xcode for project organization and version control and use TextWrangler to write the code and run the program. The &lt;a href=&#34;http://www.meandmark.com/xcodetips.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode Tools Tips&lt;/a&gt; page has a tip on using external editors with Xcode.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>ZeroLink</title>
      <link>https://www.meandmark.com/zerolink/</link>
      <pubDate>Mon, 08 Jan 2007 21:06:00 +0000</pubDate>
      <guid>https://www.meandmark.com/zerolink/</guid>
      <description>&lt;p&gt;I read many posts on Mac programming message boards about problems that end up being caused by ZeroLink. Responding to these posts gets tiresome after a while so I decided to write about ZeroLink. In this post I explain what ZeroLink does, the problems it causes, and how you can turn it off so it doesn’t cause you problems.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;What ZeroLink Does&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Before I explain what ZeroLink does, I should explain how Xcode normally builds C, C++, and Objective C projects. When you tell Xcode to build your project, the compiler compiles each source code file, creating an object file for each source code file. After compiling each file the linker links each object file along with the libraries and frameworks you’re using to create an executable file you can run.&lt;/p&gt;&#xA;&lt;p&gt;As its name suggests, Xcode skips the linking stage when you build with ZeroLink. When you run your program built with ZeroLink, Xcode links object files when your program needs them.&lt;/p&gt;&#xA;&lt;p&gt;What is the advantage of using ZeroLink? It makes building your project go faster. If your project has many source code files, ZeroLink can speed build times significantly. During development you’re going to build your project many times so faster build times save you time.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;ZeroLink’s Dark Side&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;ZeroLink’s build time savings have a cost. The cost is you can get bizarre program behavior, and the cause of this behavior can be difficult to find. There are two common problems ZeroLink causes. First, because ZeroLink skips the linking stage, you won’t find any linker errors when you build your project. The error appears when you run the program in Xcode, and your program crashes.&lt;/p&gt;&#xA;&lt;p&gt;Second, your program won’t launch when you move the executable or try to run it on another Mac. Projects built with ZeroLink can be run only inside Xcode. Because ZeroLink doesn’t do any linking, the executable file is just a shell. When you move the executable file and try to launch it, nothing happens because there’s no code inside the executable file. The code is in the object files that haven’t been linked.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;The Cause of Confusion&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;ZeroLink-related problems occur most often for people new to Xcode, and it’s not their fault. When you create a new Xcode project, Xcode sets the project’s active build configuration (the configuration it will use when you build the project) to the debug configuration. The debug configuration initially enables ZeroLink. What this means is if you create an Xcode project, add code to the project, and build the project, you’re building with ZeroLink, whether you intended to or not.&lt;/p&gt;&#xA;&lt;p&gt;Most Xcode beginners do not intend to use ZeroLink and have no need for it. Unless you have a large project, the problems ZeroLink causes surpass the time saved by not linking. While ZeroLink has its place, most developers are better off not using it, and Apple would be better off turning off ZeroLink initially.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Turning off ZeroLink&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Because Apple enables ZeroLink initially, it is up to you to turn it off. If you’re running Xcode 2.2 or later, the easiest way to turn off ZeroLink is to choose Build &amp;gt; Allow ZeroLink. Make sure there is no check mark next to the menu item. No check mark means ZeroLink is turned off. When you turn off ZeroLink using this method, you can’t use ZeroLink for any project. If you decide you want to use ZeroLink in the future, choose Build &amp;gt; Allow &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;ZeroLink&lt;/span&gt; to give yourself the capability of turning &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;ZeroLink&lt;/span&gt; on or off on a project by project basis.&lt;/p&gt;&#xA;&lt;p&gt;If you’re running an earlier version of &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;Xcode&lt;/span&gt;, you must turn off the &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;ZeroLink&lt;/span&gt; build setting for each project. The &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_4&#34;&gt;ZeroLink&lt;/span&gt; build setting is in the Linking build settings collection.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Linking External Libraries and Frameworks in Xcode</title>
      <link>https://www.meandmark.com/linking-external-libraries-and-frameworks-in-xcode/</link>
      <pubDate>Wed, 03 Jan 2007 06:05:00 +0000</pubDate>
      <guid>https://www.meandmark.com/linking-external-libraries-and-frameworks-in-xcode/</guid>
      <description>&lt;p&gt;As long as you stick with the Apple-supplied frameworks that reside in System/Library/Frameworks (Cocoa, Carbon, &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;OpenGL&lt;/span&gt;, &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;QuickTime&lt;/span&gt;, etc.), linking in &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;Xcode&lt;/span&gt; is pretty simple. Add the framework to your project, and you’re done.&lt;/p&gt;&#xA;&lt;p&gt;Things get a little more complicated when you want to use other libraries and frameworks in your code. If you’re new to &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;Xcode&lt;/span&gt;, you may get a ton of &lt;span style=&#34;font-style: italic;&#34;&gt;undefined symbol&lt;/span&gt; linker errors when you build your project, with the undefined symbols being in the the libraries and frameworks you want to use. These errors mean the linker can’t find the symbols. How can you eliminate these errors?&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Add the Libraries and Frameworks to Your Project&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;It sounds obvious, but make sure you have added the external libraries and frameworks to your project. If you don’t add them, your project will not link.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Add Search Paths&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;If you have added the libraries and frameworks to your project and you still get &lt;span style=&#34;font-style: italic;&#34;&gt;undefined symbol&lt;/span&gt; errors, the most likely cause is the linker can’t find the libraries and frameworks. What you need to do is add search paths for the libraries and frameworks you’re using.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_4&#34;&gt;Xcode&lt;/span&gt; has a Search Paths build settings collection. This collection lets you add search paths for libraries, frameworks, and header files. To add a search path, select the appropriate build setting and click the Edit button. A sheet will open. Click the + button in the sheet to add a search path, and click the OK button when you’re done.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Linker Flags&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Adding search paths eliminates most linker errors, but when it fails, you can add linker flags to the project. To add linker flags go to the Linking build settings collection. The Other Linker Flags build setting lets you manually add flags the linker will use when building your project.&lt;/p&gt;&#xA;&lt;p&gt;If you still get linker errors, you’re in for a long, frustrating search for a solution.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Updated Tip on Changing the Compiler</title>
      <link>https://www.meandmark.com/updated-tip-on-changing-the-compiler/</link>
      <pubDate>Tue, 02 Jan 2007 06:37:00 +0000</pubDate>
      <guid>https://www.meandmark.com/updated-tip-on-changing-the-compiler/</guid>
      <description>&lt;p&gt;I updated the tip on the &lt;a href=&#34;http://www.meandmark.com/xcodetips.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;Xcode Tools Tips&lt;/a&gt; page that deals with changing the compiler Xcode uses to build your project. The updated tip tells you to add the build settings GCC_VERSION_ppc and GCC_VERSION_i386 instead of changing rules for the target. There currently is no need for the GCC_VERSION_i386 setting because Xcode projects use gcc 4 as the default compiler and you can’t build for Intel with anything earlier than gcc 4. But the setting will come in handy in the future when Xcode ships with a newer version of gcc.&lt;/p&gt;&#xA;&lt;p&gt;There was nothing technically wrong with having a target rule that specified the compiler to use, but it was overkill when all you want to do is compile with an earlier version of gcc. Adding the GCC_VERSION_ppc build setting is more straightforward.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Introduction to Xcode’s Debugger</title>
      <link>https://www.meandmark.com/introduction-to-xcodes-debugger/</link>
      <pubDate>Mon, 18 Dec 2006 18:44:00 +0000</pubDate>
      <guid>https://www.meandmark.com/introduction-to-xcodes-debugger/</guid>
      <description>&lt;p&gt;Most of you are familiar with the material in this article, but I read a lot of programming questions on message boards that could have been answered by running the code in a debugger. I hope new programmers will be able to find this article and use it to learn how to debug their programs.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;What is a Debugger?&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Computers run programs fast, which is normally a good thing. But if you have a problem in your code, the code runs too fast for you to figure out what is wrong. It’s like trying to watch a DVD in fast forward mode.&lt;/p&gt;&#xA;&lt;p&gt;A debugger lets you slow things down so you can see what is happening when your program runs. By using a debugger you can pause your program at any line of code, step through your code line by line, and examine the values of your program’s variables. A debugger helps immensely when you’re trying to find out what’s wrong with your code. If you’re serious about being a software developer, one of the best things you can do is learn to use a debugger.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Running the Debugger&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Xcode is set up so you don’t have to do much work to run the debugger. Every Xcode project you create has a Debug (older versions of Xcode call it Development instead of Debug) build configuration that is set for debugging. The Debug build configuration is the default configuration so all you have to do is choose Build &amp;gt; Build and Debug to open the debugger window and start debugging.&lt;/p&gt;&#xA;&lt;p&gt;The debugger window has four areas. At the top is the toolbar, which has buttons for performing the most common debugging tasks. You can also find these debugging commands in Xcode’s Debug menu.&lt;/p&gt;&#xA;&lt;p&gt;Below the toolbar on the left is the call stack viewer. At the top of the call stack is the function where your program current is. Below that is the function that called the current function. Below that is the function that called the second function and so on. The call stack viewer is the least interesting part of the debugging window for those of you who are new to debuggers.&lt;/p&gt;&#xA;&lt;p&gt;Next to the call stack viewer is the variable viewer. The variable viewer lets you see the values of the current function’s local variables and arguments as well as any constant variables that are in the current function’s source code file.&lt;/p&gt;&#xA;&lt;p&gt;At the bottom of the debugger window is the editor, which lets you see what line of code the program is currently at.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Setting Breakpoints&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Launching the debugger initially doesn’t do anything because you haven’t told the debugger when to pause. Breakpoints tell the debugger to pause your program when it reaches a certain line of code. What you have to do is set breakpoints where you want your program to pause.&lt;/p&gt;&#xA;&lt;p&gt;Click the gutter next to a line of source code in the editor window to set a breakpoint at that line of code. The gutter runs along the left edge of the window. When you set a breakpoint, a gray arrow appears next to the line of code. Dragging the arrow off the gutter removes the breakpoint.&lt;/p&gt;&#xA;&lt;p&gt;Now when you run your program in the debugger, it will pause when it reaches any of the breakpoints you set.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Stepping Through Your Code&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;Stepping is one of the most important functions a debugger performs. It lets you walk through one line of code at a time and see the effects of executing that line of code. If you look at Xcode’s debugger window toolbar, you will see three buttons: Step Over, Step Into, and Step Out. If the current line of code does not call a function, the Step Over and Step Into buttons do the same thing. They execute the current line of code and move to the next line.&lt;/p&gt;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;  The Step Over and Step Into buttons perform different tasks when making a function call. Clicking the Step Over button tells the debugger to execute all the code in the function you&amp;#8217;re calling and move to the line of code after the function call. It &lt;span style=&#34;font-style: italic;&#34;&gt;steps over&lt;/span&gt; the function you&amp;#8217;re calling.&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;  Clicking the Step Into button takes you inside the function you&amp;#8217;re calling, which lets you step through the code inside the called function. It &lt;span style=&#34;font-style: italic;&#34;&gt;steps into&lt;/span&gt; the function you&amp;#8217;re calling. When you step into a function, the Step Out button becomes relevant. Clicking the Step Out buttons takes you out of the called function and moves to the line of code after the function call. Clicking the Step Into and Step Out buttons is the equivalent of clicking the Step Over button.&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;  &lt;span style=&#34;font-weight: bold;&#34;&gt;Conclusion&lt;/span&gt;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;&#xA;  For more information on Xcode&amp;#8217;s debugger, read the Xcode&amp;#8217;s User Guide, which you can open in Xcode by choosing Help &gt; &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Xcode&lt;/span&gt; Help. There is an entire section on debugging.&lt;br /&gt;&lt;/span&gt;&#xA;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Waiting for the New Zelda Game</title>
      <link>https://www.meandmark.com/waiting-for-the-new-zelda-game/</link>
      <pubDate>Wed, 13 Dec 2006 02:11:00 +0000</pubDate>
      <guid>https://www.meandmark.com/waiting-for-the-new-zelda-game/</guid>
      <description>&lt;p&gt;The latest Zelda game came out for &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;Gamecube&lt;/span&gt; today at 5:00 PM, and I got to wait in line for it. My mother heard there were shortages so she asked my father to go to Target to get a copy. She needed two copies as Christmas presents, and purchases were limited to one per person so I ended up going to be the second person.&lt;/p&gt;&#xA;&lt;p&gt;We got to Target a little after 4:30 PM. Fortunately, there were only two people in line when we got there. A couple in their 60’s got in line behind us a few minutes later to buy a copy for their grandson, and another person got in line a few minutes before 5. Seven people in line. I felt a little foolish waiting in such a short line.&lt;/p&gt;&#xA;&lt;p&gt;Then 5:00 came, and I saw the store had only 6 copies of the game. Those of us in line were the only people to get a copy of the game. I was shocked at how few copies were available. I figured at least 20 would be available, but I felt a lot less foolish waiting in line. It’s going to be hard to find a copy of Zelda by Christmas.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Setting Up SDL for Eclipse on Mac OS X</title>
      <link>https://www.meandmark.com/setting-up-sdl-for-eclipse-on-mac-os-x/</link>
      <pubDate>Sun, 03 Dec 2006 20:22:00 +0000</pubDate>
      <guid>https://www.meandmark.com/setting-up-sdl-for-eclipse-on-mac-os-x/</guid>
      <description>&lt;p&gt;I got an email from someone who was having trouble setting up &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_0&#34;&gt;SDL&lt;/span&gt; on Eclipse. I have never used Eclipse so I could not provide him much help. He eventually found a solution and emailed it to me so I could share it with you.&lt;/p&gt;&#xA;&lt;p&gt;There are four things you have to do to get &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_1&#34;&gt;SDL&lt;/span&gt; working with Eclipse on Mac OS X in addition to what I outlined in my &lt;a href=&#34;http://www.meandmark.com/sdlopenglpart1.html&#34; target=&#34;_blank&#34; rel=&#34;noreferrer&#34;&gt;&lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_2&#34;&gt;SDL&lt;/span&gt; tutorial&lt;/a&gt;. First, you must copy the files &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_3&#34;&gt;SDLMain&lt;/span&gt;.h and &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_4&#34;&gt;SDLMain&lt;/span&gt;.m to the same directory as your &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_5&#34;&gt;SDL&lt;/span&gt; program. My interpretation of this statement is if you create an Eclipse project and add your source code files to the project folder, you must also add &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_6&#34;&gt;SDLMain&lt;/span&gt;.h and &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_7&#34;&gt;SDLMain&lt;/span&gt;.m to the project folder.&lt;/p&gt;&#xA;&lt;p&gt;Second, you must add the directory where your &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_8&#34;&gt;SDL&lt;/span&gt; headers reside to the Directories setting for the &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_9&#34;&gt;GCC&lt;/span&gt; C++ compiler. Your headers most likely reside in the following directory:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;/Library/Frameworks/SDL.framework/Headers&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Third, you must add linker flags for the Cocoa and &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_10&#34;&gt;SDL&lt;/span&gt; frameworks as well as the path to the &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_11&#34;&gt;SDLMain&lt;/span&gt;.m file.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;-framework Cocoa&lt;br&gt;&#xA;-framework &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_12&#34;&gt;SDL&lt;/span&gt;&lt;br&gt;&#xA;/Path/To/&lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_13&#34;&gt;YourProject&lt;/span&gt;/&lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_14&#34;&gt;SDLMain&lt;/span&gt;.m&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Fourth, you must change the following line of code in &lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_15&#34;&gt;SDLMain&lt;/span&gt;.m:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;#import “&lt;span onclick=&#34;BLOG_clickHandler(this)&#34; class=&#34;blsp-spelling-error&#34; id=&#34;SPELLING_ERROR_16&#34;&gt;SDL&lt;/span&gt;.h”&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;to the following:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;#include SDL/SDL.h&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Put less than and greater than signs around the SDL/SDL.h. For some reason I can’t get those characters to show up in the blog.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>OpenGL Book Pushed Back to 2007</title>
      <link>https://www.meandmark.com/opengl-book-pushed-back-to-2007/</link>
      <pubDate>Tue, 28 Nov 2006 21:46:00 +0000</pubDate>
      <guid>https://www.meandmark.com/opengl-book-pushed-back-to-2007/</guid>
      <description>&lt;p&gt;I’ve come to the conclusion there is no way I’m going to be able to finish the OpenGL book by the end of the year, as I had hoped. I would like to have the book finished in the first quarter of 2007.&lt;/p&gt;&#xA;&lt;p&gt;Writing has progressed slower than I thought. I have my facts correct, but I’m having a hard time making the material interesting to read and making clear explanations. I’m frustrated by the slow progress I’m making, but I prefer taking the time to write a good book that helps people instead of rushing a crappy book that doesn’t help anyone.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Game Design Tip: Don’t Make the Player Play the Same Stuff Repeatedly</title>
      <link>https://www.meandmark.com/game-design-tip-dont-make-the-player-play-the-same-stuff-repeatedly/</link>
      <pubDate>Mon, 27 Nov 2006 06:04:00 +0000</pubDate>
      <guid>https://www.meandmark.com/game-design-tip-dont-make-the-player-play-the-same-stuff-repeatedly/</guid>
      <description>&lt;p&gt;By play the same stuff I mean play the same part of a level repeatedly. This problem occurs more with console games than computer games because console games have less flexibility in game saving.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Example: Metroid Prime&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;I’m going to use the game Metroid Prime to describe the problem of playing the same part of a level repeatedly for two reasons. One, it’s the game I’m currently playing so it is fresh in my mind. Two, it’s a really good game. I want to show that even good games can have minor problems.&lt;/p&gt;&#xA;&lt;p&gt;If you’re wondering why I’m playing a 4 year old game, I’ll explain it now. I got Metroid Prime about 3 years ago and I got stuck early and quit playing it. I started playing it recently because my brother needed my Playstation 2 to play DVDs because his DVD player broke and I finished my other GameCube games.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Repetition Can Turn Something Fun Into a Chore&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;Metroid Prime features a lot of boss enemies to fight, and they can be very difficult to defeat. To reach a boss involves fighting lesser enemies, running, jumping, maneuvering the morph ball through tight areas, and problem solving. Sometimes it can take 5-10 minutes of gameplay to reach the boss, and when you die, you have to go back to the last save point and play those 5-10 minutes again.&lt;/p&gt;&#xA;&lt;p&gt;Because some of the boss enemies are tough to defeat, you can die dozens of times, and replaying the same 5-10 minutes of gameplay to reach the boss gets old fast. Playing those 5-10 minutes to reach the boss is fun the first time. You’re making progress in the game and exploring new areas. Playing to reach the boss a few more times lets you perfect your technique. But after dying 25-50 times, playing the same sequence to reach the boss becomes a chore instead of being fun.&lt;/p&gt;&#xA;&lt;p&gt;&lt;span style=&#34;font-weight: bold;&#34;&gt;Solutions&lt;/span&gt;&lt;/p&gt;&#xA;&lt;p&gt;One solution to the problem of having to play the same area of a level repeatedly is to provide more save points. In the case of Metroid Prime, having a save point before reaching a boss would prevent the player from having to play the same sequence over and over again. But more save points could make the game too easy. Metroid Prime replenishes your energy (health) to 100% when you save the game.&lt;/p&gt;&#xA;&lt;p&gt;Another solution would be to continue the game where you died. In the case of Metroid Prime, being able to fight the boss right away after dying would eliminate a lot of frustration. The time spent getting to the boss could be spent on the real challenge, defeating the boss.&lt;/p&gt;&#xA;&lt;p&gt;The good news for most of the game developers reading this is you’re developing computer games, not console games. Computer games can let the player save the game whenever they want so you can keep the player from playing the same sequence over and over again.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Sometimes it Takes a While to Respond</title>
      <link>https://www.meandmark.com/sometimes-it-takes-a-while-to-respond/</link>
      <pubDate>Fri, 24 Nov 2006 20:05:00 +0000</pubDate>
      <guid>https://www.meandmark.com/sometimes-it-takes-a-while-to-respond/</guid>
      <description>&lt;p&gt;I got an email last night from a customer. He tried to download the updated version of Xcode Tools Sensei and got an error message saying the file was not found on the server. The error message is not surprising because I pulled the file from the server two months ago.&lt;/p&gt;&#xA;&lt;p&gt;I wanted people who had bought the electronic version of the book to be able to download the new version. For obvious business reasons I didn’t want the new version to be on the site permanently. My solution was to post the updated version on my site for a week and send an email to every customer who wanted to be contacted about updates. I figured a week was enough time for the customers I emailed to download the new version. I apparently was wrong.&lt;/p&gt;&#xA;&lt;p&gt;I did send the customer the new version. If any of you bought an old electronic version (before September 2006) and want the new version, send me an email and I’ll send you the new version.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Switched to Blogger</title>
      <link>https://www.meandmark.com/switched-to-blogger/</link>
      <pubDate>Thu, 23 Nov 2006 02:59:00 +0000</pubDate>
      <guid>https://www.meandmark.com/switched-to-blogger/</guid>
      <description>&lt;p&gt;&lt;span style=&#34;font-family: lucida grande;&#34;&gt;I switched&lt;span style=&#34;font-size:100%;&#34;&gt; the blog from Lulu to Blogger. The old blog did not handle large posts (over a page) well, eliminating text in the middle of the post. I did a test post of a 7 page article, and there were no problems so I decided to switch. Blogger’s spell checking is an added bonus. I included a link to the old blog entries to ease the transition.&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;font-family: lucida grande;&#34;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&#xA;</description>
    </item>
  </channel>
</rss>
