<?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 Alex Türk on Medium]]></title>
        <description><![CDATA[Stories by Alex Türk on Medium]]></description>
        <link>https://medium.com/@fruitcoder?source=rss-e74b30f9f423------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*9WYwlBREhgstBCR5O8f4xw.jpeg</url>
            <title>Stories by Alex Türk on Medium</title>
            <link>https://medium.com/@fruitcoder?source=rss-e74b30f9f423------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 19:46:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fruitcoder/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[Die ARD Mediathek auf der Apple Vision Pro]]></title>
            <link>https://medium.com/br-next/die-ard-mediathek-auf-der-apple-vision-pro-2c3eb60a166b?source=rss-e74b30f9f423------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c3eb60a166b</guid>
            <category><![CDATA[xr]]></category>
            <category><![CDATA[spatial-computing]]></category>
            <category><![CDATA[mediathek]]></category>
            <category><![CDATA[apple-vision-pro]]></category>
            <category><![CDATA[ar]]></category>
            <dc:creator><![CDATA[Alex Türk]]></dc:creator>
            <pubDate>Tue, 06 Aug 2024 06:26:28 GMT</pubDate>
            <atom:updated>2024-08-06T06:26:28.931Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DuXEMWGFTnsNSYtbre0r4w.png" /></figure><h3>ARD Mediathek goes Apple Vision Pro</h3><p>Seit Mitte Juli ist der erste räumliche Computer von Apple <a href="https://www.br.de/nachrichten/netzwelt/apple-vision-pro-verkaufsstart-in-deutschland,UIIcsNL">auf dem deutschen Markt</a> verfügbar. Apple-Enthusiasten feierten sie bei der Markteinführung in den USA — tatsächlich setzt die Apple Vision Pro Maßstäbe im Bereich Augmented und Mixed Reality.</p><p>Mit hochauflösenden Displays, präzisem Augentracking und nahtloser Integration in das Apple-Ökosystem bietet sie ein Erlebnis, das auch für Nutzer:innen der ARD Mediathek in der Zukunft Standard sein könnte.</p><p>Deshalb brachten wir die ARD Mediathek mit all ihren Funktionalitäten gleich zum Deutschlandlaunch des neuen Hightech-Gadget an den Start.</p><h4>So haben wir die ARD Mediathek auf die Apple Vision Pro gebracht</h4><p>Wir haben in vielen Iterationen die Konzepte der bestehenden iOS und tvOS Apps für eine optimale Nutzung auf der neuen Plattform vereint.</p><p>Für uns war von Anfang an klar, dass wir mit der iPadOS-Kompatibilitätsversion unserem Anspruch als “good citizen” auf visionOS nicht gerecht werden können und stattdessen auf eine native Umsetzung setzen werden.</p><p>Bis zum Verkaufsstart in den USA im Februar war unklar, wie 3rd-Party-Apps sich auf visionOS präsentieren. Für uns war insbesondere spannend, wie viel eigenes Branding sie über die Glasoptik stülpen und ob Streaming-Apps einen eigenen Player verwenden oder sich (wie in den meisten Fällen auf tvOS) auf den Systemplayer stützen.</p><p>Unsere erste Version mit durchsichtigem Fensterhintergrund haben wir nach der Veröffentlichung der Apps von <a href="https://www.google.com/url?sa=t&amp;source=web&amp;rct=j&amp;opi=89978449&amp;url=https://apps.apple.com/us/app/disney/id1446075923&amp;ved=2ahUKEwiGqdTKoamHAxUpSPEDHd1-B1IQFnoECAwQAQ&amp;usg=AOvVaw2qi5-QBSOklHM3r0iqq1N5">Disney+</a> und <a href="https://www.google.com/url?sa=t&amp;source=web&amp;rct=j&amp;opi=89978449&amp;url=https://apps.apple.com/us/app/max-stream-hbo-tv-movies/id1666653815&amp;ved=2ahUKEwiP9NCnoamHAxUQBdsEHTiJCLcQFnoECBQQAQ&amp;usg=AOvVaw25UuBQj5E7rtFJx1MRcmBz">Max</a> schnell verworfen und sind so zum klassischen dunkelblauen Design der ARD Mediathek zurückgekehrt.</p><p>So bleibt die App auf allen Plattformen wiedererkennbar, was den Nutzer:innen eine vertraute und konsistente Erfahrung bietet — unabhängig davon, welches Gerät sie verwenden.</p><p>Bei der UI (User Experience) des Players haben wir uns für den Standardplayer entschieden, da dieser sich vor allem im Vollbildmodus optimal an die Umgebung anpasst und in der kommenden visionOS noch viele weitere Vorteile bietet. Funktionen wie Sprungmarken und das MultiStream-Feature haben wir über die Overlays des Players gelöst.</p><figure><img alt="Es öffnen sich abwechseln ein Overlay mit Metadaten zum Livestream und einem Slider mit Sprungmarken" src="https://cdn-images-1.medium.com/max/1024/1*Q-xO7ql0J6Yt8Nq8hdd1gQ.gif" /></figure><h4>Das kann die ARD Mediathek auf der Apple Vision Pro und so kann man sie nutzen</h4><p>Wer die ARD Mediathek bereits auf anderen Geräten nutzt, wird sich sofort zuhause fühlen, wenn die App zum ersten Mal in den eigenen vier Wänden schwebt.</p><p>Wie auf tvOS findet man in der Hauptnavigation, die auf der Plattform in einer Seitenleiste links vom Fenster dargestellt wird, neben den Standardtabs auch den Einstieg zur Suche und zum „Meins“-Bereich.</p><figure><img alt="Video, das die verschiedenen Haupnavigationspunkte Start, Live, Programm, Sender, Suche und Meine ARD am linken Rand des Fensters anzeigt" src="https://cdn-images-1.medium.com/max/1024/1*n2o-Wps-5a_1chelYQaZ1A.gif" /></figure><p>Dort nutzen wir zusätzliche grafische Elemente, um die Navigation innerhalb dieser Seiten plattformspezifisch zu gestalten und eine intuitive Bedienung zu gewährleisten.</p><figure><img alt="Darstellung der Navigationspunkte Merkliste, Weiterschauen, Sendungen und Downloads im Meins-Bereich am unteren Ende des Fensters" src="https://cdn-images-1.medium.com/max/1024/1*BvBXh3n_aaG8YG80h2fdHQ.gif" /></figure><p>Alle Funktionen wie Live-Übertragungen, Programmübersicht, der geräteübergreifende Sync und Downloads funktionieren wie gewohnt. Trotzdem fühlt sich die Nutzung durch die neue Art der Interaktion frisch, immersiv und greifbar an.</p><h4>What’s Next?</h4><p>Wir sind froh, dass wir so früh auf Apple’s neuer Plattform vertreten sind und die Weiterentwicklung hautnah mitgestalten können.</p><p>Auch wenn es momentan noch keine exklusiven Features für die Apple Vision Pro in der ARD Mediathek gibt, sind wir jetzt in einer optimalen Position diese jederzeit einzubauen und in der Zukunft mit speziell produzierten 3D Filmen oder interaktiven Dokumentationen zu experimentieren.</p><p>Die nächste Version von visionOS kommt bereits im September — dafür haben wir schon einige Prototypen für die anstehenden Neuerungen, die die App aufs nächste Level heben wird.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c3eb60a166b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/br-next/die-ard-mediathek-auf-der-apple-vision-pro-2c3eb60a166b">Die ARD Mediathek auf der Apple Vision Pro</a> was originally published in <a href="https://medium.com/br-next">BR Next</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open sourcing our BR Radio PlayButton]]></title>
            <link>https://medium.com/br-next/open-sourcing-our-br-radio-playbutton-5f0b14bb7e01?source=rss-e74b30f9f423------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f0b14bb7e01</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[core-animation]]></category>
            <dc:creator><![CDATA[Alex Türk]]></dc:creator>
            <pubDate>Tue, 01 Mar 2022 08:59:39 GMT</pubDate>
            <atom:updated>2022-03-01T08:59:39.761Z</atom:updated>
            <content:encoded><![CDATA[<h4>Coding</h4><h3>Open Sourcing the BR Radio Play Button</h3><h4>How we leveraged Core Animation to build a joyful interaction for our users</h4><p><strong>All too often we concern ourselves with adding more and more features to apps that we forget it is the user experience, interactions and the general look and feel of an app that make it stand out from the crowd. In this post, we focus on a small component that all users of audio apps take for granted: the play button. Join us on our journey of transforming a mere touch target into a fun button that sparks joy in our users!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*XowTeLoiHkvG4N1h3-zwnQ.png" /></figure><p><strong>TL;DR </strong>Check out the <a href="https://github.com/public-value-tech/play-button">code</a></p><p>Since the very early stages of development we knew that our play button would be the key user interaction in our app and we would spare no efforts (some might argue we spent too much time 😅) for the animations to be</p><ul><li>fun and playful</li><li>interactive</li><li>interruptible</li><li>lightweight</li></ul><p>In our case lightweight meant that even though the animations were important to us we didn’t want to include an entire animation engine like <a href="https://github.com/MengTo/Spring">Spring</a>, <a href="https://github.com/facebookarchive/pop">Pop</a>, <a href="https://github.com/b3ll/Motion">Motion</a> or <a href="https://github.com/airbnb/lottie-ios">Lottie</a>.</p><p>To implement interruptibility we thought about using UIViewPropertyAnimator but unfortunately we can’t animate <a href="https://developer.apple.com/library/archive/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html">paths</a>. So we ended up using Core Animation directly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YEbSGYclcdJF90xpCw4ODg.gif" /><figcaption>Slightly slowed down looping animation of play button between play, buffering, stop and pause</figcaption></figure><h4>Once upon a time</h4><p>To understand what made the play button the component it is today it makes sense to illustrate all iterations and design changes it went through.</p><p>For the first release of our radio application we haven’t had a rewind feature yet so the play button actually just had two states: <em>playing</em> was represented by an equalizer keyframe animation</p><h3>Alex Türk on Twitter: &quot;Play button animation I have been making over the Easter holidays 🐰pure core animation #swiftlang #iosdev #animation pic.twitter.com/DEDc6IqK36 / Twitter&quot;</h3><p>Play button animation I have been making over the Easter holidays 🐰pure core animation #swiftlang #iosdev #animation pic.twitter.com/DEDc6IqK36</p><p>and <em>not playing </em>by the typical triangle. We used five shape layers. One was for the triangle path morphing into the horizontal bar and the remaining four were revealed when the horizontal bar shrinked to a simple circle on the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ab4F2cPK09x-7JfiA-6QWA.jpeg" /><figcaption>Early sketches for the initial equalizer animation</figcaption></figure><p>The problem we already had to solve back then was to animate a triangle with rounded corners into the horizontal bar which is what you can see here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*m9mHNBhKiEzhYJ3gWDRUFA.gif" /><figcaption>Looping animation of triangle with rounded corners to bar with rounded endings</figcaption></figure><p>This problem was actually way harder to solve than we initially thought so we’ll give you and in-detail look into the process we went through.</p><h4>Triangle to horizontal bar (naive way)</h4><p>If you think this looks super easy let me welcome you to <em>Underestimation Valley</em> — a place where hopes and dreams get crushed and where you’ll inevitably spent way more time than you anticipated. A naive (aka our first) approach would be something like the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b627d04f97b8b6ab98bdf9b610b23402/href">https://medium.com/media/b627d04f97b8b6ab98bdf9b610b23402/href</a></iframe><p>Well, this is what you get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K_roXRNPvHkTWJZ2k0v4RA.gif" /><figcaption>Mismatching morph animation from triangle to horizontal bar</figcaption></figure><p>Beautiful, isn’t it? Of course that’s not what we wanted. So what’s going on here? The documentation of for <a href="https://developer.apple.com/documentation/quartzcore/cashapelayer/1521904-path">CAShapeLayer’s </a><a href="https://developer.apple.com/documentation/quartzcore/cashapelayer/1521904-path">path property</a> states</p><blockquote>Paths will interpolate as a linear blend of the “on-line” points; “off-line” points may be interpolated non-linearly (e.g. to preserve continuity of the curve’s derivative). If the two paths have a different number of control points or segments the results are undefined […]</blockquote><p>It’s important to note that this does not refer to the explicit instructions we use to construct the CGPath but rather the elements of the resulting “graphics path” that can be inspected using the <a href="https://developer.apple.com/documentation/coregraphics/cgpath/1411203-apply">apply(info:function:)</a> iterator. Using a little helper function</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31eed0619e9e9d2455fedc5bc654a3d5/href">https://medium.com/media/31eed0619e9e9d2455fedc5bc654a3d5/href</a></iframe><p>we can see that printing the trianglePath returns something like this (values are rounded):</p><pre><strong>1. moveTo (300, 200)<br>2. lineTo (300, 268)<br>3. curveTo (320, 288), control points [(300, 279), (309, 288)]<br>4. curveTo (329, 286), control points [(323, 288), (326, 287)]<br>5. lineTo (464, 218)<br>6. curveTo (473, 191), control points [(474, 213), (478, 201)]<br>7. curveTo (464, 182), control points [(471, 187), (468, 184)]<br>8. lineTo (329, 114)<br>9. curveTo (302, 123), control points [(319, 109), (307, 113)]<br>10. curveTo (300, 132), control points [(300, 126), (300, 129)]<br>11. close</strong></pre><p>This loosely resembles our instructions for CGMutablePath but there is definitely no one-to-one mapping.</p><p>Further, the CGPathElementType only has five different operations and everything that isn’t a straight line gets converted to a quadratic or cubic Bézier curve.</p><p>In our case an arc was converted to two cubic curves and an addLineToPoint instruction (which was implicitly coming from our next arc). Compared to the horizontal bar the triangle has one more on-line point which explains the undefined behavior during the animation.</p><h4>Triangle to horizontal bar (intermediate)</h4><p>Why are we going into so much detail about this? We cannot directly manipulate the path element types so we used the debug description to try different ways of composing our triangle and bar paths in order for the interpolation to work correctly.</p><p>After a lot of trial and error (and hot beverages containing caffeine ☕️) we figured out that we had to divide the triangle’s right tip (arc) in halves to come up with equal numbers of path elements. The following sketch illustrates the different Core Graphic instructions of the the shapes:</p><figure><img alt="A visualization of the CGPath instructions to create the triangle and horizontal bar shape with numbers for their order." src="https://cdn-images-1.medium.com/max/1024/1*maUN7LMffOLrRj4A4Zze-w.png" /><figcaption>The different implicit and explicit CGPath instructions to create the triangle and horizontal bar shape.</figcaption></figure><p>For the triangle we simply use CGMutablePath’s addArc(center:radius:startAngle:endAngle:clockwise:) function to draw three arcs while the second one is divided in halve. This implicitly creates the straight lines in between (orange).</p><p>We implemented a generic function that takes the corner points of a strictly convex polygon and a corner radius as input and produces a path of a rounded polygon that lies within the polygon (see <a href="https://gist.github.com/fruitcoder/45042cd25d8711f17c911d1a0269e0d5#file-playbuttonpost_roundenpolygon-swift">gist</a>).</p><p>For the horizontal bar the instructions seem a little weird but it will make sense soon. It’s basically also just a series of arcs with implicit lines that connect them.</p><p>Notice that at point 2 and 6 we “add a line” to the same point that we’re already at. Again, it will make sense soon, but first let’s look at the result or checkout <a href="https://gist.github.com/fruitcoder/b4c88e20db7033fac756a3fc64e2e630#file-playbuttonpost_triangletobarintermediate-playground">the playground</a> yourself:</p><figure><img alt="Looping animation from rounded triangle to horizontal bar" src="https://cdn-images-1.medium.com/max/1024/1*GBsDJw_zIGnfGrGrDmQ5Kg.gif" /><figcaption>Better solution for animating triangle to horizontal bar</figcaption></figure><p>This already looks way better than our first attempt but if you squint closely you might see some inconsistencies around the end of the top left arc and the (not so straight) line on the left. Let’s use our debug description again to find out the concrete graphics instructions that result from our path descriptions:</p><pre><strong>Triangle:<br>1. moveTo (300, 132)<br>2. curveTo (320, 112), control points [(300, 121), (309, 112)]<br>3. curveTo (329, 114), control points [(323, 112), (326, 113)]<br>4. lineTo (464, 181)<br>5. curveTo (475, 199), control points [(471, 184), (475, 191)]<br>6. lineTo (475, 199)<br>7. curveTo (464, 217), control points [(475, 207), (471, 214)]<br>8. lineTo (329, 285)<br>9. curveTo (302, 276), control points [(319, 290), (307, 286)]<br>10. curveTo (300, 267), control points [(301, 273), (300, 270)]<br>11. close</strong></pre><pre><strong>Bar:<br>1. moveTo (300, 200)<br>2. curveTo (325, 175), control points [(300, 186), (311, 175)]<br>3. lineTo (325, 175)<br>4. lineTo (475, 175)<br>5. curveTo (500, 200), control points [(489, 175), (500, 186)]<br>6. lineTo (500, 200)<br>7. curveTo (475, 225), control points [(500, 214), (489, 225)]<br>8. lineTo (325, 225)<br>9. curveTo (300, 200), control points [(311, 225), (300, 214)]<br>10. lineTo (300, 200)<br>11. close</strong></pre><p>We meet the most important requirement for the path animation which is an equal number of on-line points (this excludes the control points of the cubic curves).</p><p>If we examine a visualization of the points we can not only understand where the imperfections are coming from but also why we added helper points at certain segments.</p><figure><img alt="All the on-line and off-line (control) points for triangle and horizontal bar with different point colors to indicate duplicate points. This is the graphic for the intermediate solution." src="https://cdn-images-1.medium.com/max/1024/1*9h-GXoc_igEER5U1RepGmg.png" /><figcaption>On-line points and control points of triangle and horizontal bar paths</figcaption></figure><p>Our triangle’s first arc is <a href="https://developer.apple.com/documentation/coregraphics/cgmutablepath/2427140-addarc">approximated by two cubic Bézier curves</a> since it takes one curve per 90° and our arc is more than 90° so we add a helper point after the bar’s first arc (which is exactly 90° so only adds one curve) to balance out the number of on-line points.</p><p>This artificial over-specification of a path is a general strategy to help guide morph animations.</p><p>The triangle’s tip has two points since we split the arc in halve and the addArc function of the second halve adds a line between the current point (tip) and the beginning of the arc (again the tip) even though it’s the same point:</p><blockquote>If the specified path already contains a subpath, Core Graphics implicitly adds a line connecting the subpath’s current point to the beginning of the arc</blockquote><p>So we have to follow suit and add a helper point in the horizontal bar path as well. One last helper point is added at the green circle which represents three points since it’s also the starting point.</p><p><strong>Issues: </strong>The first imperfection on the top left results from interpolating the two points of the smaller curve into a single point. It would be better if the curve would be interpolated to a straight line.</p><p>The second deviation from an optimal interpolation is basically caused by the same thing with some additional hickups because the paths end there.</p><h4>Triangle to horizontal bar (manual bezier)</h4><p>From the last image it seems quite obvious how to fix the issues. We “just” need the points to look like this:</p><figure><img alt="All the on-line and off-line (control) points for triangle and horizontal bar with different point colors to indicate duplicate points. This is the graphic for the manual bezier solution." src="https://cdn-images-1.medium.com/max/1022/1*BhLYMPk7QNd5XyMvkixsSQ.png" /><figcaption>On-line points and control points of triangle and horizontal bar paths (optimized version)</figcaption></figure><p>The basic idea is to add the extra point after the first and before the last quarter arc of the horizontal bar with a certain distance (d) on the horizontal line.</p><p>Just to pick a value we used the same horizontal distance that the second and third on-line points of the triangle have to each other (d). If our button shapes had fixed width, corner radii, bar height etc. we could just note the values to construct the paths and be done with it.</p><p>But we want to be able to parameterize some of those values later to play with different designs (no pun intended).</p><p>To create a cubic Bézier curve for a CGPath we can use the <a href="https://developer.apple.com/documentation/coregraphics/cgmutablepath/2427158-addcurve">addCurve</a> function on its mutable counterpart. The input for this function can be calculated on the basis of what we previously did to implement <a href="https://gist.github.com/fruitcoder/b4c88e20db7033fac756a3fc64e2e630#file-playbuttonpost_triangletobarintermediate-playground">createRoundedShapeWithControlPoints</a> in combination with some help from <a href="https://pomax.github.io/bezierinfo/#circles_cubic">the internet</a> to approximate arcs using cubic Béziers.</p><p>Again, the resulting function would be too long to post but you can just checkout the gist <a href="https://gist.github.com/fruitcoder/9b290a1b35990618a1f38c096cfdd4da#file-playbuttonpost_triangletobarmanualbezier-playground">here</a>. It will render the animation we were looking for without any glitches and everyone comparing it with the previous one will agree that the effort was <strong>toootally</strong> worth it (just a pinch of sarcasm here).</p><figure><img alt="Looping animation from rounded triangle to horizontal bar" src="https://cdn-images-1.medium.com/max/1024/1*40ApgR2I9PE10iTfY8C-fQ.gif" /><figcaption>Optimized solution for animating triangle to horizontal bar</figcaption></figure><p>One thing to note is that we didn’t use transforms to offset and rotate the calculated points because that led to different results from the cubic Bézier points that Core Graphics had.</p><p>This way, when we look at the final path instructions we can see some familiar points (they are rounded but the floating point values are exactly the same):</p><pre><strong>Triangle:<br>1. moveTo (300, 132)<br>2. curveTo (320, 112), control points [(300, 121), (309, 112)]<br>3. curveTo (329, 114), control points [(323, 112), (326, 113)]<br>4. lineTo (464, 181)<br>5. curveTo (475, 199), control points [(471, 184), (475, 191)]<br>6. lineTo (475, 199)<br>7. curveTo (464, 217), control points [(475, 207), (471, 214)]<br>8. lineTo (329, 285)<br>9. curveTo (320, 287), control points [(326, 286), (323, 287)]<br>10. curveTo (300, 267), control points [(309, 287), (300, 278)]<br>11. close</strong></pre><pre><strong>Bar:<br>1. moveTo (300, 200)<br>2. curveTo (325, 175), control points [(300, 186), (311, 175)]<br>3. lineTo (334, 175)<br>4. lineTo (475, 175)<br>5. curveTo (500, 200), control points [(489, 175), (500, 186)]<br>6. lineTo (500, 200)<br>7. curveTo (475, 225), control points [(500, 214), (489, 225)]<br>8. lineTo (334, 225)<br>9. lineTo (325, 225)<br>10. curveTo (300, 200), control points [(311, 225), (300, 214)]<br>11. close</strong></pre><h4>More than just play and pause</h4><p>As the feature set of BR Radio advanced so did the complexity of our play button. For a short period of time we actually had two buttons:</p><p>a <em>PlayStopButton</em> that could only render a triangle or a rounded rect which we used for the overview page and a <em>PlayButton </em>with <em>play</em>, <em>pause</em> and <em>buffering </em>states<em> </em>used in the sticky and fullscreen player.</p><p>During that time our player could already seek back up to five hours in the livestream.</p><p>After a lot of feedback from our users we couldn’t wave the “It’s not a bug it’s a feature”-flag anymore so we decided to change how our player behaves when it’s at the live edge.</p><p>Instead of the pause button we now display the stop button in the sticky and fullscreen player so subsequent play actions would play from the live position instead of the previously paused position (the old behavior can still be restored in settings).</p><p>When the player is not live (either because the user manually seeked back or playback was initiated for a past program) we still display the pause button to indicate that playback will be resumed where the user left off.</p><p>Instead of adding 2 buttons on top of each other and syncing their visibility/states with the player we decided to rewrite the two into a single play button component.</p><p>This meant we had to merge all of our states and animations and extend them to incorporate previously unnecessary transitions from states like stop to buffering.</p><h4>Keeping track of state</h4><p>To reach our goal of interruptibility we have to keep track of the currently executed animation step or the idle state so that we can infer how to animate back when an animation is in-flight. We used a bunch of enums to model those transient and idle states:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e664ed1b85147419b41495be30db18f/href">https://medium.com/media/9e664ed1b85147419b41495be30db18f/href</a></iframe><p>The *Idle cases are sort of final states meaning that the button is not animating when in those states. Other cases describe the transition from one to another state.</p><p>It’s no coincidence that many of the enums carry the *ToBar or BarTo* in their names. All paths use the horizontal bar as an intermediate state before animating to the target paths.</p><p>In the following diagram you can see all possible state transitions. If an arrow emits from an inner state it means that it can only come from that state. If an arrow emits from a state cluster it means the transition can come from any state within that cluster.</p><figure><img alt="A diagram that shows all animation states and arrows connecting possible transitions." src="https://cdn-images-1.medium.com/max/1024/1*K78ip5vIzOAE4HPynHHToA.png" /><figcaption>All possible transitions of animation states.</figcaption></figure><h4>Grouping animations</h4><p>Another abstraction is to group animations that run simultaneously while transitioning from one animation state to another. Basically, there are always two shape layers animated to the same path (triangle, square, horizontal bar) except when the vertical bar is split to show the pause state.</p><p>Also, changing the background color runs alongside the path animations.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dcf5186d92488d86af82cb4bc7200222/href">https://medium.com/media/dcf5186d92488d86af82cb4bc7200222/href</a></iframe><ol><li>An array of animations with the target layer they should be applied to</li><li>The resulting AnimationState after the animation finished successfully</li><li>We add the animation to the corresponding layer (the buffering animation is a repeating keyframe animation).</li></ol><p>In the addBasicAnimationSyncingModelWithPresentationLayer function we check whether there is an ongoing animation for the keypath and if so we set the given animation’s fromValue to the presentation layer’s current value. Then, we set the model layer to the final value (toValue) and add the animation to the layer.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cb6ee99052d51fd2f0714304619f4b8d/href">https://medium.com/media/cb6ee99052d51fd2f0714304619f4b8d/href</a></iframe><h4>Bringing it all together</h4><p>Now everything that’s left is assembling the parts we’ve talked about so far. Whenever you set the play button’s mode with the animated parameter set to true the following sequence of events occur:</p><ul><li>we call the corresponding animateToPause, animatedToStop, animatedToPlay or animateToBuffering functions</li><li>within those functions we check whether we are either already in the requested state or are currently animating “in the right direction” (i.e. if we want to animate to the play mode we don’t have to do anything if we’re already animating from the horizontal bar to the triangle)</li><li>if the previous cases don’t apply, we have to kick off an animation group. Depending on the current animation state we call the nextAnimation(baseOn:) function with the state from the opposite direction to get the animation group to run next and assign its result state to the currentAnimationState property. <strong>For example</strong>: We want to animate to the .pause mode but are currently animating from pause to the vertical bar (→ currentAnimationState = .pauseToBar(.barsMerge)). So we get the next animation group based on the .barToPause(.barRotateVertical) state because this is the idle state that precedes the splitting state. The nextAnimation function will return a group that splits the currently stacked shape layers by animating one to the left and one to the right. The resulting state is .barToPause(.barSplit)</li><li>whenever an animation (state) finishes successfully, we get the next animation group based on the current state and run it. This continues until we’re in an idle state (or the buffering state)</li></ul><p>So every animation is split into individual steps and run in sequence. Admittedly, this leads to big switch statements but the code is easier to reason about than if we combined seemingly redundant states (trust us, we tried 😅).</p><h4>Remaining path animations</h4><p>The remaining animations (buffering/stop) all build on the same principles explained before. We over-specify the points of the squircle and the circle that the horizontal bar animates to and from during buffering. The points look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DxNCw1W8uLfz0ubKK5urxg.png" /><figcaption>Control points of the remaining shapes.</figcaption></figure><p>For the squircle we use the same d we calculated for the triangle.</p><h4>Finishing touches</h4><p>In the end, we have spent some time on fixing edge case bugs and polishing the look and feel including</p><ul><li>adding a rounded circle background + <a href="https://medium.com/@erqiudao/the-play-button-is-not-optical-alignment-4cea11bda175">correctly centering the triangle</a></li><li>restarting the buffering animation when returning to the application</li><li>styling for highlighted and disabled state</li><li>pointer interactions, hover gestures</li><li>tint and background color animation for different modes</li><li>3D interpolation effect for tvOS</li><li>adding documentation using swift-docc and swift-docc-render</li></ul><h4>Try it out, it’s open source</h4><p>If you have any questions open a <a href="https://github.com/public-value-tech/play-button/discussions/categories/q-a">discussion</a> on GitHub, <a href="https://github.com/public-value-tech/play-button/issues/new/choose">file bugs </a>as an issue or reach out to us <a href="https://twitter.com/fruitcoder">directly</a>. We’d love to hear your feedback!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f0b14bb7e01" width="1" height="1" alt=""><hr><p><a href="https://medium.com/br-next/open-sourcing-our-br-radio-playbutton-5f0b14bb7e01">Open sourcing our BR Radio PlayButton</a> was originally published in <a href="https://medium.com/br-next">BR Next</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Launching BR Radio on CarPlay Audio]]></title>
            <link>https://medium.com/br-next/launching-br-radio-on-carplay-audio-8baab824b932?source=rss-e74b30f9f423------2</link>
            <guid isPermaLink="false">https://medium.com/p/8baab824b932</guid>
            <category><![CDATA[radio]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[carplay]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Alex Türk]]></dc:creator>
            <pubDate>Thu, 21 Jan 2021 07:53:54 GMT</pubDate>
            <atom:updated>2024-08-12T17:20:14.874Z</atom:updated>
            <content:encoded><![CDATA[<h4>How we brought the rewind feature into our users’ cars</h4><p><strong>BR Radio is the new mobile radio application of BR. This post will outline how we approached adding iOS 14 CarPlay support, e.g. the feature to rewind the live program. Here’s how our developers made it work.</strong></p><figure><img alt="Car radio showing the BR Radio home screen (station selection)" src="https://cdn-images-1.medium.com/max/800/1*iWIUs6nSIgZZLFUY6IdA2Q.png" /><figcaption>BR Radio Home Screen (station selection)</figcaption></figure><p><strong>Update 21–11–30</strong>: We made some changes to handling remote images for CPListItems (<a href="#e864">See relevant section</a>)</p><p><strong>Table of contents</strong></p><ol><li><a href="#8094">Embracing our rewind feature with the new CarPlay</a></li><li><a href="#a275">The bumpy road of entitlements</a></li><li><a href="#fd31">Show progress and current event interval in station selection</a></li><li><a href="#e864">Adding carPlayImage for correct remote image scaling</a></li><li><a href="#9880">Handle regional stream selection</a></li><li><a href="#2506">Initiate Playback</a></li><li><a href="#47fe">Adding custom now playing buttons</a></li><li><a href="#e2e7">Using the “AlbumArtistButton”</a></li><li><a href="#0910">Using the Up Next Button</a></li><li><a href="#fbdf">Handle tapping the image row title</a></li><li><a href="#e127">Handle tapping the list image row item</a></li><li><a href="#3a9c">Fixing non square images</a></li><li><a href="#ce7e">Alert helper</a></li></ol><p>In our app users can listen to all their favorite radio stations in one place, access the program schedule, the broadcasts, the title information and rewind the live program. In the following article you can read why we made certain design decisions and how we implemented some of the features while highlighting the things we have learned along the way.</p><p>When we were watching the WWDC session “<a href="https://developer.apple.com/wwdc20/10635">Accelerate your app with CarPlay</a>” we got pretty excited about the new features for CarPlay Audio. We have already implemented basic CarPlay support using the MPPlayableContentDelegate/MPPlayableContentDataSource from the MediaPlayer framework but the dedicated CarPlay framework is a vast improvement. Previously, you were required to declare the entire app structure upfront with nested MPContentItems which lead to a lot of index path juggling and made any non-trivial navigation a pain to develop and maintain.</p><p>Now, CarPlay provides a view-controller-like navigation api with functions like pushTemplate and presentTemplate. This way, every template (aka view controller) is self contained and only responsible for its own content.</p><p>Even more appealing is the fact that there are now way more customization options in the now playing screen (called CPNowPlayingTemplate). While pre iOS 14 CarPlay basically just mirrored what iOS was showing in the now playing notification center, you can now have custom playback controls and present new templates when the &quot;album/artist title&quot; or the &quot;Up Next&quot; buttons are tapped.</p><figure><img alt="Screenshot of the now playing screen highlighting different components (emphasizing new elements)" src="https://cdn-images-1.medium.com/max/1024/1*1l78HzMnivIsyEq4inOaxQ.png" /><figcaption>Different components in now playing screen</figcaption></figure><p>CarPlay also gives us some new templates like alerts and grids and a new CPListImageRowItem to show a collection of images within a single row. Unfortunately, audio apps don&#39;t have access (i.e. crash at runtime) to action sheets or the information template which might be available in a later release.</p><figure><img alt="A table showing which templates are available for which type of CarPlay application" src="https://cdn-images-1.medium.com/max/1024/1*Yc7uvqSBDXi1SchujEeIOg.png" /><figcaption>Templates overview (see <a href="https://developer.apple.com/carplay/documentation/CarPlay-App-Programming-Guide.pdf">documentation page 16</a>)</figcaption></figure><h4>Embracing our rewind feature with the new CarPlay</h4><p>The one thing that makes our radio app special is the possibility to rewind within the last 5 hours. While implementing this feature we added MPSkipIntervalCommands to rewind/fast-forward a certain amount of seconds from the notification center.</p><p>Since the now playing screen uses the same shared MPRemoteCommandCenter to populate its playback controls, we got this functionality for free. But while the control is nice for a quick &quot;what did she/he say?&quot; it&#39;s definitely not a very pleasant user experience having to tap the rewind button multiple times to go back to a certain point in time (especially considering that the driver should focus on the traffic).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*fA4g0jWqMkjATRs-JODXrA.png" /><figcaption>Now playing screen on iOS 13</figcaption></figure><p>So for our new implementation we set the following goals:</p><ul><li>Use the “UpNextButton” to show all programs¹ within the past 5h and the selectable audio elements² for the current program</li><li>Use the “AlbumArtistButton” to show selectable audio elements for the current program</li><li>Use a custom news button in the now playing screen to seek to the latest news</li><li>Use a custom “live” button to jump back to live (if rewound)</li><li>Show progress and current event interval in station selection</li><li>Handle regional stream selection in now playing screen</li></ul><p>[1]: programs are what you might call an episode on tv. In our context they contain the metadata (like title and image) and are associated with an event which knows when the corresponding program was broadcasted (start/end).</p><p>[2]:<strong><em> </em></strong>audio elements are the more granular part within programs and provide, for example, information about music title/artist or when a news segment starts</p><h4>The bumpy road of entitlements</h4><p>Since we already had the CarPlay entitlement (note: the com.apple.developer.playable-content) we thought we could just jump right into the code skipping the often tedious process of requesting another one (surely it would be recycled or something right? 😅). Assuming you have already enabled scene support in your app, the changes to your Info.plist are pretty much the same as stated in the documentation (see <a href="https://developer.apple.com/carplay/documentation/CarPlay-App-Programming-Guide.pdf">Build your CarPlay app</a>):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cad7c60d180e43cd030aa5813f3565d9/href">https://medium.com/media/cad7c60d180e43cd030aa5813f3565d9/href</a></iframe><p><strong>Note:</strong> We initially thought that we had to set UIApplicationSupportsMultipleScenes to true since the CarPlay scene is like a new window, but since it still behaves likes an external screen this doesn&#39;t seem to be the case.</p><p>Now we have to link the CarPlay framework. If your deployment target is lower than iOS 14, make sure to link weakly:</p><figure><img alt="Xcode screenshot of the build phase where CarPlay is linking is set to optional" src="https://cdn-images-1.medium.com/max/1024/1*ArpHlwVrqLzJhS_STTtGTQ.png" /><figcaption>Choose Optional in the Link Binary With Libraries phase</figcaption></figure><p>In the entitlements file you add the new key for carplay-audio (alongside com.apple.developer.playable-content if you also support CarPlay on pre iOS 14).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a85029c9a65a2133c3eb858ded01d2a9/href">https://medium.com/media/a85029c9a65a2133c3eb858ded01d2a9/href</a></iframe><p>Now create a CarPlaySceneDelegate NSObject subclass that conforms to CPTemplateApplicationSceneDelegate and set a random template as the root template on the interface controller provided by <a href="https://developer.apple.com/documentation/carplay/cptemplateapplicationscenedelegate/3578119-templateapplicationscene">templateApplicationScene(_:didConnect:to:)</a> and run the app. The CarPlay simulator can be found here</p><figure><img alt="Screenshot on a Mac to shows the menu item I/O, External Displays, CarPlay selected" src="https://cdn-images-1.medium.com/max/1024/1*DT3JnYKQr3KVVh8SVghISw.png" /><figcaption>Show CarPlay in a second window</figcaption></figure><p>We do not recommend using the simulator for anything but playing around with the framework since it does not correctly simulate the behavior on the real device (especially the now playing screen). At this point fellow developers jokingly like to ask: “So do we get a car as a testing device?” The answer is “<strong>No</strong>” and that makes sense for several reasons. For one, I wouldn’t want to leave my comfy desk whenever a CarPlay bug report comes in 😄.</p><p>So instead, we advise getting a car radio (we have a Sony XAV-AX1005DB) with CarPlay support and hooking it up with a small microphone (“Hey Siri”) and some output device to check whether the audio is actually playing when the player indicates it.</p><figure><img alt="A car radio connected to an iPhone with the BR Radio app running" src="https://cdn-images-1.medium.com/max/1024/1*Rkt0uzjOL0msJtjF84hVlg.jpeg" /><figcaption>CarPlay compatible test device</figcaption></figure><p>Following our own advice, we wanted to run the code on the physical device right after the minimal scaffolding was done so we plugged in an iPhone, hit Run and… Boom💥</p><figure><img alt="Xcode error message informing about missing entitlement" src="https://cdn-images-1.medium.com/max/574/1*fJY-XVo5JEwzbVGwNP9qTA.png" /><figcaption>Entitlement missing in provisioning profile</figcaption></figure><p>#HelloDarknessMyOldFriend</p><p>So there <strong>is</strong> a new entitlement for carplay-audio and we <strong>did</strong> have to issue a new request for it. Your team agent can do that <a href="https://developer.apple.com/contact/carplay/">here</a>. After a few days we also contacted them via the old email address that we initially received a message from (pre iOS 14 CarPlay).</p><p>In the end, we don’t know whether the additional message accelerated the process but we received an answer within 10 days 🥳. If you don’t have CarPlay support yet and want to support CarPlay + Media Player frameworks we suggest making that clear in your request. We can’t tell if you are automatically assigned 3 entitlements (CarPlay, Media Player, CarPlay+MediaPlayer) or if we just got that because we already had the old one.</p><p>Supercharged with the new entitlements hop over to the <a href="https://developer.apple.com/">developer console</a>, (re)create your provisioning profiles and make sure to include the entitlement from the dropdown before hitting save.</p><figure><img alt="Select menu with different entitlements on the developer console" src="https://cdn-images-1.medium.com/max/1024/1*s7toO25se4VLMyD-y8NSjQ.png" /><figcaption>Select the correct entitlement</figcaption></figure><p>Now that signing is working, let’s see how we went about implementing the goals we have set in the beginning.</p><h4>Show progress and current event interval in station selection</h4><p>Our root template should look pretty similar to the station selection we had in the iOS application. The obvious choice is the list template with a single section</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f24ae284ffdd2b436b30519e9a4dd9a3/href">https://medium.com/media/f24ae284ffdd2b436b30519e9a4dd9a3/href</a></iframe><p>Whenever an iPhone is connected with a CarPlay compatible device, the scene delegate’s templateApplicationScene(_:didConnect:) is called which in turn calls the connect function on the TemplateManager. This is the same approach that Apple took in their sample project <a href="https://developer.apple.com/documentation/carplay/integrating_carplay_with_your_music_app">CarPlay Music</a>. At the end of the connect function (#2) we immediately transition to the now playing screen when playback on the iPhone is already in progress. This is undocumented behavior but it seems to be widely adopted in CarPlay audio applications.</p><p>The updateStationSelectionItemsFromCache (#1) is called from several points in the app and it&#39;s responsible for creating CPListItems for each station. Let&#39;s take a look at the implementation:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db36d4ee621d6869e50bcab8550c766a/href">https://medium.com/media/db36d4ee621d6869e50bcab8550c766a/href</a></iframe><p>Let’s break it down:</p><ol><li>We wanted to have the same order of stations as defined by the user in the iOS app.</li><li>Since Apple just loves exposing images via a synchronous image api when it comes to anything related to the media player we have created a convenience initializer for CPListItem to take care of the image fetching and also exposing an identifier which is the station id in our case.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/44273498c54593b8f4f47b8b4cf54771/href">https://medium.com/media/44273498c54593b8f4f47b8b4cf54771/href</a></iframe><p>3. Unlike on the iPhone we only have two lines per item so we combined the program’s kicker and the event interval.</p><p>4. Since we get the station logo’s urls via our backend we have to select the correct light/dark version at runtime by checking the interface controller’s carTraitCollection. Even though the documentation states &quot;Don’t use other parameters [than the displayScale] in the carTraitCollection&quot; we went the easy way³ of just using the correct version depending on the current interface style. Note that you cannot use UITraitCollection.current since it will use the iPhone&#39;s trait collection.</p><p>5. We set the playback progress depending on how much of the program has already been played. Notice that a progress of 0.0 doesn&#39;t render anything and a value of 1.0 will just render a ☑️ instead of a completely filled bar.</p><p>6. In order to show the <em>isPlaying</em> indicator, the isPlaying property needs to be set correctly. This will render an animated or still image of an equalizer when the player is playing or paused, respectively.</p><p>7. Every list item has a handler closure that is called with the corresponding item and a completion handler whenever the user selects a row from the list. This completion handler <strong>must</strong> be called as soon as possible on the main thread. If you forget to call it, an NSInternalInconsistencyException will remind you 🙃.</p><p>[3]: If you want your light/dark image behave like one coming from an asset catalog (switch when interface style changes) you have to create a UIImage() and register both versions with the underlying imageAsset. In that case you have to load both images before setting the combined image on the list item.</p><p>Here is the result</p><figure><img alt="Station selection screen showing 4 stations" src="https://cdn-images-1.medium.com/max/900/1*c9Q9SxxOLISZWDBGASji2w.png" /><figcaption>Station selection screen</figcaption></figure><p>We currently call updateStationSelectionItemsFromCache every 30s or when any of the stations&#39; current event changes. Unfortunately, we cannot update the progress values every second because this results in an ugly reload animation.</p><h4>UPDATE (21–11–30): Adding `carPlayImage` for correct remote image scaling</h4><p>While working on another project we noticed that the images in list items should actually be bigger and some investigation (including contacting DTS) pointed us in the right direction. Here is what we use to get correct image scaling:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6e5e5c0aa1173139a4122414a6768e16/href">https://medium.com/media/6e5e5c0aa1173139a4122414a6768e16/href</a></iframe><p>The basic idea is to put the image in a UIImageAsset and take it out again which magically makes things work. Other than that we also crop it to a square and resize it to the maximum allowed image size.</p><h4>Handle regional stream selection</h4><p>At BR, we highly value regional and local content which is also reflected in our radio stations. Some of them have multiple regional streams so you can choose the content most relevant (close) to you. If you tap on a station without having previously selected a preferred region on the iPhone, we show a list of available regional streams to pick from. The action sheet would have been the perfect candidate for this but as noted before it’s unavailable for CarPlay audio apps. A list template it is then:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/62b44e4a5d44615cfc062a8c31e93f20/href">https://medium.com/media/62b44e4a5d44615cfc062a8c31e93f20/href</a></iframe><ol><li>Pop the list template and initiate playback for the station.</li><li>You might think “this code is pretty obvious, what’s there to explain?”. Well, we went down the rabbit hole caused by undocumented behavior which is why we wanted to share our findings. First, why on earth is there no .checkmark on CPListItemAccessoryType 🧐? Fine, let&#39;s use an SF Symbol then. What? It renders nothing? Maybe we have to use the carTraitCollection for the UIImage(systemName:compatibleWith:) initializer? Uh-uh. It turns out SF Symbols only seem to work as tab images. Alright, but we&#39;re on iOS 14, can&#39;t we at least use SVG images in the asset catalog? Nope. We tried every combination of <em>Appearances</em>, <em>Devices</em> and <em>Renders as</em> in the asset catalog but the tinting just didn&#39;t work out. While reading the documentation again we interpreted &quot;provide image resources that are display-ready&quot; as &quot;tinting doesn&#39;t work the way you want it to&quot; so we went back to plain PNGs which now looks like this:</li></ol><figure><img alt="Xcode screenshot of a CarPlay image asset with 2x and 3x, light and dark mode images" src="https://cdn-images-1.medium.com/max/1024/1*xPTLTcABDIBlAlxNygbPCA.png" /><figcaption>Sample CarPlay image asset</figcaption></figure><p>The documentation doesn’t provide guidance on the size of disclosure indicator images so we went for 20pt x 20pt single-color square PNGs. Only with this setup we could get tinting during row highlight working (previously it would have been rendered white here).</p><figure><img alt="List template with a highlighted row that shows a correctly tinted custom image for a disclosure indicator" src="https://cdn-images-1.medium.com/max/775/1*G1tsXTbiIhOa6UgYrA24xg.png" /><figcaption>Tinted disclosure indicator</figcaption></figure><p>If you look back at the code of #1 you see that we pass the interface controller’s car trait collection to receive the correct image. This will include the “Car Play” device trait and the correct display scale.</p><p>Apple’s sample code is actually incorrect since they just use the same assets for iPhone and CarPlay (fine) and don’t pass any trait collection. This results in the iPhone’s main screen’s display scale for the asset lookup and whenever this value differs from the car radio’s display scale the wrong image is resolved.</p><h4>Initiate Playback</h4><p>Previous code samples have already shown two invocations of initiatePlayback(for:) so let&#39;s take a quick look at the implementation:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd0e8606f0474f43b6f25450257c46b0/href">https://medium.com/media/cd0e8606f0474f43b6f25450257c46b0/href</a></iframe><ol><li>If we don’t have a preferred stream for this station we present the stream selection <a href="#9880">shown before</a>.</li><li>If the user picked the same station and livestream we just show the now playing template. This occurs when navigating back from the now playing screen and selecting the same station again.</li><li>If a new station or different regional livestream for the same station was selected we tell the player to initiate playback.</li></ol><p>We don’t immediately show the now playing screen in #3 because this would only account for playback initiated from CarPlay. Since the user could also pick a station from the iPhone our use Siri to start playback our CarPlay UI would be out of sync. Therefore, we use a delegate function from our player for this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d5a39a25282816f9ec08115ebeb74de9/href">https://medium.com/media/d5a39a25282816f9ec08115ebeb74de9/href</a></iframe><ol><li>We store the last selected station in a currentStation property. If the station didn&#39;t change we return early.</li><li>If the new station is different from the old one, we toggle the old item’s isPlaying property.</li><li>We set the new item’s isPlaying property to true.</li><li>Present the now playing template. This will now also work if a radio station was launched from Siri.</li></ol><p>Showing the now playing screen was actually not as trivial as it may sound, so we built a helper function for that:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd0776f5cc5b12fdb993a5ab5352a174/href">https://medium.com/media/dd0776f5cc5b12fdb993a5ab5352a174/href</a></iframe><ol><li>Don’t do anything if the now playing template is already visible.</li><li>This is a common workaround when the now playing screen doesn’t appear on the simulator. The right combination of setting the player rate often and handling remote events in our player module made this call superfluous but we left it here for fellow developers.</li><li>If there are other templates pushed on top, we just pop to the now playing template.</li><li>Now playing screen is still not visible so we just push it on the stack.</li></ol><h4>Adding custom now playing buttons</h4><p>One of the coolest features of the new CarPlay framework is that you can use custom buttons in addition to the MPRemoteCommands. We wanted to show a news button to jump to the latest news (we broadcast news ~ every hour) alongside a stream selection button and a button to jump back to the live position (if rewound). For the news we have two different buttons with ⏪ or ⏩ symbols depending on whether the time to seek to is in the past or the future relative to the current playhead. For the other cases we just have single buttons:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/afa6fa38c8dde06495c4cc59721441a9/href">https://medium.com/media/afa6fa38c8dde06495c4cc59721441a9/href</a></iframe><p>There is a unit test that would fail if any image isn’t available so force unwrapping is ok here 😉. For the additional buttons we created a helper struct:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce3e383054b43e0916440f63f735da1b/href">https://medium.com/media/ce3e383054b43e0916440f63f735da1b/href</a></iframe><p>The current config is stored in a property and updates the now playing buttons whenever it changes:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4aeee3892a0c5b8791bbdfa095800553/href">https://medium.com/media/4aeee3892a0c5b8791bbdfa095800553/href</a></iframe><p>Whenever we need to update the config we call the updateNowPlayingButtonConfig. It evaluates the current state of the player to determine the correct values of the properties. Additionally, we update the isStreamSelectionEnabled whenever the currentStation property observer is called:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8bc3b69c227c6c9d295e4c7b2aa9d78/href">https://medium.com/media/f8bc3b69c227c6c9d295e4c7b2aa9d78/href</a></iframe><p>This function is called every time the player’s current time changes and just before the now playing template is shown. If the config hasn’t changed since the last call, the buttons just stay the same. We decided to only call updateNowPlayingButtons(with:) when necessary because even setting the same buttons would lead to ugly re-rendering and unpleasant animations. The implementation is just a switch over the different cases and collecting the corresponding buttons:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/890ab00ac30789110f32ba502ecfe0d1/href">https://medium.com/media/890ab00ac30789110f32ba502ecfe0d1/href</a></iframe><p>With this in place our now playing screen looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*2RH_JMEFxB3ryB27bohY7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*d3QDGVfLU-augfMkH5OE1w.png" /><figcaption>Now playing screen (left: Live, right: Rewound)</figcaption></figure><p>The first screenshot shows a livestream at the “live” position. The news button points to the past and the button for regional stream selection is enabled (it triggers the same list as shown before). The second screenshot shows the player seeked back 5 minutes so the “live” button is visible and the news button points to the future (current time is 06:59 PM and latest news are at 07:00 PM). Both screenshots already give a sneak peak at the final two features. Let’s check them out.</p><h4>Using the “AlbumArtistButton”</h4><p>When the isAlbumArtistButtonEnabled property on the shared now playing template is set to true, the last line of the now playing screen turns into a button. According to the documentation, this can be used &quot;to present more information about the current track&quot;. Naturally, most traditional music apps show all titles within the current album or recent albums/titles from the current artist. In BR Radio, the last line is the kicker of the currently playing program. Therefore, tapping the button should present a list of audio elements within the program:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c71cc40ec4b297e89278d9c2c57fb55/href">https://medium.com/media/3c71cc40ec4b297e89278d9c2c57fb55/href</a></iframe><ol><li>This shouldn’t happen in practice but if we have no current event we show an alert (see <a href="#ce7e">Alert helper</a>).</li><li>The items are all the audio elements in reversed order (newer items appear first).</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ba763cdaf3e0be55c0a5bf4f32d070ac/href">https://medium.com/media/ba763cdaf3e0be55c0a5bf4f32d070ac/href</a></iframe><p>Audio elements that cannot be seeked to are filtered out. Upon tapping an item we seek to the element’s start date. The implementation of seekToDateIfPossible(_:completion:) makes sure to pop back to the now playing screen.</p><figure><img alt="A list of audio elements within the current program" src="https://cdn-images-1.medium.com/max/900/1*9XSkciyOUI4lNwqfrDSspA.png" /><figcaption>Audio elements within the current program</figcaption></figure><h4>Using the <em>Up Next</em> Button</h4><p>Similar to the isAlbumArtistButtonEnabled there is an isUpNextButtonEnabled flag. When enabled, you can further customize the title to anything you like. Without this, our rewind feature wouldn&#39;t make any sense. The default English title of the button is <em>Playing Next</em> which couldn&#39;t be more wrong when trying to display the list of previous elements. So the first thing we do after enabling the button is to change its title to indicate that tapping it will reveal a rewind screen:</p><pre>CPNowPlayingTemplate.shared.isUpNextButtonEnabled = true<br>CPNowPlayingTemplate.shared.upNextTitle = Localized.rewind()</pre><p>So what do we do now? One idea was to list all audio elements in reversed order grouped by their associated program (using the event interval and program kicker as section title). This approach would have had several drawbacks. It’s very hard to reach elements that aren’t at the very top of the list. Also, we cannot scroll to a certain item. So if we are playing a previous program, the user would have to scroll through all future titles to reach the current and previous elements. That is, if the items are even presented. The list template has a limit (CPListTemplate.maximumItemCount) that can be as little as 12. Always take into account that some items might not be displayed. If you have an order of preference for certain items you should query the maximumItemCount value and use subsets of items if necessary.</p><p>It’s obvious that we cannot replicate the same flat list of elements like on iOS. Another idea would be to first present a list of programs on one screen (images, titles, event intervals) and then show the corresponding audio element upon tapping them. This way, the user would have to select a program before she/he sees any tappable audio elements.</p><p>In the end, we decided for a hybrid approach leveraging the new image row list item. It will appear in the first section and show the first programs that the user can seek into. The title is tappable and will present the full list of programs. In the next section we show the currently playing program to enable quick access to its audio elements.</p><figure><img alt="Overview over the rewind screen" src="https://cdn-images-1.medium.com/max/900/1*YaVLPMtYQ0EMGHA-7T5-IA.png" /><figcaption>Rewind screen (overview)</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df9c5ab6483c70c1e2281983da03f2ec/href">https://medium.com/media/df9c5ab6483c70c1e2281983da03f2ec/href</a></iframe><p>The second section is the same that we created for the album artist button. For the image row list item we created another convenience initializer since the api felt quite unintuitive. Actually, you can have multiple CPListImageRowItems in a single section but we’ve never seen this used in any app. To us, the UI looks like a section with multiple items aligned horizontally instead of vertically. The api of our initializer aligns mirrors this visual appearance:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6e9ed0ac4cf610df97269e0b327eb141/href">https://medium.com/media/6e9ed0ac4cf610df97269e0b327eb141/href</a></iframe><ol><li>We create a helper struct that holds the information for one item. The image is non optional because there is no text so the image is the only representation of the item.</li><li>For remote images you can provide a remoteUrl in combination with a placeholder that is used until the image has been fetched successfully (or if the fetch failed).</li><li>The imageRowItems parameter resembles the items parameter of the default CPListSection initializer.</li><li>The number of rendered images is not the same as in the images array of the CPListImageRowItem. Rather, only CPMaximumNumberOfGridImages are used (<strong>and </strong>are exposed via the item’s gridImages property) so we just slice the images array accordingly.</li><li>The listImageRowHandler of a CPListImageRowItem is called with the index of the tapped image which we’ll use to access the correct handler of our ImageItems.</li><li>The handler of the image row itself is invoked when the image row title text is tapped.</li><li>This is basically the same dance we did for the CPListItems. Note that we first access the gridImages of the row, reassign the downloaded image and then update the list item’s images (<a href="https://developer.apple.com/documentation/carplay/cplistimagerowitem/3650362-update">CPListImageRowItem.update(_:)</a>).</li></ol><h4>Handle tapping the image row title</h4><p>Tapping the <em>Vergangene Sendungen </em>inside the image row list item will present a list of all events that a user can seek within. The handler of the program rows is the same as described in the next paragraph:</p><figure><img alt="A list of all programs within the last 5h" src="https://cdn-images-1.medium.com/max/900/1*cMasWehASpqNqgzaMycjog.png" /><figcaption>A list of all programs within the last 5h</figcaption></figure><p>There is one thing to take into account here. Somewhere in the documentation you can find the following <strong>warning</strong></p><blockquote>There is a limit to the number of templates that you can push onto the screen. All apps are limited to pushing up to 5 templates in depth, including the root template.</blockquote><p>When navigating to the audio elements of a program via the path mentioned here, we have root/now playing/rewind overview/all past programs/audio elements of program. So there may be no further nesting.</p><p>If you have a complex navigation flow in mind you might want to reconsider and focus on key features of your app instead since it doesn’t make sense to bury features deep within a navigation stack.</p><h4>Handle tapping the list image row item</h4><p>When the user taps on either an image in the image row list item or on one of the rows shown in the last screenshot, we show the list of audio elements for that particular program. We also added a shortcut to seek to the beginning of the show as the first item:</p><figure><img alt="A list of audio elements within a program" src="https://cdn-images-1.medium.com/max/900/1*yrV0XvjU6PL-Dko3tPFusQ.png" /><figcaption>A list of audio elements within a program</figcaption></figure><h4>Fixing non square images</h4><p>One problem you might have already noticed is that all images look distorted. The reason for this is that CarPlay expects square images but we only have 16/9 images (for now). Until our backend provides us with square images we have two options:</p><ul><li>manually crop the image or</li><li>render the non-square image in a square image context</li></ul><p>For the first option we would have to decide for either a center or a top-left crop (some images contain text that’s top-left aligned). Both of those variants might remove important information from some images.</p><p>We went for the second option and use the following extension in all the CarPlay items’ convenience initializers that we have shown before:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/989d48ee1b834384eb34f46a6283206d/href">https://medium.com/media/989d48ee1b834384eb34f46a6283206d/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*6B3FDk6jW8lHoSFjNi9cBw.png" /><figcaption>Use 16/9 images for image row list item</figcaption></figure><h4>Alert helper</h4><p>For some errors we use a helper function to present alert templates. Due to limited space, an alert template doesn’t have a title and message like a UIAlertController. Rather, there is a titleVariants array to provide a list of titles sorted from most to least preferred. Since we have never used multiple titles, our final helper on the template manager only has a simple title parameter.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/00367192c44a5dc256bbbbf381395604/href">https://medium.com/media/00367192c44a5dc256bbbbf381395604/href</a></iframe><ol><li>We only used .default actions so we could encode the actions as simple title+completion handler tuples.</li><li>After executing the handler of the caller, dismiss the alert (this is <strong>not</strong> automatic, not even with the .cancel action).</li><li>Since at least one action is required we always create an ok action with a .cancel style here.</li><li>This one is especially interesting: We want the ok/cancel action to appear last so we append it to the other actions. At one point we show an alert with one additional action but only one action is shown. The odd thing: it’s the ok/cancel action 🤪 What is happening? CarPlay checks the CPAlertTemplate.maximumActionCount value and if only one action is allowed it will use the first .cancel action in the array. Only if there is room for more, additional actions will be added. We have never seen a maximumActionCount greater than 1 so be prepared that your actions won&#39;t be visible to most users. If an action triggers a critical activity and you want to be sure it can be selected, you might want to consider pushing a list template instead (see <a href="#9880">stream selection</a>).</li></ol><p>Wow, that was quite a lot for a simple CarPlay application but we hope it fills some of the gaps missing in the documentation and that it helps other developers to learn from the mistakes we have made along the way.</p><p>CarPlay Audio was really fun to work with. Since the UI is so limited, we could focus on the features and how to package them within the components Apple provided for us. Although CarPlay on iOS 14 is way more powerful than the Media Player framework, there is definitely some room for improvement. We’ll just leave our wish list here in case someone from the CarPlay team reads this 🤓:</p><ul><li>Enable tint colors for templates (this doesn’t even work on the CPWindow)</li><li>Only re-render necessary subviews of list items (progress change re-renders entire row)</li><li>Allow higher resolution images (CPListItem.maximumImageSize seems too small most of the time)</li><li>Allow text under CPListImageRowItems</li><li>Run CarPlay on the iPhone for cars without modern radios (Android can do this)</li><li>Make SF Symbols available everywhere UIImages are allowed (or document missing support)</li></ul><p>BR Radio is currently in Beta and the new CarPlay implementation will soon be available on the <a href="https://apps.apple.com/de/app/br-radio/id516572185">App Store</a>. We’d love to hear your feedback! If you have any questions feel free to write us a message 😉.</p><p><em>BR Radio is available for </em><a href="https://apps.apple.com/de/app/br-radio/id516572185"><em>iOS</em></a><em> and </em><a href="https://play.google.com/store/apps/details?id=de.br.radio"><em>Android</em></a><em>.</em></p><h3>Contact</h3><p>alexander.tuerk@pub.tech</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8baab824b932" width="1" height="1" alt=""><hr><p><a href="https://medium.com/br-next/launching-br-radio-on-carplay-audio-8baab824b932">Launching BR Radio on CarPlay Audio</a> was originally published in <a href="https://medium.com/br-next">BR Next</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Encoding and Decoding Enums with Associated Values Using Codable (Swift 4)]]></title>
            <link>https://medium.com/@fruitcoder/codable-enum-with-associated-values-swift-4-e7d75d6f4370?source=rss-e74b30f9f423------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7d75d6f4370</guid>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Alex Türk]]></dc:creator>
            <pubDate>Fri, 25 Aug 2017 14:38:47 GMT</pubDate>
            <atom:updated>2017-08-26T10:05:09.225Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pQlDl3yavWoEvWJpjXN3UQ.jpeg" /></figure><p>During a Swift 4 migration of a download manager framework, I rewrote my model objects (NSObject subclasses conforming to NSCoding). My DownloadItems have a state that’s represented by an enum with associated values:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a6c8c7d4b2f8ea0ee362e22f50e08cb/href">https://medium.com/media/3a6c8c7d4b2f8ea0ee362e22f50e08cb/href</a></iframe><p>With Swift 3 I had to write a wrapper object conforming to NSCoding to persist this enum. With Codable this workaround is no longer needed since I can add Codable conformance to the enum directly. Now there are different ways to implement this. I’m still not quite sure what the best solution is, but maybe someone can use my current approach.</p><p>Before taking a look at the DownloadState, let’s see a simpler example of a Value enum:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da88b9b8e37c413b4eec4dcb61ea9be9/href">https://medium.com/media/da88b9b8e37c413b4eec4dcb61ea9be9/href</a></iframe><p>There is a one-to-one mapping between the type and the case so we can set up a container that looks like this:</p><pre>// Pseudo dictionary<br>[&quot;string&quot;: String, &quot;int&quot;: Int, &quot;data&quot;: Data, &quot;double&quot;: Double]</pre><p>After all, KeyedDecodingContainer and KeyedEncodingContainer are just very strict dictionaries, where subscript keys are strongly typed String enums (conforming to CodingKey) and getters and setters leverage Swift’s error handling system to provide meaningful errors about why getting or setting a value for a certain key might fail. So at least for me it makes sense to think about the containers as dictionaries with fixed keys :)</p><p>Implementing Codable for Value might look something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3071054ae81acb6ad061d66a09dc1821/href">https://medium.com/media/3071054ae81acb6ad061d66a09dc1821/href</a></iframe><p>We use the decodeIfPresent function of KeyedDecodingContainer, because only one key will be set. The disadvantage is that we don’t use a switch statement for decoding so the compiler can’t scream at us when we add a new case and forget decoding it.</p><p>Moreover, it doesn’t work for the DownloadState example, because we have cases with and without associated values. My approach was to use the “base” case and the associated values as CodingKeys and then have a private enum hosting all the base cases as simple Strings. Let’s see how that looks:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f489d8ee0dc4de25176ce8e24c249ad0/href">https://medium.com/media/f489d8ee0dc4de25176ce8e24c249ad0/href</a></iframe><p>What I really like is that the compiler can completely autogenerate the Codable implementation of Base since it’s just a String enum. Unfortunately, we still have to provide the Codable implementation for DownloadState 🙂.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c93d2d45ebab04e953147f94a746c30/href">https://medium.com/media/4c93d2d45ebab04e953147f94a746c30/href</a></iframe><p>The following pseudo dictionaries are all valid representations of a DownloadState.</p><pre>// Pseudo dictionaries<br>[&quot;base&quot;: &quot;canceled&quot;]<br>-&gt; DownloadState.canceled</pre><pre>[&quot;base&quot;: &quot;paused&quot;, &quot;pausedReason&quot;: &quot;waitingForWifi&quot;]<br>-&gt; DownloadState.paused(reason: .waitingForWifi)</pre><pre>[&quot;base&quot;: &quot;downloading&quot;, &quot;downloadProgress&quot;: 0.5]<br>-&gt; DownloadState.downloading(progress: 0.5]</pre><p>Does this scale? No… If there are multiple associated values involved, this is actually quite a complex type and should be handled just like a nested struct or class. Consider the following example where Route represents the different screens of a music application with a home and a detail page (to play the music):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d823f3ce68def2d0c3144fc9f51fb6ca/href">https://medium.com/media/d823f3ce68def2d0c3144fc9f51fb6ca/href</a></iframe><p>Super simple right? But adding every associated value to the CodingKeys</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dc1e84ba282707e2fbc6c3153f196616/href">https://medium.com/media/dc1e84ba282707e2fbc6c3153f196616/href</a></iframe><p>has some drawbacks:</p><ul><li>It feels semantically wrong to have the associated values on the same hierarchy as the basic cases (just like in the DownloadState example, but even more prominent)</li><li>If the enum gets even more cases (and more associated values) this gets even harder to read and maintain</li><li>If this was a class or a struct you would never think about encoding the information of a nested type within the parent.</li></ul><p>So how can we solve this? I think adding a struct for every case with associated values is a clean approach and helps split up responsibility:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/714ce973e6122d1e4be4b4d3dccd5f18/href">https://medium.com/media/714ce973e6122d1e4be4b4d3dccd5f18/href</a></iframe><p>Since we delegate the Codable conformance down to every associated value struct the CodingKeys only contain one key per case (with associated values). The code seems pretty repetitive but it’s simple and follows a certain pattern. You could also use <a href="https://github.com/krzysztofzablocki/Sourcery">Sourcery</a> to automate this process.</p><p>It also works with an enum that uses Codable types as associated values:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/86c62a3e49113cf47dbd8955a8f940d1/href">https://medium.com/media/86c62a3e49113cf47dbd8955a8f940d1/href</a></iframe><p>Again, we have one key for the base case and one coding key per case with associated values. The structs handle encoding and decoding themselves and the types within the struct are themselves responsible for implementing Codable.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cce1d9f1d0923496e1c3bf2ef773857e/href">https://medium.com/media/cce1d9f1d0923496e1c3bf2ef773857e/href</a></iframe><p>Happy 🐟ing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7d75d6f4370" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>