Adventures at a Swift Hack Day

Last weekend, I had the chance to drop by a fun and helpful Swift Hack Day event hosted at GitHub headquarters. Swift is the new language announced at WWDC 2014 that developers will use to create mobile apps on all iOS devices– so it’s new to everyone and it’s an exciting time!

Time for some Swift!

The event kicked off with an introductory talk by Natasha the Robot, who writes a lot of other helpful Swift-related blog posts. The event was packed with iOS developers, so the material was well-tailored for people already familiar with Objective-C.

(The material was also well-tailored for fans of the Despicable Me movies!)

Standing-room-only in the speaker area!

She covered new aspects like how to use optionals:

if let actualNumber = possibleNumber.toInt() {
  println("\(possibleNumber) has an integer value of \(actualNumber)")
} else {
  println("\(possibleNumber) could not be converted to an integer")
}

or Downcasting, helpful when you want to divide objects by subclass:

for employee in prolificEmployees {
  if let developer = employee as? Developer {
    println("\(developer.name) programs in \(developer.language)")
  } else if let designer = employee as? Designer {
    println("\(designer.name) designs using \(designer.approach)")
  }
}

Those are just two quick examples, but she also went through how to use Playgrounds, setting default parameters for your methods, type inference, and using tuples in switch-case statements. There was a lot of material, but it was presented very well.

Now, these new things about Swift save a few lines here and there, and but are they enough to justify a new language? That’s a big question that probably only time will tell. But, either way, Apple has thrown its weight behind the language for now. And that’s enough for most people.

Eventually, it came time for some hacking. I spent basically the whole day working through the new Swift by Tutorials book from the fine folks at RayWenderlich.com. It really covers a lot of Swift concepts in-depth, and it’s always good to work through an example piece-by-piece.

As with the best of these events, the biggest takeaway was the collaboration between everyone there. No matter their day job (at big companies, small companies, rival companies, freelance, whatever), everyone was there to learn, experiment, and help each other.

I’ve never liked the myth of the lone genius hacker working in some dark basement on some secret project. If a language like Swift is going to take off and be used for projects that really matter and make the world a better place, a spirit of collaboration and sharing knowledge/practices across the usual boundaries is going to be key.

Besides, it was fun to spend some time working at the GitHub office over the weekend. Octocats everywhere!

Notice the octocat seal :]

  • Matt Luedke

Learning to Love Mondays

We all have our reasons to dread Monday mornings. With thoughts of crowded subway cars, piles of emails and morning meetings filling our heads, it can be tough to pull ourselves out of bed. But at Prolific Interactive, Monday mornings just don’t seem to exist. Between indulging on Bagel Mondays and hearing “The Price is Right” theme playing as the team assembles before our weekly meeting, it’s really hard not to have a cheesy smile on your face.

From Pancakes to Prolific

Before joining the team, I was temping and finding my way through, trying to get a steady job that I really enjoyed. In the meantime, I was writing for a music blog that I loved on the side called Pancakes and Whiskey (yes, they really do go well together!). Still, I set out to search for a job that would let me join a new community in an office setting. I have always been fascinated by start-up companies and have admired the people behind the scenes who work to make new ideas a reality, so I was immediately attracted to Prolific upon discovering it.

When I first looked through Prolific’s Instagram, I was struck by the colorful company vibe and knew I had to work there. Further investigation proved that not only did they seem like an awesome bunch of people to work with, but they had some of the coolest clients around. My first day proved all of my assumptions right. I had never felt so much excitement, both on my end and from the employees at Prolific.

Balancing Act

I am both Prolific’s Executive Assistant and Office Manager, which can be exciting but tough at the same time. Balancing this dual role keeps me very busy, but thankfully with a hot cup of coffee in hand, nothing is impossible. Both roles are crucial to keeping the wheels going in the Prolific office, and there are only so many hours in the day to do so much. Therefore, time management and multitasking are definitely key to keeping things running smoothly. Planning, budgeting, and executing certain office projects can be a bit of a pain sometimes, but with the right attitude and tools it can always be done right.

