<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Cory Alder on Medium]]></title>
        <description><![CDATA[Stories by Cory Alder on Medium]]></description>
        <link>https://medium.com/@CoryDMC?source=rss-222dd1448665------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HGn2YafTB8N5BC-DYHyBeQ.jpeg</url>
            <title>Stories by Cory Alder on Medium</title>
            <link>https://medium.com/@CoryDMC?source=rss-222dd1448665------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 07:15:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@CoryDMC/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introducing Swift Modules — something new for Swift Package Manager]]></title>
            <link>https://medium.com/@CoryDMC/introducing-swift-modules-something-new-for-swift-package-manager-497f8d42157a?source=rss-222dd1448665------2</link>
            <guid isPermaLink="false">https://medium.com/p/497f8d42157a</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Cory Alder]]></dc:creator>
            <pubDate>Wed, 20 Apr 2016 10:35:13 GMT</pubDate>
            <atom:updated>2016-04-20T10:35:13.336Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://swiftmodules.com/">Swift Module</a>s is an open and searchable index of Swift Package Manager packages. Swift version 3, currently in beta, introduced the Swift Package Manager. It makes packaging and including Swift libraries incredibly easy, but discovering these modules is still somewhat problematic. Swift Modules aims to solve that problem by providing tools to help you find and integrate packages. Developers can easily add their project, and new projects show up almost instantly.</p><p>Swift Modules is built using a combination of React, Swift 2.2 and Swift 3, Elasticsearch, Ruby, and Sinatra. I plan to do a proper postmortem on the development of the first version.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=497f8d42157a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I swizzled a method in Swift, and lived to tell!]]></title>
            <link>https://medium.com/@CoryDMC/i-swizzled-a-method-in-swift-and-lived-to-tell-e841594c4c25?source=rss-222dd1448665------2</link>
            <guid isPermaLink="false">https://medium.com/p/e841594c4c25</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[objective-c]]></category>
            <dc:creator><![CDATA[Cory Alder]]></dc:creator>
            <pubDate>Wed, 27 Jan 2016 17:26:19 GMT</pubDate>
            <atom:updated>2016-01-30T21:04:27.845Z</atom:updated>
            <content:encoded><![CDATA[<p>Method swizzling is not exactly commonplace in modern coding, but it’s one of those tricks you feel pretty proud of having in your tool belt, once you’ve learned it. Generally thought of as a “dirty hack”, because it is. In fact I will propose here that the word “Swizzle” is a perfect coding onomatopoeia. It sounds as showy and as cheap as it is.</p><p>The idea with swizzling is that at runtime, you exchange the implementation of a method with another. Often you’ll have the new implementation call the old one, so you can slightly tweak the behaviour of a class, without having control of the implementation of that class. This gets messy sometimes!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*XgTUJQn9h-vezWtOExSdYg.png" /><figcaption>Swizzling in action</figcaption></figure><p>Swizzling requires the Objective-C runtime to operate, because it relies on dynamic method dispatching, so swizzling from Swift (Swiffling?) gives us pause.</p><p>If you are saying to yourself “Why! Why on earth would you…?”, that’s the right reaction to be having right now. Frankly, the cases where it should be considered are few and far between. I think I’ve found a legitimate use for swizzling, while trying to work around a limitation of the Swift @available system.</p><h4>The problem</h4><pre>extension SFSafariViewController {</pre><pre>  public override func preferredStatusBarStyle() -&gt; UIStatusBarStyle<br>  {<br>    return .LightContent<br>  }<br>}</pre><p>The above code works perfectly, by using an extension to override SFSafariViewController’s preferredStatusBarStyle method, the status bar becomes white when showing a Safari View Controller.</p><p>The issue with this arises when I try to deploy this app to iOS versions earlier than iOS 9. SFSafariViewController doesn’t exist, so targeting iOS 9 means the compiler asks me to use an @available marker to indicate that this code shouldn’t be included on earlier systems. However, marking my extension as @available only on iOS 9 conflicts with preferredStatusBarStyle’s @available marker for iOS 7 (when the method was added to UIViewController). I tried just about everything I could think of, including applying this extension to UIViewController rather than SFSafariViewController, but I was unable to work around this conflict. If you have a solution, let me know!</p><h4>Swizzle time!</h4><p>You can read the code <a href="https://gist.github.com/coryalder/6d1596606f36ac994193">I came up with</a>. The Swift syntax makes the swizzling actually quite readable.</p><ol><li>Create the method that will be the <strong>new implementation.</strong></li><li>Get the class representation of SFSafariViewController, if it exists (otherwise don’t change anything).</li><li>Get a reference to the <strong>old implementation</strong> of preferredStatusBarStyle()</li><li>Get a reference to the <strong>new implementation.</strong></li><li>Ask the Objective-C runtime to swap the <strong>new</strong> and the <strong>old</strong> implementations.</li></ol><p>And, voila! My barStyle() method gets called whenever an SFSafariViewController comes on screen. Adding a print statement to byStyle() confirms this. The status bar is white on iOS 9, and the code compiles and runs without hiccup on iOS 8.</p><p>If you’re curious about how @available normally works, I found this to be <a href="https://www.hackingwithswift.com/new-syntax-swift-2-availability-checking">a great primer</a>.</p><p>Avoid swizzling at all costs, but when you do find yourself using it make sure to brag to as many people as possible 👍</p><p>Follow me <a href="https://twitter.com/CoryDMC">on Twitter</a> for more Swift WTFs, indie developer woes, and more!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e841594c4c25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[30 days of tvOS sales numbers]]></title>
            <link>https://medium.com/@CoryDMC/30-days-of-tvos-sales-numbers-6775814adc41?source=rss-222dd1448665------2</link>
            <guid isPermaLink="false">https://medium.com/p/6775814adc41</guid>
            <category><![CDATA[apple-tv]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Cory Alder]]></dc:creator>
            <pubDate>Mon, 30 Nov 2015 17:16:11 GMT</pubDate>
            <atom:updated>2015-11-30T17:16:11.733Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-nd/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WeefB3QUJkzH2yZUAQgk5A.png" /><figcaption>The first month of GifTV sales numbers</figcaption></figure><p>It’s been exactly a month now since the launch of the 4th generation Apple TV, and the tvOS App Store. Since I was lucky enough to get one of the developer kits, I was able to have two apps ready and in the store on launch day. I wanted to take a moment to summarize the past month of sales for any developers who might be considering entering the tvOS app market.</p><h4>My Apps</h4><p>Both my apps are fairly small. For me this was more of a cautious dip of the toe into tvOS app development. The first is hardly worth talking about. It’s a $1 dice-rolling app that took me at most 5 hours to make and sold all of 4 copies before I dropped the price to free last week, after which it’s sold another 9 copies. Flying off the shelves! Because my other app, GifTV was going to be free, I wanted a paid app in the store to get a feel for the free <em>and</em> the paid market.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Hf3hhsO7Y2Sob_F1NrtFMw.jpeg" /><figcaption>Dice+, a blockbuster tvOS hit!</figcaption></figure><p>My second app, GifTV, is a small but fun gif browser that lets you click through popular gifs from Giphy, and make a sideshow of your favourites. This one took me maybe two days to put together 1.0, so the interface was nothing groundbreaking, but the app itself turned out to be quite pleasing in its simplicity. I made it free for a few reasons.</p><ol><li>The kind of user most likely to enjoy the app isn’t likely to be the paying kind.</li><li>Because I suspected that it’s the kind of “sticky” app that users keep coming back to.</li><li>And finally, because I had some ideas about monetization that I want to be free to play with down the line.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*kDDoXGUVuttHMbA9qd7-3g.jpeg" /><figcaption>GifTV’s newly added “Channels” screen</figcaption></figure><h4>Their sales</h4><p>As I mentioned, Dice+ sales have been essentially zero. An idea ahead of its time, apparently.</p><p>GifTV has sold a total of 477 copies since the store launched. There was an early peak of 38, on the first full day of sales. After launch week they quickly fell to a pitiful average of about 10/day for the rest of the month.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WeefB3QUJkzH2yZUAQgk5A.png" /><figcaption>GifTV sales for the past 30 days</figcaption></figure><p>To put these numbers in perspective, I’ve done very little in the way of marketing for GifTV. I’ve built a <a href="http://davander.com/giftv">website</a>, submitted it to <a href="https://www.producthunt.com/tech/giftv">Product Hunt</a>, and it was on Robb Lewis’ great <a href="http://atvapps.net/">Apple TV Apps</a> blog, but that’s all I’ve done to get the word out. As I’ll discuss in a moment, in some ways that’s all I <em>can</em> do to market the app.</p><h4>Discoverability</h4><p>These download numbers are depressing, and I, like most developers who have tvOS apps, <a href="http://apps.ezone.com/spin-sports-made-3-50-in-the-apple-tv-gold-rush/">blame discoverability</a>. What that means is that there are just too few ways for users to find or be shown tvOS apps. The App Store itself is quite limited. It has just a couple of pages for users to look at, and if you’re not on the featured page users are basically required to search for your app manually.</p><p>I’m actually fine with that. It’s not actually very different from the situation on the iOS App Store, althrough that store has a bit more easily visible surface area to it. The real problem is that there is no way to direct users to apps from outside the store. You can’t download tvOS apps from iTunes on your Mac, you can’t download them from the App Store on your phone, all you can do is type a search string into the search bar in the tvOS App Store. Apple themselves is using videos to market tvOS apps on their twitter feed:</p><h3>App Store Games on Twitter</h3><p>A whirlwind of insanely cool vehicular action and mayhem-Asphalt 8 Airborne is now on #AppleTV. https://amp.twimg.com/v/049db356-3245-4bb0-ad2b-b28814313fa4 ...</p><p>This is not a great scenario for developers, and greatly favours discovering content via the one place Apple makes it easy: the “Featured” tab in the tvOS app store. Not on that page? Good luck.</p><h4>Maybe Xmas?</h4><p>Despite all of this I am actually still hopeful, and still investing time into improving GifTV. Last week I just released GifTV 1.1, which adds curated gif channels like “Drake” and “Cats”. I’m doing this because I believe there is a good chance Apple TV device sales will pick up significantly over the holidays, and because I am hopeful that Apple will improve the discoverability issues slowing users down today. Also because I just want to watch gifs on my TV.</p><p>If you’re interested, you can follow me on medium or <a href="https://twitter.com/CoryDMC">Twitter</a> for updates over the holidays. And don’t forget to check out GifTV, just search “gi” in the tvOS App Store, and click on the purple icon!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*ztObjWF0KC6AGKM88xek3A.png" /><figcaption>GifTV 1.1 — Free on the tvOS App Store</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6775814adc41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Rivet’s fuzzy string matching autocomplete]]></title>
            <link>https://medium.com/@CoryDMC/building-rivet-s-fuzzy-string-matching-autocomplete-4d51105e145b?source=rss-222dd1448665------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d51105e145b</guid>
            <category><![CDATA[user-interface]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Cory Alder]]></dc:creator>
            <pubDate>Thu, 19 Nov 2015 01:27:26 GMT</pubDate>
            <atom:updated>2015-11-19T08:49:23.173Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc-nd/4.0/</cc:license>
            <content:encoded><![CDATA[<p>My app, <a href="http://rivet.link/">Rivet</a>, has this great little feature that I’m quite proud of. Rivet allows you to quickly add your affiliate code to Amazon and iTunes links before sharing products on social media. One of the things you can do as part of the iTunes affiliate program, is set a “campaign” identfier on links. These identifiers then show up on your affiliate dashboard, so you can tell what links were most clicked on, or led to the most affiliate revenue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*1kJIc5iaU25_UJPV-fBICA.png" /><figcaption>Some per-campeign stats from my iTunes affiliate account</figcaption></figure><p>I wanted to make it exremely easy to set a unique campagin identfier, as well as to re-use previous identifiers, and to offer up some sensible suggestions for this product, all at the same time. The interface I landed on was a text entry field with an autocompletion list.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F146216766&amp;url=https%3A%2F%2Fvimeo.com%2F146216766&amp;image=http%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F544612584_640.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=vimeo" width="720" height="1280" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c85fefb512dfdf937f27531012d2ce9/href">https://medium.com/media/7c85fefb512dfdf937f27531012d2ce9/href</a></iframe><p>This list contains some generic defaults like “twitter” and “facebook”, every previously used identifier, and some suggestions generated from the individual product we’re sharing’s metadata.</p><p>Without some powerful filtering, that list is basically an overload of options. It contains an ever-growing list of mostly irrelevent strings. I spend quite some time refining the fuzzy matching used, and while it’s not perfect I am pretty happy with it.</p><h4>Levenshtein distance</h4><p>When you start googling for information about fuzzy string matching, you’re almost gauranteed to come across mention of Levenshtein distance.</p><p>By it’s other name, <a href="https://en.wikipedia.org/wiki/Levenshtein_distance">Levenshtein distance</a> is “edit distance”. The tl;dr is that it’s the number of changes needed to make one string equal to another string. So the string “cat” and the string “bat” have a Levenshtein distance of 1, and “dog” and “god” have a distance of 2.</p><p>While it sounds useful, when directly applied to fuzzy-matching autocomplete, this doesn’t work very well. The string “tw” and the string “twitter” are VERY far apart, while the string “hi” is quite close, but a bad autocomplete match.</p><p>My solution to this was actually quite simple, before computing the edit distance I trim the candidate string to the same length as the input, and THEN rank it. If you type “tw”, “twitter” is trimmed down to “tw” and is a perfect match while “tumblr” is a distance of 1 away.</p><p>This implementation isn’t perfect as you can see if you play with it for a bit, and I don’t want to pretend it is. The quirk of Levenshtein distance as a matching system aside, there is no caching of scores limits it to smaller data sets… thousands perhaps?</p><p>If this sounds like something useful to you, I’ve extracted the relevant <a href="https://gist.github.com/coryalder/573116711a2e03539f8c">completion filtering code</a>, and earlier this year I open-sourced my <a href="https://github.com/coryalder/LevenshteinSwift">Levenshtein distance Swift library</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d51105e145b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>