Appiness.io blog

03 Jun 2014
by Admin

Apple Swift Programming Language

Well, you probably heard about it already. Apple unveiled a new language called Swift at yesterday’s WWDC.

What, a new language you say?

Yes, indeed, a new language. To understand why they’d rock the ecosystem so much and force you to reopen you grey matter, it helps to take a look at the history of the current set of development tools.

As you know, developing natively for iOS is done using xcode and Objective-C. XCode is actually quite a nice and rich IDE. The real issue comes with Objective-C. C is around 40 years old (Who hasn’t read Kerningham and Richie) and Objective-C isn’t much newer. It’s claim to fame was during Jobs’ respite from Apple when he founded NExT…and in fact, Objective-C is still littered with NExT remnants, such as NSString etc. In short, the language hasn’t evolved a whole lot and we’re carrying a lot of legacy baggage with it. People have also said Objective-C has mysterious syntax, what with all the [[‘s.

So, enter Swift.

The first major difference between Swift and Objective-C is the fact that Swift is a scripting language. Meaning you can interactively execute code, interrogate variables, make changes etc. My simplistic explanation is think of coding permanently in debug mode 🙂 Scripting languages have become popular…originally they were frowned upon for performance reasons but optimizations have largely voided that argument. Python is a great example of a successful scripting language.

So xcode introduces a new concept called Playgrounds which will let Swift developers essentially visualize their script in real-time while coding. Generally speaking, developing in a scripting language should make the development process faster than traditional compiled code. (Note, I said development time, not runtime).

Swift promises a slew of new benefits including closures (yeah ok, Objective-C did have that with Blocks), multiple return types, Generics, namespaces…um yeah ok, not all unique and new, but we can assume it is a capable platform built for the modern day operating system.

One of the first questions people had was “Can I still use Objective-C” – and the answer is yes. However, it is likely that Apple will be pushing hard to move the developer community over to Swift as the de facto standard going forward.

Here is a snippet of Hello World in Swift:

// Playground – noun: a place where people can play
var s = “Hello” + ” World.”

import Cocoa

let hero = NSImage(name: “myimage”);
let images = [“round, “star”, “heart”].ma[ {
NSImage(named: $0)
}

What you don’t see in above is that with Xcode, on the right hand side you’d see the results of each statement live as if it executed. That is the cool part about the playgrounds and it being a scripting language. Personally, the syntax will still need to grow on me – you do not need to use the ‘let’ syntax fortunately. Oh, and wait..I started talking about the legacy NS prefixes and guess what, they’re still there 🙁

Apple claims that Swift was designed to be fast. And remember, it is a scripting language during the development cycles but then turned into native optimized code for deployment.

All in all, I think this will be a good thing. Yes, we need to learn a new language. But let’s face it. It’s really only syntax. Logic is still logic. True still equals !False. And on the bright side, you can’t see job descriptions requiring 5 years of Swift on iOS.

09 May 2014
by Admin

Parse, a really neat BaaS

Hello App developers!

If you haven’t yet checked out Parse.com, you owe it to yourself to hop on over and give them a try. Parse is one of the players in the Backend-as-a-service (BaaS) vertical. If you’re not yet familiar with BaaS, it’s basically where you use a hosted server and database for your app or web app. Imagine if you want to create a mobile app that, say, stores contacts, but not on the phone, and rather on the “cloud” or a hosted database. Traditionally, you’d need to write not just the app, but also the server code…say a PHP script running on a mysql database. Well, with a BaaS, you can focus on the mobile app part, and use the BaaS to store your data. And of course I’m simplifying it here. You can do so much more.

There are a few BaaS providers out there including Parse, Kinvey and Quickblox. Right now I’m writing about Parse but certainly check out the others too.

Where Parse really shines is in the API provided for various platforms. You can natively hook in with iOS, Android, Windows, Unity3d and more. Plus you can make pure http requests. And the API is very rich. I used the iOS API and very quickly created a little app with all the bells and whistles you’d expect, such as “drag to refresh” and more.

Parse.com also shines with the example applications to get you started. They are feature rich and well written, and the accompanying documentation makes learning a snap.

I did have some issues with multi-table queries (complex joins), but was able to work around most of them. They also have a active forum.

From a pricing perspective they have a free tier which will work for most new apps. And if you need to upgrade to a paid tier, congratulations, your app must be doing well.

So, go check out parse.com

And may you have some appiness!

© 2017