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 More
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 More
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 More
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 More
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 More
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 More
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 More
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 More
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 OptionSetsRead More
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 More
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 More
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 More
With WWDC 2015 just a few weeks away, now seemed to be the perfect time to reflect on a year with Swift. When Apple’s Craig Federighi (SVP of Software Engineering) announced Swift there was an almost euphoric response from many parts of the Apple developer community.
The sheer level of technical ambition was breath-taking. Apple had built a brand-new language that could be fully integrated with existing code, all of the Cocoa APIs, was easy to learn, encouraged crash resistant code and even delivered a performance boost. John Siracusa was lifted above the Ewokian throng and carried out of Moscone West on a throne. You get the idea.
However, our response was ultimately tempered by the initial quality of the tools. This reality should not have surprised anyone. Apple had kept the language a secret even internally, and with little (not quite no) dog-fooding . Eager developers downloaded the first betas of XCode 6 and got started; many could see promise, the experience was painful. Playgounds (designed to make learning and experimenting in the language easy) were actually unstable and frustrating. Some of the language fundamentals were poor; copy semantics for arrays were confusing at best, and whilst the language came baked with arrays and dictionaries sets were nowhere to be seen. All of these problems paled into insignificance when compared to a truly explosive XCode. Not only did core parts of the build chain crash frequently with painful build times for even medium size projects when they did work, but the interactive experience was just horrific
With each new beta, the situation improved, some of the highlights included
- Beta 3: Fixed array semantics
- Beta 4: Swift Beta 4 Updates including access control goodness and controversy
- Beta 5: Significant Swift Beta 5 Changes included a lot of minor syntax tweaks, and continued refinements to optionals.
Despite these developments, it was clear that by the time Apple threw the switch on iOS 8 and released it along with the first Swift apps to the world, that Swift was still a long way from finished. It would have been reasonable to assume that we would hear little else from Lattner and his team until WWDC 2015. Reasonable, but wrong. Swift has continue to develop with language updates (we are