Since my first day, I’ve been able to enjoy Prolific more and more. As crazy and busy as it gets sometimes, I know I can always have a random good laugh with the people around me. I’m very glad to have found a place where my peers are willing to help out in any way they can. The anxiety I had over finding a steady job and starting a new opportunity has dissipated with their support, and I look forward to working with these people every day as time goes on.

  • Karen Silva

Apple Pay for Developers

You may have missed it — with the rapid-fire announcements and intermittent Chinese translation, there was a lot to keep track of during last week’s Apple keynote — but sandwiched between the unveiling of the new iPhones-for-Giants and the much-rumored watch, Apple quietly revolutionized mobile e-commerce.

I’m talking about Apple Pay. The headline was NFC, which lets you pay for retail goods by waving your phone (or watch) at a point of sale terminal (and which Prolific’s own Russ Wallace had an excellent writeup on last week). But buried in a footnote was an API for third parties to securely accept payments in-app. Here at Prolific, we make a lot of apps that accept payments, and we’re very excited about Apple Pay for two major reasons:

The first is experience. We all know checking out on mobile can suck. Sure, we can make the forms elegant, and snapping a photo of your card goes a long way when it actually works. But ultimately, you’re left entering a ton of information on a tiny iPhone keyboard and wondering if you really need to buy that dog hammock after all. Now imagine if your app didn’t even need to pop up the keyboard once during the checkout process. Apple promises to make that dream a reality. Buying a product from an app can finally be as simple as buying it in a store.

The second reason is trust. Every month or so there’s a new high-profile exploit targeting a major brand. And who hasn’t heard of a friend or relative getting their identity stolen? Each time I hear one of these stories, I think a little harder before giving up my credit card details — and that’s to say nothing of the irrational fears lodged deep in the hearts of the less tech-savvy among us. (“But if I give them my credit card, the criminals will mine me for Bitcoin! I heard it on CNN.”) Apple Pay really is more secure: credit card numbers aren’t even stored on the phone, and merchants only receive a one-time payment token. And with Apple’s marketing clout, users will surely be in the loop, and the engendered trust will transfer to your app. (For more info on Apple Pay’s security features, I recommend checking out Russ Wallace’s aforelinked summary.)

How does it work?

From the user’s perspective, it couldn’t be any simpler — you tap a “Pay with Pay” button, and a standardized sheet pops up. Choose your billing address and credit card from a list of pre-filled options, and maybe shipping address too if it’s different from billing. Pick your shipping method right from the sheet. Then hold the Touch ID sensor to verify your identity, and… that’s it! The checkout process is complete. Wasn’t that painless?

Now that we know what the experience looks like, let’s dig into some code!

…But first, some caveats

In order to process an Apple Pay-ment, you’ll need to be using a compatible payment processor. Apple provides the following list:
- Authorize.Net
- Chase Paymentech
- CyberSource
- First Data
- Stripe
- TSYS

Apparently you can also handle the encryption and decryption of the payment token on your own — but there’s zero documentation and it’s definitely not the sanctioned way to do it. Quoth Apple (PDF link): “Handling credit and debit card payments can be complicated and unless you already have the expertise and systems in place, an SDK from a payment provider is the quickest and most reliable way to support Apple Pay in your app.” So if you want to support Apple Pay, sign up for one of those processors.

There’s also a limit to how much of the flow we can test so far. To complete the checkout process, you’ll need an Apple Pay Merchant ID, certificate, and entitlement from the Developer Center. Conveniently, none of those are available as of this post. And since you can’t test Touch ID or Secure Element on the simulator, you’ll need to test on-device on an iPhone 6.

Implementation

But even if we can’t complete a payment, we can still test a lot of the flow. I’ll keep this pretty high-level, but I’ve put some well-commented sample code on Github for a bit more info.

We’ll start with an instance of PKPaymentRequest. This class (and all is part of PassKit, the framework that handles Passbook, which makes sense since that’s where users enter their credit card info to begin with. The PKPaymentRequest instance will hold all of the cart items, shipping methods, and options for our checkout process — think of it as Apple Pay’s cart.

PKPaymentRequest *request = [PKPaymentRequest new];

Let’s add some items to buy:

PKPaymentSummaryItem *item1 = [PKPaymentSummaryItem summaryItemWithLabel:@“Dog Hammock” amount:[[NSNumber numberWithFloat:25.99f] decimalValue]]];
PKPaymentSummaryItem *item1 = [PKPaymentSummaryItem summaryItemWithLabel:@“Total” amount:[[NSNumber numberWithFloat:25.99f] decimalValue]]];
request paymentSummaryItems = @[item1, total];

