<?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 Riz on Medium]]></title>
        <description><![CDATA[Stories by Riz on Medium]]></description>
        <link>https://medium.com/@rizwan?source=rss-67901aa18c39------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*oRIgJ1HORfBX3BPb.jpeg</url>
            <title>Stories by Riz on Medium</title>
            <link>https://medium.com/@rizwan?source=rss-67901aa18c39------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 21:47:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rizwan/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[Every app developer should move their config to the cloud. Here’s why.]]></title>
            <link>https://medium.com/launch-kit/every-app-developer-should-move-their-config-to-the-cloud-here-s-why-1efedc8f893f?source=rss-67901aa18c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/1efedc8f893f</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Riz]]></dc:creator>
            <pubDate>Thu, 19 Nov 2015 15:51:09 GMT</pubDate>
            <atom:updated>2015-11-19T17:57:45.179Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NQ8kROzls5K6v9OB2Bod9Q.jpeg" /><figcaption><a href="http://globe-views.com/dreams/clouds.html">Source</a></figcaption></figure><p><em>How I Overcame the Hard-Coding Life, and You Can Too.</em></p><p>I’m going to tell you a secret. I’ve been writing iOS Apps since before (!) the App Store opened in 2008. I’ve made a lot of mistakes. Many of them I’ll never admit to. But for one mistake, it’s time to come clean:</p><p><strong>I’m a hard-coder.</strong></p><p>I don’t mean I’m a <em>hard coder</em> like I’ve lived in some alternate developers-as-gangsters reality in which the longer you write code the harder, faster, better you get. <strong>I just mean that I hard-code shit in my apps</strong>.</p><p>Paddings, colors, line-widths, API Keys. You name it, they’ve probably been hard-coded into my app. They’ve made their way in a binary all the way into the App Store and lived there like a permanent fossil. But <strong>there’s a better way</strong>. I want to show it to you. Don’t be like me. Don’t live a hard-coding life.</p><p>I’m going to talk at you about two things: <strong>constants</strong>, and <strong>cloud config</strong>.</p><p>The first is straightforward: Many of your app and visual settings should be declared as <strong>constants</strong>. That way you can change them easily and not dig through your code.</p><p>Second, let’s talk about <strong>cloud config</strong>. This is when things get interesting. You should take some of those constants and make them variables on a server. By doing this, you can change how your app behaves even after it’s in the App Store. Sometimes it’ll help you release new features. Better yet, they can save your ass if you find a bug.</p><p>Take it from me, this is magical. It’s like adding radio-controller to your cheap-ass Hyundai (or magic time-machine DeLorean, whatever).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*ovxiJk6aFxanrR-7-2qE1Q.gif" /><figcaption><a href="http://giphy.com/gifs/back-to-the-future-marty-mcfly-doc-brown-O3iSQja4uptwQ">Source: Giphy</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*Y9EYKxy67myjsFgr7WPOIw.gif" /><figcaption><a href="http://giphy.com/gifs/back-to-the-future-marty-mcfly-doc-brown-gviwxHNiTy74c">Source: Giphy</a></figcaption></figure><h4>Constants and You: A Love Story</h4><p>Let’s go back to constants and make sure we’ve covered our bases. You probably <em>already</em> do this, so feel free to skip to the next section.</p><p>In case you don’t use constants for your settings and details, here’s a quick run-down of things I tend to make into settings constants in my apps:</p><p><strong>UI Constants<br></strong>I’ve learned to live my life as an iOS developer like a gazelle in the Serengeti. At any point, through the dense brush, a designer or PM can lunge at you with UI tweaks or “experiments”. (I live in constant fear.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*F1yIESk2DGSjnpS7mqoIqg.jpeg" /><figcaption><a href="http://www.likefun.me/gazelle-jumps-in-car-to-escape-cheetahs/">Source: likefun</a></figcaption></figure><p>Here’s some code:</p><pre>// Top of your implementation file<br>static CGFloat const CELL_PADDING_Y = 8.0;<br>static CGFloat const CELL_PADDING_X = 8.0;<br>static CGFloat const IMAGE_SIZE = 50.0;</pre><pre>// Using it later<br>CGRect imageRect = CGRectMake(CELL_PADDING_X, <br>                              CELL_PADDING_Y, <br>                              IMAGE_SIZE, <br>                              IMAGE_SIZE);<br>imageView.frame = imageRect;</pre><p>One of my favorite apps I’ve worked on is <a href="https://cluster.co/">Cluster</a>. In fact, many of the learnings being dropped on you right now are from <a href="https://cluster.co/about/">us</a> having built — and incessantly tweaked — that app. When <a href="https://medium.com/u/1468f6fb1a30">Brenden</a> wanted to help in designing the app, I made a lot of these types of constants at the top of the files. This way, he could tweak the UI and commit the changes without me having to get involved.</p><p><strong>Emails, URLs, and Social Media handles<br></strong>Don’t hard-code these into your functions. They’re going to change eventually. I’ve definitely forgotten to change our support email address in our code before, and then in the next release no one could contact us. Make them constants like the UI details above.</p><p><strong>Trying out new app behaviors<br></strong>This one will make your code-housekeeping senses tingle with the tumult of a thousand tiny bells, but bear with me:</p><p>As you build your app, you’ll be iterating and adding new features and changing behaviors with every major release.</p><p>Until you’re sure the new behavior is what you want, you should make a “feature constant”, and gate your new stuff behind that. This lets you keep your old behavior <em>alongside</em> the new behavior. When you’re building apps, it’s <em>critical</em> to test things side-by-side. Doing git reverts or switching git branches just to try different things takes too long. So keep both versions, and use a “feature constant” to switch quickly between the two. It’ll give you the best kind of immediate comparison. (Note: When you’ve decided on one over the other, then <em>please</em> go and delete the unused code. Future You™ will thank you for it.)</p><p>There are a bunch of A/B testing tools that help you do this, like <a href="https://www.optimizely.com/mobile/">Optimizely</a>, <a href="http://apptimize.com/">Apptimize</a>, <a href="https://mixpanel.com/mobile-ab-testing/">Mixpanel</a>. Even <a href="https://developer.amazon.com/public/apis/manage/ab-testing/doc/a-b-testing-for-ios">Amazon</a>’s in the A/B testing game! If you’re already using one, then high-five/fist-bump to you. If you’re not, then try one out. Some of them are simpler than others to set up, so look around for one that fits.</p><h4>Cloud Configuration is a Dream</h4><p>If you’ve already done the things I described above, then congratulations! Now let’s take some of those constants you have in your code, and turn them into variables in the cloud!</p><p>Doing this makes your app <em>really</em> powerful. Now you can control things like your UI details and feature settings, all while the app is in people’s hands.</p><p>Remember how you could control your DeLorean? Now you can do some <em>serious shit </em>to your app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*w0pJ3kW33hT-42N_bhoL2Q.gif" /><figcaption><a href="http://giphy.com/gifs/back-to-the-future-marty-mcfly-doc-brown-fXlnvRVGRGJQQ">Source: Giphy</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*zAhhwTMi_B9xc2EogR1aFA.gif" /><figcaption><a href="http://giphy.com/gifs/back-to-the-future-RIjkQf4JTEiM8">Source: Giphy</a></figcaption></figure><p>Here are some cool things you can do with remotely controlled config:</p><p><strong>Adjust Your UI (revisited)<br></strong>Same as above, but now with remote control! Maybe your image hosting service got an upgrade, so you can change to higher resolution images and make them <em>larger</em>. Awesome, you can remotely change the size of your image views!</p><p>Another example: If you’re not sure what the hell your “Sign Up” button should say (Tip — try: “Sign Up”, “Get Started”, “Hand Over Your Firstborn”), you can now make a small configuration variable on your server, and then change it <em>after you ship</em>.</p><p>Note: You could use an A/B testing tool to accomplish all sorts of major changes if you want, but I’m trying to get you to change some simple variables remotely, not run complicated “campaigns”. If you already use an A/B testing tool, then keep using it, but run some smaller changes too!</p><p>Think about it: Sometimes it’s the very little things about your app that get people to like it or hate it. Having bits of UI that you’re unsure about, but can remotely configure means you can quick make small changes with a large group of people. It’s <em>really</em> useful in a <a href="https://library.launchkit.io/how-to-run-live-user-testing-sessions-fef630e3620b">live user test</a>.</p><p><strong>Emails, URLs, and Social Media handles (revisited)<br></strong>Apps change Twitter handles and even homepage URLs all the time. There’s no reason this should be hard-coded into your app. Maybe you’ll finally convince the squatter to sell you that domain you’ve wanted forever. Maybe you’ll change help desk providers (Hello Zendesk) and need to change your support email address. Maybe the Libyans will be back again to take your precious <a href="https://bit.ly/">bit.ly</a> away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*ZRx1sKo16n6H4rAphE6-NQ.gif" /><figcaption><a href="http://giphy.com/gifs/10UB1BfC4EKll6">Source: Giphy</a></figcaption></figure><p>When we launched <a href="https://cluster.co/">Cluster</a>, we totally loved <a href="https://getcluster.com/">getcluster.com</a> — but obviously we jumped at the opportunity to purchase <a href="https://cluster.co/">cluster.co</a>. If we had been able to update our app on the fly back then, the transition would’ve been seamless.</p><p><strong>3rd-Party API Tokens<br></strong>Ok. I’ve admitted to hard-coding stuff in the past, but now it’s time for <em>you</em> to come clean, too. You hard-code your 3rd party API tokens. Your S3 Access Key is sitting there as a constant in your app delegate. No, no, it’s ok. We’ve all been there.</p><p>Let me tell you about a time when I was burned by this: At my last startup, I was integrating a public-image-search service, for a “minor” feature, and so I incorporated my API key into the app’s binary. I figured if I ever ran close to the usage quota, we could pay to increase the limits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*m6QmnS4Y7HUpw7uRjWJr9g.gif" /><figcaption><a href="http://giphy.com/gifs/snow-rain-back-to-december-cmieysaZP0SJO">Source: Giphy</a></figcaption></figure><p>When I accidentally hit the quota, it turned out that I had to provision a <em>new</em> key with a new quota, and I couldn’t just change the quota on my existing key. The “minor” feature generated tons of support emails and was completely broken for days while we waited for an expedited App Store review.</p><p>It’s not worth it. Join the closest post-traumatic-hard-coding community near you today!</p><p><strong>Increasing or Decreasing Limits<br></strong>When we launched video support into <a href="https://cluster.co/">Cluster</a>, we weren’t sure what kind of load we would experience on our video uploader. So we set a maximum duration for the video: 15 seconds. Since we knew that this limit would be going up, we built a custom config API call to give us the new time limit for video uploads.</p><p>After scaling up our backend from growing traffic, <strong>we were able to increase the limit to 60 seconds without re-submitting a new build to the App Store</strong>. Magic!</p><p>There’s no reason to hard code this stuff into your app. You might discover later that iPad Pros require better-quality uploads! Don’t make your users wait for a new version to start uploading better content.</p><p><strong>Which In-App Purchases to show<br></strong>If you have any in-app purchases in your app, you will probably want to offer holiday specials, and you’ll probably want short-term sales from time to time. Hard-coding this stuff in your binary is a fool’s errand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*oKhV7WUFjovPtIssTA07Zw.png" /></figure><p>A long time ago, before remote configuration, we were doing an in-app purchase promotion where the price would change at a certain date. Effectively, I was hard-coding a date into my app and showing a different in-app purchase. This, clearly, was a bad idea. But my server team didn’t have the bandwidth right then to make this a remote config, so I crossed my fingers and hoped that the in-app purchase would be different on the right date. You definitely should control this from your server(s).</p><p><strong>Use Different Values Based on Device, Software Version, OS, etc.</strong></p><p>In whatever remote config system you use, you should send up some local device and app settings, like:</p><ul><li>Hardware Model (e.g. <em>iPhone7,1</em>)</li><li>OS (e.g. <em>iOS 9.2</em>)</li><li>App Bundle, Version and Build(e.g. <em>com.myapp.TheBestApp, 3.4.1, 34</em>)</li><li>Current Locale (e.g. <em>en_US</em>)</li></ul><p>That way, you can set <em>additional</em> conditions on your config keys based on those settings.</p><p>For example, say a new iPad comes out (hello, iPad Pro!), and you realize it can handle <em>way</em> bigger images in your image-editing app, you can have it return a different value for a “maxImageSize” key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*UDUiPHjb8acLVFkNlPP1tg.gif" /><figcaption><a href="http://www.motherjones.com/mixed-media/2014/07/jaws-ridiculous-say-kids-who-owe-everything-jaws">Source: Mother Jones</a></figcaption></figure><h4>Default Values are Still Useful</h4><p>I know I said you should leave your hard-coding lifestyle behind, but I’m here to say that local values still have their place. One of the obvious questions about moving config the cloud is, of course, what happens during catastrophic network conditions.</p><p>If you have some remote config on your server, but the network is down on the <em>very first time</em> your app tries to reach it you’ll need some kind of fallback. You should use your previous, local hard-coded value (or some reasonable, useful value).</p><ul><li>First, your remote config fetching code should use whatever value it got on the last fetch.</li><li>If that’s not available, look at the config values it cached from the server (and your remote config fetcher <em>should definitely</em> be caching these values).</li><li>If <em>that’s </em>not available, there’s where your locally supplied, hard-coded value comes in to save the day.</li></ul><p>Here’s a simple example. Let’s assume my remote config system periodically fetches all my config keys and keeps a local copy. Then I can have a simple call like this without async handlers:</p><pre>let maxVideoDuration = RemoteConfigForKey(&quot;maxVideoDuration&quot;, 60.0)</pre><p>In this case, I am asking our remote config system to give me the remote value for “maxVideoDuration”. The second parameter, 60.0, is a <strong>reasonable, default value</strong> (hard-coders rejoice!). If my system had <em>never</em> been able to retrieve the config keys, then it wouldn’t have a local copy, and therefore should use this default value.</p><p>I think it’s a simple solution to an unlikely but thorny problem.</p><h4>Remote Configuration is Worth It</h4><p>You might be thinking, <em>remote config sounds cool, but it seems like a pain in the ass just for some small variables.</em> We used to feel that way too. Trust me, having the ability to make things remotely configurable <em>will</em> change how you build your apps.</p><p>We put off building this for ourselves. Once we made <em>one</em> config variable (our uploader video duration), though, we started to add config all over our app.</p><p>I still have local constants in my app. That is just a good habit to have. However, some of the things that I used to hard code are now <em>also</em> configured remotely. That way, I have choices that I can make at <strong>run-time</strong> instead of <strong>compile-time</strong>. And for me, it’s a been a powerful yet simple change to my workflow.</p><p>Ideally, I’d recommend talking to your API team (or developer). Maybe build something on a server yourself (<a href="http://codewithchris.com/tutorial-how-to-use-a-remote-configuration-file-for-your-ios-app/">here’s a guide</a>). If that won’t work, there are some tools people have already built that can help. <a href="https://github.com/mattt/GroundControl">Mattt Thompson’s GroundControl</a> looks awesome.</p><p>We’re also working on a tool to help with this at <a href="https://launchkit.io/">LaunchKit</a>, and if you’d like to see a demo or give feedback on how you’d like it to work, just <a href="/service/mailto:help@launchkit.io?subject=Interested%20in%20cloud%20config%20tool">email us</a>.</p><p>Just put some of your app details on the cloud. Make it easy to add new config variables. Just. Go. Remote.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*M_V2_cmOkBjRO0StRDrKUw.gif" /><figcaption><a href="http://giphy.com/gifs/back-to-the-future-christopher-lloyd-doc-brown-4XPaiZh5DchLG">Source: Giphy</a></figcaption></figure><blockquote>Please <a href="https://twitter.com/rizzledizzle">let me know what you think</a> on Twitter!</blockquote><p><em>Special thanks to </em><a href="https://medium.com/u/9782810e13b5"><em>Taylor</em></a><em>, </em><a href="https://medium.com/u/1468f6fb1a30"><em>Brenden</em></a><em>, </em><a href="https://twitter.com/brennansv"><em>Brennan</em></a><em> and </em><a href="https://twitter.com/judofrog"><em>Richard</em></a><em> for help to proof-read this fever-dream post, and making sure I wasn’t crazy.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1efedc8f893f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/launch-kit/every-app-developer-should-move-their-config-to-the-cloud-here-s-why-1efedc8f893f">Every app developer should move their config to the cloud. Here’s why.</a> was originally published in <a href="https://medium.com/launch-kit">LaunchKit Library</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How iOS 9's Safari View Controller could completely change your app’s onboarding experience.]]></title>
            <link>https://medium.com/launch-kit/how-ios-9-s-safari-view-controller-could-completely-change-your-app-s-onboarding-experience-2bcf2305137f?source=rss-67901aa18c39------2</link>
            <guid isPermaLink="false">https://medium.com/p/2bcf2305137f</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[onboarding]]></category>
            <dc:creator><![CDATA[Riz]]></dc:creator>
            <pubDate>Wed, 15 Jul 2015 15:12:12 GMT</pubDate>
            <atom:updated>2015-08-21T19:04:44.847Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Getting somebody successfully onboarded into your app is fraught with pitfalls and hiccups which prevent them from becoming a regular user. Here’s a potential solution for it.</em></p><p><em>Hey, I’m Rizwan Sattar! I’m working on </em><a href="https://launchkit.io/"><em>LaunchKit</em></a><em>, a set of tools to help mobile makers launch apps, and </em><a href="https://cluster.co/"><em>Cluster</em></a><em>, an app for sharing to small groups.</em></p><p><em>In March 2008, I was lucky to be invited by Apple to check out the unreleased iPhone SDK, and it changed my career. I’ve been working on iOS projects ever since.</em></p><p>Every social app out there relies on some form of invitation to get people to become new users. It usually involves an email or SMS sent to prospective new users, enticing them to sign up.</p><p>On the web, or where people are using computers, this generally is considered a Solved Problem™. The user clicks a link with a special, unique code in it, instantly identifying them on the webpage, allowing the site to tailor the onboarding experience for the new person.</p><p>In an iOS app, there are 2 additional complications:</p><ol><li>The invited user must download an app.</li><li>The app has <em>no idea</em> who the user is, or where they came from.</li></ol><p>This means that even the best invitation flow looks like this:</p><ul><li>User receives an email from someone to be friends in a new iOS app.</li><li>User clicks on a special link in the email, which opens a webpage in Mobile Safari.</li><li>Knowing who the recipient was, the web app eases the signup process by pre-filling data.</li><li>User signs up at the site, and decides to download the iOS app.</li><li><strong>When she starts the iOS app, she’s unexpectedly presented with a sign-up or login screen</strong>.</li></ul><blockquote><em>Before iOS 9, there’s no way for your app to know anything about who the user is, or even that the user visited the company’s website and signed up for an account.</em></blockquote><p>At this point, you would think the user would intuitively just log in to the app using the same credentials she used on the site. However, <a href="http://uxmyths.com/post/715988395/myth-you-are-like-your-users">you are not your users</a>, and many things can go wrong:</p><ul><li>Some get frustrated, feeling like they <em>just</em> did this (which they did).</li><li>Some others people will mistakenly try to sign up again.</li><li>There’s even some that will sign up with <a href="https://library.launchkit.io/the-unexpected-costs-of-third-party-login-cda41c087653">a different email address</a> than the one they were invited with, which complicates private sharing apps.</li><li>They have forgotten their password or even email address they used to sign in with (see 2nd bullet)</li></ul><p>Luckily, Apple has been listening and watching how native apps have been struggling to transition a user from the web to an app and have offered a few solutions over the years, but they’re not so great, as you’ll see.</p><p>I’m going to show you how iOS 9&#39;s Safari View Controllers might make this way easier, but first let’s take a look at what the current tools by Apple are:</p><h4><a href="https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/PromotingAppswithAppBanners/PromotingAppswithAppBanners.html">Smart App Banner</a></h4><p>The first not-so-great solution by Apple is Smart App Banners. When your user is viewing your site in Mobile Safari, a banner can display across the top that lets you open this page within the app. With this, a trick can be to include some sort of auth token within the url, so when the app receives the url, it can perform a behind-the-scenes sign in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*amdn7FLZZavTHchWB7NKMg.jpeg" /></figure><p>However, this only works if the app is already installed, which a new user is not likely to have. If the app is not installed initially, the smart app banner shows an “Install” link, which takes you to the App Store. After installing the app, the user would have to <em>know</em> to return to the website, <em>then</em> press “Open” in the app banner in order to sign in. This makes the Smart App Banner not a realistic helper in the onboarding process.</p><p>I can’t completely discredit Apple here though, because I don’t think they were designed to help this onboarding problem.</p><h4><a href="https://developer.apple.com/library/ios/documentation/Security/Reference/SharedWebCredentialsRef/">Shared Web Credentials</a></h4><p>The next not-optimal solution that Apple came up with is Shared Web Credentials. Essentially, if you save your passwords to iCloud Keychain (which you generally turn on at setup), then the app can access the passwords.</p><p>You can create a special <strong>apple-app-site-association</strong> file to the root of your website, and it will whitelist any apps which can access any saved passwords that the user may have stored while signing in on the web.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kI-VBzrvFU_xtRP-qqxVcw.png" /><figcaption>The user has to agree to save their password for iCloud Keychain to work, making it not great.</figcaption></figure><p>In the native app, it can query the shared web credentials and get access to the email and password and sign you in.</p><p>However, in my opinion, this is not been a great solution: a) iCloud Keychain needs to be enabled, b) your site needs to have some of a password login, and c) the user must agree to save their password to iCloud Keychain <em>before</em> running your iOS app.</p><h3>Introducing Safari View Controller</h3><p>At <a href="https://developer.apple.com/wwdc/">WWDC 2015</a>, Apple <a href="https://developer.apple.com/videos/wwdc/2015/?id=504">introduced Safari View Controller</a> as a way for developers not to have to create mini-browsers of their own, to show small bits of web content inside their own apps. (Like what happens when you tap a link in the Twitter app: Rather than go to Mobile Safari, Twitter will open its own browser window for you to view the content).</p><p>Safari View Controller is a pre-built browser that has all the bells and whistles of Mobile Safari, but can be presented without leaving your app.</p><p><a href="https://twitter.com/rmondello">Ricky Mondello</a>, a Safari and WebKit engineer at Apple, <a href="http://asciiwwdc.com/2015/sessions/504">says</a> (emphasis mine):</p><blockquote>And with Safari in the name, Safari View Controller brings features that your users already love from Safari, but now they’re in your app.</blockquote><blockquote><strong>Let’s start off, first and foremost Safari View Controller shares cookies with Safari and other website data.</strong></blockquote><blockquote><strong>So what this means is if one of your users is already logged into a website in Safari, if they tap a link in your app and Safari View Controller comes up they might still be logged in</strong>.</blockquote><p>But there’s something else nobody has been focusing on: In addition to third-party services being logged in, <em>you can also see if YOUR users are logged into your web app already</em>, so you can seamlessly sign them into your iOS app!</p><h4>A Real-World Example</h4><p>For the last couple of years, I’ve worked on <a href="https://cluster.co/">Cluster</a>, an app for sharing photos and videos with small groups of people. Think Instagram mixed with privacy and multiple feeds.</p><p>One of the biggest challenges for Cluster (and any app where content is shared to specific people only) is how to invite someone easily, and have them identify themselves to Cluster the same way they were invited (i.e. they use the same email address to sign-up with, that they were invited with).</p><p>For the longest time our solution has been:</p><ul><li>When the user receives an email or sms invite, they click a link, which takes them to Mobile Safari and gets them to sign up on the web.</li><li>Then we encourage them to download the iOS app and use that instead (Cluster is primarily heavy media sharing, so works better in a native app)</li><li>Hope/cross fingers/pray that they sign in with the same account they just created.</li></ul><p>For the most part, it works ok, but we still have people accidentally making new accounts with different email addresses, simply because they forgot what email address they had originally used. Then, they wonder why none of their private groups are showing up. To them it is as if Cluster completely “lost” their data.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fzippy.gfycat.com%2FTinyPoorIchthyosaurs.mp4&amp;src_secure=1&amp;url=http%3A%2F%2Fgfycat.com%2FTinyPoorIchthyosaurs&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FTinyPoorIchthyosaurs-thumb100.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=video%2Fmp4&amp;schema=gfycat" width="374" height="664" frameborder="0" scrolling="no"><a href="https://medium.com/media/d2134f2da010070cf6a12be21825a6ff/href">https://medium.com/media/d2134f2da010070cf6a12be21825a6ff/href</a></iframe><p>One workaround to this has been to somehow talk to our webpage, and maybe find out who the user is. We used a “Safari Bounce” technique where, from our app, we open a special URL on our site asking for a auto-login token. The server then checks the browser cookies to identify the user, generates a one-time token to sign in, and bounces back to our iOS app with the token in the URL.</p><h4>Improving the “Safari Bounce”</h4><p>Since Safari View Controller shares cookies with Mobile Safari, launching it within our own app should at least let us do do the “Safari Bounce”, but much faster:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fzippy.gfycat.com%2FNeighboringFearfulHorsemouse.mp4&amp;src_secure=1&amp;url=http%3A%2F%2Fgfycat.com%2FNeighboringFearfulHorsemouse&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FNeighboringFearfulHorsemouse-thumb100.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=video%2Fmp4&amp;schema=gfycat" width="370" height="662" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8bc9d67b8e6402e74e66b2769ffe527/href">https://medium.com/media/b8bc9d67b8e6402e74e66b2769ffe527/href</a></iframe><p>Rather than opening a URL in Mobile Safari, you simply create an SFSafariViewController instance, give it the URL, and present it modally.</p><p>The mechanics are the same as launching Mobile Safari; the webpage is still redirecting back to our app using an URL scheme*, even though it looks like it was communicating directly with our app.</p><p>This already feels better. Apple even wants you to use Safari View Controller for OAuth in this way! The transition to opening the webpage feels smoother, and is generally a faster experience.</p><p>Still, there’s <em>a lot happening on-screen</em>, and it feels slightly janky. <strong>Could we do even better?</strong></p><h4>Hidden Safari View Controller</h4><p>What if we briefly launched a SFSafariViewController instance <em>hidden and without animation</em>?</p><blockquote>It turns out, it totally works.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fzippy.gfycat.com%2FLimpingHappygoluckyArgentinehornedfrog.mp4&amp;src_secure=1&amp;url=http%3A%2F%2Fgfycat.com%2FLimpingHappygoluckyArgentinehornedfrog&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FLimpingHappygoluckyArgentinehornedfrog-thumb100.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=video%2Fmp4&amp;schema=gfycat" width="374" height="664" frameborder="0" scrolling="no"><a href="https://medium.com/media/037f914342ab56cb2e7abb9caeda65df/href">https://medium.com/media/037f914342ab56cb2e7abb9caeda65df/href</a></iframe><p>In the past I always worried about building a seamless first-time experience for our users. None of the “magic” solutions felt elegant.</p><p>Using a hidden Safari View Controller to help identify your user removes user confusion and makes your app feel magical when users use it for the first time.</p><h3>What Is Now Possible</h3><p>With Safari View Controller, we now will have a way to “talk” to our webpage and learn a little bit about who the user is, and what they were doing, so we can do all of the following:</p><ul><li>If the user already is logged into the website, you can seamlessly sign them in, without prompting them to check their Shared Web Credentials. This is still secure, since the website would have to have an API built that would do the redirect back to the app for you.</li><li>If they are not logged in, tailor the onboarding experience for that specific user linked via the special code in the original URL that was tapped. (e.g. “Hi Samantha! Here are some of Jack’s photos he has invited you to see!”)</li><li>Or, if you want to get fancy, you can even change the “intro” UI to be based on which kind of marketing the user came in from. People who use <a href="https://cluster.co/">Cluster</a> come from all kinds of backgrounds: College kids, new moms, grandparents, travelers. So being able to modify the intro UI for a particular kind of person might be very helpful!</li></ul><p><em>Thanks for reading! If you enjoyed this article, I would really appreciate you hitting the </em><strong><em>recommend </em></strong><em>button below. Connect with me on Twitter </em><a href="https://twitter.com/rizzledizzle"><em>@rizzledizzle</em></a><em> with any comments or thoughts.</em></p><p><em>Special thanks to Taylor Hughes (</em><a href="https://twitter.com/taylorhughes"><em>@taylorhughes</em></a><em>), Brenden Mulligan (</em><a href="https://twitter.com/mulligan"><em>@mulligan</em></a><em>), Felix Krause (</em><a href="https://twitter.com/krausefx"><em>@krausefx</em></a><em>), and Sam Soffes (</em><a href="https://twitter.com/soffes"><em>@soffes</em></a><em>) for looking over this post to ensure I’m not a crazy person.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bcf2305137f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/launch-kit/how-ios-9-s-safari-view-controller-could-completely-change-your-app-s-onboarding-experience-2bcf2305137f">How iOS 9&#39;s Safari View Controller could completely change your app’s onboarding experience.</a> was originally published in <a href="https://medium.com/launch-kit">LaunchKit Library</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>