Writing a Command Line Text Adventure in Swift with OysterKit and STLR
/Even a simple text adventure contains all of the fundamentals of lexers, parsers, and interpreters. Using STLR to define the grammar, and its Swift code generation, we quickly create a simple adventure game in Swift.
Read MoreSwift 3.0 String Index Changes
/Swift 3.0 makes fairly sweeping changes to Collection types (SE-0065 - A New Model for Collections and Indices) and you may not be expecting them to impact Strings... But if you are used to working with indexes of any of the different views of a string (for example UTF8 or UnicodeScalarView) and traversing individual characters from string with the String index... You will be impacted.
Read MoreCreating MacOS Document Icons using DrawDown
/One of the core benefits of using DrawDown is similar to Photoshop's smart objects, you can use a single consistent image in lots of different ways. I blogged about how you can use DrawDown to achieve consistent but native icons previously, but we can take that a step further.
Read MoreAutomatically create all your iOS 9 and OS X Icons
/When you create your new app on iOS app in XCode you will be faced with 20 empty boxes to fill in, and that's before you log in to iTunes Connect and are asked for just one more... Oh... and you probably want one for your web-site too that has the the right mask applied. Companion MacOS app? That's another 11. Wouldn't it be nice if a single script could create all of these for you?
Read MoreWhy SpriteKit bodies don't Contact or Collide
/Sometimes it can be more than a little tricky to be certain why two SpriteKit bodies aren't bumping or touching... Here's four basic checks, baked into a quick diagnosis function.
Read MoreGet ready for Swift 3.0 -Remove of ++ -- and C style for loops across a project
/Make the Swift 2.2 to 3.0 transition a little easier with these useful regular expressions for XCode
Read MorePlaying with SpriteKit in a Swift Playground - Update
/Time to update my Swift SpriteKit Playground example... now with added SpaceCats!
Read MoreUsing Swift GameplayKit to achieve rendering framework independence
/In the last article we looked at providing a better (and purely Swift) implementation of GameplayKit's Entity/Component architecture. By better I didn't mean "it's Swift so it's better"... I meant better at solving the stated objectives of GameplayKit: Rendering framework independence and composition. I focused on composition last time, this time I look at how the Swift GameplayKit implementation (and Swift itself) makes rendering framework independence easy.
Read MoreMaking GameplayKit Swift-ier
/I've posted before on the hot-mess that is GameplayKit. I've since been playing with it a lot, particularly with the entity/component system. I think there are some real problems with the implementation that I suspect may be part of trying to cater to Objective-C and Swift. In this article we'll take a look at those issues, and a Swift re-implementation of the GameplayKit API that solves these problems.
Read MoreWhy I maybe don't want you as a reader
/I'm sick of it. Just sick of it. Have you actually heard yourself? It's just shameful and embarrassing. I'm a middle aged, white, nerd blogger. All the toast, jam side up. I have had enough of whinging, spiteful, bitter, and stupid people who are harassing women/LGBT/muslims/whatever around the internet. I know that every time I tweet something positive about these people I lose followers.
Read MoreDemolition Page 3 - Adding State with GKStateMachine
/We continue our exploration of Swift 2.0, GameplayKit, and SpriteKit by using GKStateMachine to make our game behave a little more like a real game without making our standard code more complex.
Read MoreDemolition Page 2 - Extending our playground with GKGridGraph
/We continue our playground exploration of GKGameplayKit, SpriteKit and Swift 2.0 by actually creating some player objects and helping them navigate their way around asking GKGridGraph's path finding abilities.
Read MoreDemolition Page 1 - Making Levels
/iOS 9 and OS X El Capitan strengthen Apple's gaming line up with GameplayKit, which augments the graphics (and physics) engines with a game engine. Over the coming weeks I'm going to walk through the process of developing a "bomber man" style game using SpriteKit and GameplayKit.
The code will be supplied in a playground that will have a page for each blog entry. In general, I'll discuss concepts in the blog, and leave explanations of specific pieces of code in comments or Playground markup. There's going to be a lot to cover, so let's get started.
Read MoreExploring Swift 2.0 OptionSetTypes
/OptionSetType is a protocol that intends to modernise the methodologies used for single variable option masks. Traditionally this has been done with bit masks, and lots of logical &s and |s and replaces them with explicit set syntax, with appropriate methods for checking and combining OptionSets
Read MoreGameplayKit... First Thoughts
/I'm quite familiar with game engines, I've written a few in my time (I started on the Commodore 64, but didn't "get paid" until the Amiga. Look 'em up kids.). GameplayKit sounded very interesting so I was keen to get stuck in. After 24 hours, I've got some mixed feelings.
Read MoreSwift 2.0's guard isn't just for throwing
/Like many of the new Swift 2.0 features introduced at WWDC, guard is capable of supporting many useful patterns not all of them immediately obvious. The very verb "guard" makes us think about protection, but it can be much more broadly used than that.
Read MoreExploring Swift 2 Protocol Extensions
/One of Swift 2's most exciting additions are protocol extensions. These allow you to add new methods to anything that implements a protocol. I thought it might be interesting to explore this with a practical example, generating random or repeating sequences from any collection.
Read MoreThe Genius of Swift 2's defer
/Swift 2.0 has introduced (amongst many other things) a new defer keyword which enables a much clearer expression of intent than was possible in Swift before.
Read MorePerformance Testing in XCode Playgrounds
/An example playground that will help you quickly explore the performance of your algorithms without the need to set up full XCT unit test performance blocks.
Read More
Even a simple text adventure contains all of the fundamentals of lexers, parsers, and interpreters. Using STLR to define the grammar, and its Swift code generation, we quickly create a simple adventure game in Swift.