We’ll want to set some more properties on our request — including shipping methods, our merchant ID, and various configuration options. You can find those all in the demo code on Github or in Apple’s documentation. Meanwhile, let’s skip to the good part: presenting the payment interface to the user:

PKPaymentAuthorizationViewController *authVC = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:request];
authVC.delegate = self;
[self presentViewController:authVC animated:YES completion:nil];

Now the user should be presented with a screen that looks something like this:

If we want to get the results of the transaction, or updates on its progress, we’ll have to implement some delegate methods. Besides reacting to a successful, failed, or cancelled payment, we can get a notification when the user updates their shipping address, and update the shipping methods accordingly (or cancel the transaction, if they’re outside our shippable zone). Similarly, we can learn when the user chooses a shipping method and update the total to account for the added cost. (For a complete list of these methods, look at the docs for PKPaymentAuthorizationViewControllerDelegate).

Here at Prolific, we can’t wait to integrate Apple Pay into our apps — it promises to provide a first-party solution to many of our checkout woes. I’m sure we’ll have more posts to come as we learn more about how it works in the wild and its adoption among users of our apps. In the meantime, feel free to play with the sample app and, if you discover anything cool, submit a pull request. We’d love to explore these new APIs together!

Further Reading

Apple has an Apple Pay page for developers, though it’s remarkably light on technical details. It’s a good place to start, and presumably they’ll update it with more info as the platform approaches production. They also provide documentation for all of the classes related to Apple Pay. Start with the docs for PKPaymentRequest.

Stripe announced support for Apple Pay in their SDK on day 1, including processing tokens and convenience methods for generating the PKPaymentRequest and PKPaymentAuthorizationViewController. Look through their docs for more info. It’s also worth referencing their SDK on Github, as well as their sample app.

  • Max Mamis

Apps We’re Loving

As much time as we spend creating the best apps we can for our own partners, we are constantly on the lookout for other fun, creative and innovative apps on the market today. We like to consider ourselves mobile experts, so here are a few of the apps we’re loving right now, as reviewed by our own Conor Dawson, Dan Sullivan and Paul Miard.

CITYMAPPER

Reviewed by Conor Dawson, Software Engineer

Citymapper is an urban area focused mapping app that incorporates all forms of transportation available in that city. It has replaced Google Maps on my phone as my go-to for getting from place to place in NYC. Citymapper has all the information you need to traverse your city of choice. When I am in New York, it gives me route information for walking, biking, Citi-Biking, driving, taking the subway, taking the bus, and taking the LIRR. These options are all shown on one convenient result page with times for each option, allowing me to quickly access the best option. If you are walking or biking it also gives you the number of calories that will be burned on your journey. As an avid Citi-Biker, the biking directions are especially handy. Not only does it plan out a route for me, but it also shows me where the closest available bikes are, as well as the closest dock to my destination. This saves me a ton of time and prevents me from using multiple apps to get directions and locate bikes. Driving directions are also useful, providing a cab fare estimation that can help you decide if taking that cab to avoid the rain is really worth it. Additionally, Citymapper has subway maps built into it so you can navigate those routes even without a network connection. It also pulls in service information to help better plan your subway route, preventing you from getting stranded somewhere because the F isn’t running, for example. The app also allows you to quickly share directions, making meet-ups with friends really easy.

    

Currently, the app is only available in New York, Boston, DC, Chicago, San Francisco, London, Madrid, Paris, Barcelona, and Berlin. However, they are working on adding new cities all the time. You can even vote for which city you would like them to add next! Overall, it is a useful and good-looking app that has made navigating NYC a breeze.

            


FLICKR

Reviewed by Dan Sullivan, Director of Design

