Thoughts on WWDC14

Some quick thoughts from Secret Lab on the mind-blowing collection of WWDC 2014 announcements from Apple.

OS X Yosemite

Pretty! Made simpler. Not super sold on translucency, though.

Handoffs and Continuity is awesome. Will be super useful. Devs get access to this too. Reminds us of the excellent “Send to Chrome” feature in Android. Only really polished.

iOS 8

Not a huge amount of new stuff, visuals wise; however, there are some awesome behind the scenes changes.

Custom Actions, Photo Editing, Sharing Options can all be provided by apps. You can make your app provide services to other apps. This is AWESOME - it’s going to make the app ecosystem quite a bit richer.

Android’s had this for some time, and it’s great to see it in iOS.

The ability to put widgets in the notification center is also great, lots of devs are going to make some great stuff with this.

Being able to share documents between apps without having to copy them is going to be Super Nifty. This has been a real weakness of iOS until now.

Swift

WOW. Apple developed an entire language, wrote all the docs, and wrote all the supporting tools for it, without it leaking. This is really impressive.Can’t wait to use this.

The language is very modern. Its syntax feels like a mashup of Python, Haskell and Ruby.

Interoperation with Obj-C is rather nicely handled. They’ve directly translated ObjC’s arguments-are-embedded-into-method names approach into named parameters. The goal was clearly to make it as painless as possible to work with both languages in a single project.

Something that’s interesting is it’s completely opposed to Objective-C’s way of doing things is that, while ObjC allows sending messages to nil (thereby making it safe to not have to do null checks), Swift instead guarantees that all values that are not Optionals are non-null. Optionals are a very cool feature: in other languages, the concept of “nothing” is usually represented by a special value (for example, Lua’s ‘nil’ value), or by convention (for example, in C, the value 0 means ‘nothing’). This creates its own problems; if you use a special value, comparing it to other objects means you have to do type conversions, and if you instead use the convention of zero meaning null, you have to do checks. Objective-C goes some of the way towards helping with this: it defines ‘nil’ as a special value that’s represented a zero pointer, but calling methods on it is safe because the runtime automatically returns if it notices you’re trying to call methods on nil.

This is nicer than crashing, but it can lead to problems, since if an object you’re trying to work with is unexpectedly nil, you’ll get bugs. Not crashing bugs, but weird behaviour bugs.

The Optionals system is nicer. In Swift, a value is either guaranteed to be a valid one, or else is explicitly known to sometimes be nil.

For example: if you’re converting strings to integers, your code looks like this:

let theString = "123"

let theInt = theString.toInt()

In most languages, the ‘toInt()’ method would return a value that represents ‘not valid’, such as 0. But in Swift, it returns an optional int - that is, a value that MIGHT represent nothing, but if it doesn’t represent nothing, then it’s GUARANTEED to be an integer and nothing else.

This makes things quite a bit safer, since the compiler’s able to do more checking, and is able to reason about your code better.

Swift is filled with this kind of thing. Another example: in C and similar langauges, the assignment operator (=) returns a value, like this:

a = b = 3 // sets both a and b to 3

In Swift, that doesn’t apply. This means that the following is actually a compiler error (it’s just a warning in ObjC):

if x = y {



}

We’re not huge fans of the range operators: a...b means “range from a to b, including b” and a..b means “range from a to b, not including b”. Notice that they only differ by a single period. That’s going to lead to bugs, due to typos.

The mutability of variables depends on whether or not the variable is declared as a constant or not. This is nicer than Objective-C, which has two different classes for each type based on whether it’s mutable or not (ie NSString vs NSMutableString)

This only applies to strings, arrays, dictionaries, and other low-level things. We’re still going to be stuck with NSURL vs NSMutableURL for a while.

Playground is super cool. Reminds us of IPython, in that you can figure out your code without it having to be run inside a larger app. This is going to make development a lot faster.

App Store

Being able to show videos and make app bundles (with discount) is going to be neat. Not a huge game changer for us, but any increase in app store functionality is good.

