Summit gem cover?fm=jpg&fl=progressive&q=75&w=300

View from the Other Side

Using native versus web apps for mobile platforms is an ongoing battle. In the midst of this debate, Gem Barrett explains why app developers should care about the introduction of Swift. Drawing from her own experiences as a web developer, Gem discusses how, at the time, Swift’s closed-off approach and unstable features were more than enough to put off many developers.

View from the Other Side (0:00)

I am a web developer by day, and a Swift & iOS developer by night. I am also a student, and coming to the end of my degree! Today, I want to give a different viewpoint of Swift. Why should you care about what web developers think? It’s not really something that affects you that much, but is maybe something to think about in the future.

Insurance (0:49)

One of the main points to care is for insurance’s sake. We don’t really know who is going to win the native-web debate. If native wins, then obviously you all will be happy. But, you will have web developers coming over and filling up your space. You can help them be better by understanding their point of view in advance. But if web wins, then you might be jumping over, and you’ll want to make friends.

Solidarity (1:30)

We are all in this on the programming side, so we should get rid of the barriers in the web-native argument. The media use the term “war”; I’m trying to avoid using that, because there isn’t really any need. If you strip away the different programming languages, then we’re all just geeks underneath. So, it would be nice if we could kind of join together in unity.

Get more development news like this

Politeness (2:01)

You should also care out of politeness. You are all here, so you might as well listen, even if it’s only out of politeness.

View 1: Don’t Touch This! (2:10)

How do web developers think of Swift? There are a lot of articles that warn about touching Swift from the web developer’s point of view. They tend to go on a lot about just how unstable and new it is, and how it is a closed garden. So, a lot of developers haven’t really bothered to look at it. They hear a lot about how Swift is similar to JavaScript, but they then look at it and decide to stick with what they know.

View 2: Unstable (2:57)

We do see a lot of Swift as unstable. As web developers, we get a lot of new frameworks thrown at us every day. You might take a week off, only to come back and five or six new frameworks to try and various things for data visualization. It’s quite exciting, but you learn to be skeptical about jumping into new things just in case they don’t last.

This is particularly the case with single-page application frameworks. The top three are Ember, Angular, and Backbone, and there are always big discussions about which one is the best and worth learning. As a developer, that it’s too difficult to learn all three in a short amount of time, so you just end up waiting to see which one wins.

You become a bit more skeptical, too. A lot of web developers I’ve spoken to have a similar view of Swift. It hasn’t been out for very long, so they’re not really sure about it. There are also big changes between versions, which puts you on unsteady ground. When you’re still learning it, it’s crazy to have code that once worked, but is now broken.

There was some code that worked for a while. You go through new versions, and it would still be okay. A couple of little warnings come up, but you could deal with that. Then another version would come out, but it would be a major one and cause everything to break. It was just red lights everywhere, and it gets a little bit frustrating.

View 3: Secrecy (4:55)

We also have a lot of open source frameworks on the web side. We like to contribute to them, suggest new features, fix bugs, among other things. You can get far more involved, But with Swift, people aren’t really sure what is underneath. They don’t know what it’s made of. They can read about it, but they can’t actually dig into it very far, and you can’t contribute to it. That secrecy side is a little bit off-putting. But then you have people like you, Swift developers, who create awesome things. We can dig into your code, so that’s cool.

Swift is like…Vodka (5:47)

I’m going to get a little bit weird here. Most people would say that Swift is like JavaScript, and a few people have, interestingly enough, said Scala. Swift is like, now most people would say JavaScript. I’m going to suggest vodka, the drink. That’s not some new hipster term for a weird framework or anything like that. Definitely, vodka. I have some weird reasoning behind this, so stay with me.

Now, the comedian Dylan Moran has a very interesting view on vodka:

Vodka is a very deceptive drink because you drink it and you think “What is this? This is pointless! It’s - you can’t taste it, you can’t smell it… Why did we waste our money on this bloody - why are we on a traffic island?”

  • Dylan Moran

I have a similar view of Swift, to be perfectly honest. So, I’ve slightly tweaked the quote:

Swift is a very deceptive language because you look at it and you think “What is this? This is pointless! It’s - you can’t rely it, you can’t contribute to it… Why did I waste my time on this bloody - wait, how the hell did that work so easily?”

  • Gem Barrett

My Experience (7:11)

There’s this little thing that I built using the Steam API, and a few of you may have seen this already. So, I built using Swift and a little bit of Objective-C on the underside. I started on it but felt like I was wasting my time. I was falling back too much on Objective-C, and I didn’t really know quite what was happening. Then, I went to a conference, and I was surrounded by developers like yourselves. I don’t know what it was; I think it was the atmosphere, but I suddenly felt like I could do it. Within 24 hours, I had built 99% of the functionality of it. I had stripped out a lot of the Objective-C, and I was pretty pleased with it.

This code links up to the Steam API, grabs your games, pulls through all the little icons and all the news articles, and then you can go through and read them. The WebView is the only bit that is not Swift, because obviously it’s WebView. This is my favorite line of code that I’ve ever written, to be perfectly honest.

games = games.sorted {$0.playingTime > $1.playingTime}

It’s so concise and readable, and it really shows the power of Swift fantastically. As you can see, it grabs the games and organizes them by playing time so that you have your favorite games at the top. It’s quite simple, but organizing them like that in a web-based language would require a lot of loops and other weird and wonderful thing. It would be far more than one line of code, and that is the highlight of Swift for me.

Final Thoughts (10:14)

The thing I didn’t mention at the beginning is that there is obviously a third part in the web/native divide: hybrid. Obviously, the DOM isn’t going to get any faster, but there are things like the canvas element in HTML5, React, and various others that could possibly be the way forward. There are famous apps that already use WebViews, and you wouldn’t actually know about it because they’re so very subtle.

A lot of people have this fear of hybrids, as they’re the slightly hacky, cheating route. I understand that, because even though I’m a hybrid between the web and native, I am still a purist on both of those. So, I do also look at hybrid solutions with a bit of skepticism. But to be fair, they are only as bad as the developer and designers who work on them are.

Swift has already proved that is has the staying power. If it didn’t, we wouldn’t have this kind of organization and conference going on. I think that the gap between web and native is going to get smaller, until we’re a bit more unified and there are a few more common standards established on both sides.

Q&A (12:30)

Q: Are there any nice frameworks in JavaScript or on the web that we could learn from and take back or copy in Swift?

Gem: Off the top of my head, I don’t know. They’re all more for single-page applications, which are a massive thing at the moment, on the web side. That’s where a lot of things are coming out. It would be nice if there was more data visualization options on the app side. You have tools like D3, which is just fantastic, and you can do incredible things with that. So, it would be nice if there was a few more options on the Swift side for doing data visualization and apps.

About the content

This talk was delivered live in March 2015 at Swift Summit London. The video was transcribed by Realm and is published here with the permission of the conference organizers.

Gem Barrett

Gem Barrett

4 design patterns for a RESTless mobile integration »