Flickr 3.0 for iOS is the first major refresh for the company’s mobile app. Sporting a complete visual redesign and new photo and video shooting features, Flickr is looking to join the ranks of other media sharing apps, namely Instagram. Feature set aside, I was drawn to the app’s modern visual design and its well-thought-out UI animation.

The onboarding screens are really well done. The detailed illustrations combined with the parallax swipe effect create a unique experience that sets the stage for other unique visuals.

The view refresh loader has a two-part animation which plays nicely off the Flickr logo. Transitioning from grid to full image view is seamless, and the outlined icons and white text look sharp on the metadata view.

Even the follow buttons have an interesting transformative animation when activated and deactivated.

This is just a sample of the well-thought-out and detailed UI that Flickr 3.0 for iOS has to offer, which is refreshing to see from a company who hasn’t had much of a presence in the mobile space.


UMANO

Reviewed by Paul Miard, Senior iOS Engineer

Umano is the best way to listen to the web. It’s your perfect hands-free companion when you’re looking to listen to something other than music or a book. Think about it as the Audible of news articles and other blog posts.

       

Umano features a virtually unlimited amount of articles from the web, all narrated by professional voice-actors. You can find articles via the “Stories” or “Popular” tabs, or you can subscribe to channels of your choice for a more personalized feed.

      

Both the narration and the app’s design and UX are high quality, and the overall experience is very enjoyable. The app easily allows you to set up a playlist (based on your interests or time available), access original articles, share them with friends or review your activity, such as “likes” or “listen history”. I personally use it when commuting, whether I’m on the subway or on my bike. It even features a slick car mode that helps you keep your eyes on the road rather than on your phone.

The app works on both iOS and Android, and you can even listen to articles directly from your web browser. In case you find an article you’d like to listen to later, it also comes with a great browser extension. If the article has already been narrated it will be automatically added to your playlist. Otherwise, it will be submitted to Umano and you’ll be notified when it’s ready! Umano in its free version is very enjoyable, but if you want to create a bigger playlist or listen to articles while offline, you can subscribe to Umano premium for $3.99 a month. Whether you want to be thankful to Umano for their great service or are interested in those features, it is definitely worth it in my opinion! You can download it here.

  • Bailey Bennett

Social Engineering

I came from a series of jobs that were positive career moves at the time, but also terribly isolating. Development was the last piece in a long chain of moving parts. As a developer, this is something you get somewhat used to; the vast majority of your working time is spent interacting with a computer, its output contained in text files that are subsequently converted into a series of 1’s and 0’s. You basically become the stereotype of a person sitting in their basement, whittling away on their computer as they consume never-ending supplies of pizza and Red Bull.

Interconnected Gears

When I was looking to move to a new position, I wanted something to change that isolation and make it a more social experience — an experience that broke the mold of what I had been used to. I had come to realize that development needed to be a more pertinent and involved part of the entire process, and I wanted to be a part of a company that believed that. So I oriented my job search to just that: a modern company at which the process was a series of interconnected gears rather than disparate chains in a long sequence of paths.

I found Prolific through a Google search for mobile tech companies in New York and was immediately taken by their website. The presentation was vibrant and colorful, cool and confident. The pages were filled with the people who actually worked there, not just stock photos of people standing in well-lit rooms with wireless headsets wrapped around their emphatically fake smiles. Their social media presentation was equally as interested in its products and clients as it was in the bodies that put the time and energy into making those things a reality.

Chaos and Control

My day-to-day life here has really hammered home the fact that I’ve found what I was looking for. From day one, I was asked my opinions and thoughts on processes; my input was valued and being actively sought out. I have been a part of design meetings in which I’ve played an active role in guiding the project forward. It no longer feels that the parts of the project are separated, but instead are all interconnected, allowing for a work flow completely different from what I had experienced before.

Time and time again, I have been asked, “Is this what you were expecting?”, and every time I cheat and say, “I didn’t know what to expect,” because everything about Prolific has seemingly been built in a way to disarm you. I have never worked in a place where development feels both chaotic and controlled and where involvement in a team effort is always expected of you. It is extremely refreshing. I also feel like it is pushing us to make the best product possible in the most efficient of ways. Development no longer feels isolating but completely involved in an on-going and ever-changing process.

  • Christopher Jones