Books, and training, and conferences! Oh my!

First, books!

We're very pleased to announce that our latest two books are now available! The first, Learning Cocoa with Objective-C Fourth Editionis an update to our previous third edition book, this time co-written with our frequent collaborator and co-conspirator Tim Nugent. It covers everything existing programmers need to skill up with the latest in iPhone, iPad, and Mac development technologies. 

The second new book is the iOS Game Development Cookbook; it provides a huge range of recipes for common things you need to when building a game for iOS (or any other platform, if you're willing to translate the examples out of Cocoa and Objective-C, or even for things that aren't games if you're creative!)

We're really proud of both of these books, and hope you find them useful and enjoyable! Let us know what you think, or if you have any questions. You can find more details, and links to sample code, on our books page.

Second, training!

If you like our books, then why not try our training? Check out our previous blog post to learn more about our upcoming Melbourne iOS developer training.

Finally, conferences!

We're very pleased to be speaking at the (very awesome) O'Reilly Open Source Convention (OSCON) again this year – for the fourth time in a row! We'll be presenting our mobile app design workshop “Unfortunately, Design Tutorial Has Stopped”, and Other Ways to Infuriate People With Mobile Apps with frequent collaborator Chris Neugebauer, as well as the session How Do I Game Design?, exploring the basics of game design

Additionally, Tim Nugent (our co-author on the latest Learning Cocoa book) will be presenting the session My Friends Keep Leaving and it is Ruining Board Games Day, which explores the state of augmented and remote board gaming; Chris Neugebauer is also presenting the session Portable Logic/Native UI exploring best practices for building mobile apps that need to run on multiple platforms. It's all sure to be excellent! Do try it.

 

iOS Developer Lab, Melbourne

Just a quick post to announce a Melbourne iOS Developer Lab will be running June 20-22. Our iOS Developer Labs are super popular, and usually fill up fast – we take 3 days of your week and bring you up to speed with iOS 7+ development!

Past participants have enjoyed their time learning how to build iPhone and iPad apps with us:

Secret Lab’s iOS Developer Lab stoked the fire to get back into iOS development for me - I was surprised by some of the things I learned along the way. Often the tangents were some of the best stuff, but the core material was a great curriculum!
— Past participant, Melbourne, December 2012
I think this was the best training course I’ve ever done. Secret Lab blew me away with their approachability and willingness to explain and answer my silly questions! Highly recommended.
— Past participant, Brisbane, February 2014

For the next few days you can sign up at the half price rate of $750 AUD + GST. Please email us if you have any questions, or if you'd like a discount for group signups (3+). We're also happy to hear from you if you're currently unemployed or a student and would like to chat about special prices. You can learn more about us, and check out our work and books on this website.

UIView+BlurFade

We made another nifty little extension!

UIView+BlurFade is an Objective-C category lets you take any UIView and make it blurry and greyscale. This is super useful for when you want to make a view look disabled, and looks really pretty to boot!

This category uses Core Image to perform the blurring and grey-scaling. Because you can't apply CIFilters to views on iOS, it actually cheats a little bit - instead of gradually blurring the view over time, it blurs it once, stores it in an image, and then fades that image over your original content.

To use this category, just drop the two files into your project and #import them. Then, when you want to make your view go blurry and faded out, you just do this:

To remove the blur effect, you call its counterpart:

We hope you find UIView+BlurFade useful! If you have any comments, either create an issue on GitHub, or shoot us an email!

Reasons Why Hearthstone is Good, From A Game Design Perspective
Hearthstone_Logo.png

Lately, we've been playing a lot of Hearthstone. Hearthstone's a digital collectible card game from Blizzard, in which you assemble decks of cards and battle other players. It's a game that clearly draws a lot of inspiration from games like Magic: The Gathering, but it's significantly simpler.

We've been playing Hearthstone since it soft-launched in Australia a couple of weeks ago. Today, it launched worldwide on iPad, and people who weren't already raving about it are starting to take notice. While playing the game, we've ourselves really getting into it, which surprised us - Hearthstone is a free-to-play game from a triple-A studio, and we usually get really into games like Dear Esther, Gone Home, and Kerbal Space Program. The level of enjoyment we've been getting out of this game was a little startling, and we had to spend a bit of time working out why we liked it so much.

Here's what we worked out.

1. The experience starts right away.

When you start the game, you immediately enter a game and begin learning to play. You're given a deck, you're given specific instructions on what to do next, and you play through five games that progressively teach more advanced mechanics.

At the end of the tutorial, you're then asked to sign up for an account. This is absolutely genius - all of the non-fun (or, to be more accurate, non-core-gameplay) components of the game, such as signing up for an account, managing your deck, and even being asked for money, are deferred for as long as possible.

2. The monetisation model is subtle.

Hearthstone is a free-to-play game. The developers make their money from in-app purchases, and the more purchases you make, the happier the developers will be. While many games put pay-gates on progression, Hearthstone's pay-gates are on flexibility. When you play games, you unlock cards; if you pay money, you unlock more cards.

Collectible items as a free-to-play strategy are an increasingly popular area, and we're going to see a lot more of these. They're a model of monetisation that actually respects the player's time, and doesn't club them over the head with a publisher's demands for return on investment. When you buy cards in Hearthstone, you're not paying a toll for playing, you're permanently enhancing your experience of the game. This enhancement happens in very small increments, but it's enough.

As an aside: we're increasingly convinced that 'consumable' in-app purchases are the worst possible thing to base your game's design around. There's been a huge amount already written about the drawbacks of this approach to making money from games, and we've always suspected that those who are defending the approach (and who aren't taking a 'I freakin' love taking baths in dollar bills' attitude) are doing so from the perspective that, well, you don't have to pay, but it makes the game a little nicer if you want to. The problem with this approach is that 'making the game nicer' often translates to 'making the game less abusive'. Making a game that starts out great and gets better with in-app purchases, instead of less bad, is a very desirable goal indeed, and we think Hearthstone (and games that use a similar accumulative-item model) have cracked it.

In addition to paid rewards, almost every game provides some measure of reward for the player. When playing in Practice mode, the player levels-up their characters and unlocks new cards. When playing in Play mode, the player earns progress towards achievements, which give the player items that would ordinarily require paying real-world money. If their game is Ranked, they don't earn items, but they have a chance to increase their rank.

This reward loop serves to keep players in the game for longer, which increases the potential for them to drop money on the game without ceaselessly hammering at them to cough up cash. This also has the benefit of keeping the player population high.

3. The game's design is fast.

Hearthstone games last 20 minutes or less. There is no interaction between players during a turn: players may not interrupt another's turn, and combat has no interaction either. When it's your turn, you have uninterrupted control over what happens until you hit the end turn button.

Turns have a time limit, which is useful; interestingly, the game punishes players who take too long, in that if their turn timer expires, they receive less time to do their next turn. (If they complete that next turn without the timer running out, their amount of time per turn is restored to normal.)

4. The game is welcoming.

Hearthstone intro movie

The intro movie begins as a traditional Blizzard cinematic: giant, intimidating heroes doing battle and magic, while saying cheesy lines about glory, victory and honour - until the switch at the end, where it's revealed that everyone's just sitting in an inn, playing a board game, having fun.

The game feels incredibly happy and supportive, while at the same time sacrificing none of the feeling of risk and excitement that Warcraft's universe traditionally evokes. Even the voice that the player hears when the game starts up is welcoming: "Ahh, it's good t' see ya again!"

This is reinforced by the fact that games don't take very long: the player feels able to drop by the game, play a short round, and at the end of the game, they've received some kind of reward.

We're going to keep playing Hearthstone for a while longer, and see what else we like about it. If nothing else, it's given the mobile game space a lot to think about!

Secret Lab