<?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 Corey Floyd on Medium]]></title>
        <description><![CDATA[Stories by Corey Floyd on Medium]]></description>
        <link>https://medium.com/@_coreyfloyd?source=rss-3607e4b9ed19------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*F6mS25XjVH65iLcm.png</url>
            <title>Stories by Corey Floyd on Medium</title>
            <link>https://medium.com/@_coreyfloyd?source=rss-3607e4b9ed19------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 00:39:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@_coreyfloyd/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[Implementing Accessibility for a Custom Control in the Wikipedia iOS App]]></title>
            <link>https://medium.com/@_coreyfloyd/implementing-accessibility-for-a-custom-control-in-the-wikipedia-ios-app-baefa2057099?source=rss-3607e4b9ed19------2</link>
            <guid isPermaLink="false">https://medium.com/p/baefa2057099</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[accessibility]]></category>
            <category><![CDATA[apple]]></category>
            <dc:creator><![CDATA[Corey Floyd]]></dc:creator>
            <pubDate>Mon, 11 Apr 2016 15:01:01 GMT</pubDate>
            <atom:updated>2016-04-11T20:23:52.366Z</atom:updated>
            <content:encoded><![CDATA[<p>Implementing Accessibility for a Custom Control in the Wikipedia iOS App</p><p>At the <a href="https://wikimediafoundation.org/wiki/Home">Wikimedia Foundation</a>, the home of <a href="https://www.wikipedia.org/">Wikipedia</a>, we care a lot about accessibility.</p><p>If you read the Foundation’s <a href="https://wikimediafoundation.org/wiki/Vision">vision statement</a>, you can see why:</p><blockquote>Imagine a world in which every single human being can freely share in the sum of all knowledge. That’s our commitment.</blockquote><p>“Every single human being” means a lot of different people: different languages, different cultures, different internet connections, and different abilities.</p><p>And for us, this means our app <strong>needs</strong> to be accessible.</p><p>In keeping with this vision, we have been doing a significant amount of Accessibility development. Even so, there are many parts of the app that still need work.</p><p>And personally, I have been learning that actually implementing Accessibility is hard™.</p><p>Apple’s platforms make it easier, but even with all the great APIs and hardware support, implementing Accessibility is not always straightforward in our brave new world of interactive, dynamic, gesture driven interfaces.</p><p>Essentially, you must design a completely new interface for your app. And, if you consider how much thought and planning that would take, you will have a pretty good idea of what implementing Accessibility really involves.</p><p>This past week, I have been implementing a simple slider for re-sizing the text of our articles (one of our most user user requested features). We decided on a design using a popover with stepped slider:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*LhQnbs184mYT0Yb3pXZDtg.png" /><figcaption>Design mockup for a text size slider</figcaption></figure><p>Unfortunately, the built-in UIKit slider does not allow discrete steps like this. (Well that’s not entirely true, there are some <a href="http://stackoverflow.com/questions/8219056/uislider-that-snaps-to-a-fixed-number-of-steps-like-text-size-in-the-ios-7-sett">methods</a> that get close)</p><p>I knew that I wanted a custom control for this feature. I know that I am about to lose a few of you here… but before I implement any custom control, I head over to <a href="https://cocoapods.org/">CocoaPods</a> to see what other developers have built. We are a pretty small team and I take the approach of “standing on the shoulders of giants” whenever it makes sense.</p><p>In this case I found a control that fit the bill, almost perfectly, and written in Swift (bonus 🎉): <a href="https://github.com/sarunw/SWStepSlider">SWStepSlider</a></p><p>Now, it isn’t a particularly popular control, but it’s fairly well written (IMHO) and simple enough, so I don’t mind taking on the burden of maintaining this control in exchange for not having to write it from scratch.</p><p>Integrating it was pretty easy as expected. it embeeded inside of a popover with no issues, and emits events correctly.</p><p>But there it has a big problem.</p><p>If you enable <a href="https://support.apple.com/en-us/HT204390">VoiceOver</a> (triple-click home like a good iOS developer), and try to use the slider — it does not work — at all. 😢</p><p>Now, I am pretty handy with accessibility labels and the like — you know the easy stuff — but I haven’t had the pleasure of implementing accessibility on a custom control. So I rolled up my sleeves and got to work…</p><p>First things first: lets check out the implementation. I won’t post the whole class inline (you can see it <a href="https://github.com/sarunw/SWStepSlider/blob/master/Pod/Classes/SWStepSlider.swift">here</a>), but lets look quickly at the key components.</p><p>First is the <strong>Slider Track</strong>:</p><pre>public override func drawRect(rect: CGRect) {<br>  super.drawRect(rect)<br> <br>  let ctx = UIGraphicsGetCurrentContext()<br> <br>  CGContextSaveGState(ctx)<br>  // Draw ticks<br>  CGContextSetFillColorWithColor(ctx, self.tickColor.CGColor)<br> <br>  for index in 0..&lt;self.numberOfSteps {<br>    let x = self.trackOffset + CGFloat(index) * self.stepWidth — 0.5 * self.tickWidth<br>    let y = self.bounds.midY — 0.5 * self.tickHeight<br> <br>    // Clip the tick<br>    let tickPath = UIBezierPath(rect: CGRect(x: x , y: y, width: self.tickWidth, height: self.tickHeight))<br> <br>    // Fill the tick<br>    CGContextAddPath(ctx, tickPath.CGPath)<br>    CGContextFillPath(ctx)<br>  }<br> CGContextRestoreGState(ctx)<br>}</pre><p>As you can see, this is pure <em>drawRect</em>. As far as UIKit is concerned, this track doesn’t “exist” — at least not as an object. So the first question is “How will model these ticks for Accessibility?”</p><p>Next lets look at the <strong>Slider Thumb</strong>:</p><pre>private func commonInit() {<br>  self.trackLayer.backgroundColor = self.trackColor.CGColor<br>  self.layer.addSublayer(trackLayer)<br> <br>  self.thumbLayer.backgroundColor = UIColor.clearColor().CGColor<br>  self.thumbLayer.fillColor = self.thumbFillColor.CGColor<br>  self.thumbLayer.strokeColor = self.thumbStrokeColor.CGColor<br>  self.thumbLayer.lineWidth = 0.5<br>  self.thumbLayer.frame = CGRect(x: 0, y: 0, width: self.thumbDimension, height: self.thumbDimension)<br>  self.thumbLayer.path = UIBezierPath(ovalInRect: self.thumbLayer.bounds).CGPath<br> <br>  // Shadow<br>  self.thumbLayer.shadowOffset = CGSize(width: 0, height: 2)<br>  self.thumbLayer.shadowColor = UIColor.blackColor().CGColor<br>  self.thumbLayer.shadowOpacity = 0.3<br>  self.thumbLayer.shadowRadius = 2<br>  self.thumbLayer.contentsScale = UIScreen.mainScreen().scale<br> <br>  self.layer.addSublayer(self.thumbLayer)<br> }</pre><p>Here, we are using a “CAShapeLayer”, a completely different drawing technology, which is still not a view, but at least it is an object. Now we have our second question, “How do I make the slider thumb visible to Accessibility?”</p><p>With these questions in hand… to the <a href="https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/iPhoneAccessibility/Making_Application_Accessible/Making_Application_Accessible.html#//apple_ref/doc/uid/TP40008785-CH102-SW10">docs</a>!</p><p>Apple’s documentation here is actually pretty good — once you figure out what we want is a “container” that holds accessibility elements. To create a container, we actually only have to implement three methods… but thats only half the story — These methods are asking for objects that implement the accessibility APIs.</p><p>At this point, there are a few paths you could take. I decided to use the purpose built <em>UIAccessibilityElement</em> to represent the slider thumb. You can set the properties of this object, and 💥 the thumb is now accessible.</p><p>One quick gotcha that is easy to breeze over in the docs is the frame property… the frame but be in the coordinates of the screen. The easiest way to do this is:</p><pre>element.accessibilityFrame = [self convertRect:textFrame toView:nil];</pre><blockquote>I picked this tip up from an article on <a href="http://useyourloaf.com/blog/voiceover-accessibility/">UseYourLoaf</a></blockquote><p>Now back to our first question: “How will model these ticks for Accessibility?”</p><p>We know we have a slider. We know we have discreet values. How do VoiceOver users usually navigate this control? A slider clearly requires a gesture for normal operation, so there must be a built in mechanism to manipulate an on screen element.</p><p>In this respect the docs fail us a little bit. The <a href="https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/iPhoneAccessibility/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008785-CH1-SW1">Accessibility Programming Guide</a> essentially mentions nothing. 😔</p><p>Going back to the headers, I poked around a bit and eventually found something interesting in the <em>UIAccessibilityElement</em> <a href="https://developer.apple.com/library/tvos/documentation/UIKit/Reference/UIAccessibilityElement_Class/index.html#//apple_ref/occ/instp/UIAccessibilityElement/accessibilityTraits">interface</a>:</p><pre>@property(nonatomic, assign) UIAccessibilityTraits accessibilityTraits</pre><p>And looking at the <a href="https://developer.apple.com/library/tvos/documentation/UIKit/Reference/UIAccessibility_Protocol/index.html#//apple_ref/doc/constant_group/Accessibility_Traits">UIAccessibilityTraits enum</a>, we find what we are looking for:</p><blockquote><strong>UIAccessibilityTraitAdjustable</strong><br>The accessibility element allows continuous adjustment through a range of values.</blockquote><blockquote>Use this trait to characterize an accessibility element that users can adjust in a continuous manner, such as a slider or a picker view. If you specify this trait on an accessibility element, you must also implement the accessibilityIncrement and accessibilityDecrement methods in the UIAccessibilityAction protocol.</blockquote><p>To be fair, this is in the docs, just not in the Accessibility Programming Guide — It is in the <a href="https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/SupportingAccessibility.html">View Controller Programming Guide</a>.</p><p>Once again, it is a matter of implementing a few informal protocol methods. But after that, supporting incrementing and decrementing is fairly easy. You can see a gif of what this looks like using VoiceOver below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*D_FhbAZAqLx9vKOHcP8y5g.gif" /><figcaption>Navigating the slider using only VoiceOver</figcaption></figure><p>You can also see the full source on <a href="https://github.com/wikimedia/SWStepSlider/blob/master/Pod/Classes/SWStepSlider.swift">Github</a> — it’s still a little rough, but it is a good demonstration on how to support custom controls.</p><blockquote>I still need to DRY the implementation up a bit and use the availability APIs since this functionality is iOS 9 only</blockquote><p>As for the Wikipedia app, this feature is still in beta, but we should be shipping an update with this enhancement soon. If you would like to join our beta group, you can drop us a line <a href="http://mobile-ios-wikipedia@wikimedia.org/?subject=Beta">here</a>. Or even better, if you want to contribute to our codebase, you can open a pull request <a href="https://github.com/wikimedia/wikipedia-ios">here</a>.</p><p>Lastly, if you want to make your own app more accessible a great place to begin is by watching this <a href="https://developer.apple.com/videos/play/wwdc2015/201/">WWDC video</a>, or if you would like help getting started, there are some <a href="http://austinseraphin.com/">great consultants</a> out there who can give you a hand.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baefa2057099" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day One 2]]></title>
            <link>https://medium.com/@_coreyfloyd/day-one-2-2e5945bde852?source=rss-3607e4b9ed19------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e5945bde852</guid>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[apple]]></category>
            <dc:creator><![CDATA[Corey Floyd]]></dc:creator>
            <pubDate>Mon, 21 Mar 2016 20:11:44 GMT</pubDate>
            <atom:updated>2016-03-23T20:03:52.264Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*_iiygEgka1tCsXhPtOk_4w.png" /></figure><p>For a long time <a href="https://dayone.me/">Day One</a> has held a spot on my iPhone home screen. It has always been a well designed app, and like many, I have aspired to keep a daily journal to hold on to those fleeting thoughts and ideas I have throughout the day.</p><p>…And, like many, I have failed to write in my journal on a daily, or even semi-consistent basis. 🙈</p><p>Day One was a great app, clearly made with great care and love. So even if I didn’t use it regularly, I kept it on my home screen and my Dock as a reminder — and sometimes that worked, but mostly it didn’t.</p><p>But all was not lost. Even if I didn’t use Day One regularly, I did find it useful for certain tasks.</p><p>Over the past few years, Day One is where I have kept my “Developer Journal”. Whenever I start a large refactor, complicated bug fix, or any nebulous development task that I may need to explain later, I open up Day One and start taking notes. I used to do this with plain text notes, but I found Day One to be the perfect place for this type of content — specific time, specific context.</p><p>This has been immensely useful for me professionally… but I wanted to get more out of this great app.</p><p>With the release of Day One 2, it finally clicked for me. The new design and features immediately drew me back in. Most notably, adding support for multiple journals really opens up possibilities and make the app feel “bigger” and more capable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*5HJXY3RWFCNydc7Q1_kqJQ.jpeg" /></figure><p>The added flexibility has allowed me to add more types of content. Basically, I’m using it more as a general purpose notebook.</p><p>I have a journal for my developer notes, and I have one for my personal thoughts. I have a journal specifically for my blog post ideas (where I am composing this right now) and I keep another for a side project.</p><p>Another great new feature is the ability to add multiple photos to each note, which has opened up even more interesting use cases (I will be writing about one of those very soon).</p><p>Did I mention there is now a channel for Day One on <a href="https://ifttt.com/day_one">IFTTT</a>?</p><p>Day One really has become my go-to place for notes of any kind now, and as a result, I am journaling more. Just having a single place to jot down my thoughts is liberating — enabling me to write more than I have in quite a few years.</p><p>Links:<br><a href="https://itunes.apple.com/us/app/day-one-2-diary-+-journal/id1044867788?mt=8">Day One for iOS</a><br><a href="https://itunes.apple.com/us/app/day-one/id1055511498?mt=12">Day One for Mac</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e5945bde852" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>