Author: Pete Barber
-
Resizable UIWindow on iOS
I came across a Todo item in my inbox (I often email myself things todo) whilst tidying it up following Christmas, entitled “Make a resizable UIWindow”. I can remember sending this to myself but not what I was reading or watching that prompted me to do…
-
Resizable UIWindow on iOS
I came across a Todo item in my inbox (I often email myself things todo) whilst tidying it up following Christmas, entitled “Make a resizable UIWindow”. I can remember sending this to myself but not what I was reading or watching that prompted me to do…
-
Unit Testing with Mocha, a local instance of dynamoDB & Promises
I’m writing the backend for my current iOS App in Javascript using node.js, AWS Lambda along with DynamoDB. My AWS Lambda code is mostly AWS Lambda agnostic except for the initial handler methods, this makes them fairly testable outside of AWS. Howeve…
-
Unit Testing with Mocha, a local instance of dynamoDB & Promises
I’m writing the backend for my current iOS App in Javascript using node.js, AWS Lambda along with DynamoDB. My AWS Lambda code is mostly AWS Lambda agnostic except for the initial handler methods, this makes them fairly testable outside of AWS. Howeve…
-
Debugging AWS Lambda functions locally using VS Code and lambda-local
I’ve just started using AWS Lambda with node.js. I was able to develop these locally using the lambda-local npm package, e.g. with node.js installed (via brew) and lambda-local installed (using npm) then the following “hello, world” example i…
-
Debugging AWS Lambda functions locally using VS Code and lambda-local
I’ve just started using AWS Lambda with node.js. I was able to develop these locally using the lambda-local npm package, e.g. with node.js installed (via brew) and lambda-local installed (using npm) then the following “hello, world” example i…
-
Swift’s defer statement is funkier than I thought
Swift 2.0 introduced the defer keyword. I’ve used this a little but only in a simple way, basically when I wanted to make sure some code would be executed regardless of where control left the function, e.g. private func resetAfterError() throws { &…
-
Swift’s defer statement is funkier than I thought
Swift 2.0 introduced the defer keyword. I’ve used this a little but only in a simple way, basically when I wanted to make sure some code would be executed regardless of where control left the function, e.g. private func resetAfterError() throws { &…
-
The Perils of debugging with return statements in languages without semi-colon statement terminators, i.e. Swift
This is a pretty obvious post but perhaps writing it will stop me falling prey to this issue. When I’m debugging and I know that some code executed in a function is not to blame but is noisy in terms of what it causes to happen etc. I’ll often just pr…
-
The Perils of debugging with return statements in languages without semi-colon statement terminators, i.e. Swift
This is a pretty obvious post but perhaps writing it will stop me falling prey to this issue. When I’m debugging and I know that some code executed in a function is not to blame but is noisy in terms of what it causes to happen etc. I’ll often just pr…
-
OAuth authentication on tvOS
Recently I’ve just published an Apple TV (tvOS) App to view photos stored on Microsoft OneDrive. Implementing this on tvOS rather than iOS presented one unique challenge. The OneDrive REST API requires OAuth2 authentication in order to o…
-
OAuth authentication on tvOS
Recently I’ve just published an Apple TV (tvOS) App to view photos stored on Microsoft OneDrive. Implementing this on tvOS rather than iOS presented one unique challenge. The OneDrive REST API requires OAuth2 authentication in order to o…
-
Git remote repos with OneDrive
I have various public git repositories on GitHub but I like to keep some source (usually my active App Store apps) private. Whilst it’d be nice to use GitHub private repositories, given my Apps are for fun and don’t really make anything, don’…
-
Git remote repos with OneDrive
I have various public git repositories on GitHub but I like to keep some source (usually my active App Store apps) private. Whilst it’d be nice to use GitHub private repositories, given my Apps are for fun and don’t really make anything, don’…
-
Swift Enums and Protocols
I’m trying to clear out my inbox before Christmas and I noticed an emails to myself entitled ‘Enum question. Add protocol to enum?’. The short answer is yes. The longer one. Take the following protocol protocol Foo { func f() -> Void } …
-
Swift Enums and Protocols
I’m trying to clear out my inbox before Christmas and I noticed an emails to myself entitled ‘Enum question. Add protocol to enum?’. The short answer is yes. The longer one. Take the following protocol protocol Foo { func f() -> Void } …
-
Things I learnt from Swift Summit
I attended the first Swift Summit on 21st of March; there were two days but I only went to the first. Here are some of the facts I learned: Int is not a fundamental type as you would think of it in most languages. Instead it’s a struct that der…
-
Things I learnt from Swift Summit
I attended the first Swift Summit on 21st of March; there were two days but I only went to the first. Here are some of the facts I learned: Int is not a fundamental type as you would think of it in most languages. Instead it’s a struct that der…
-
A slight enhancement on Developing tvOS Apps with Swift
Apple announced tvOS yesterday. Downloading Xcode 7.1 Beta comes with the SDK and simulator for tvOS apps. The official documentation starts to run through how to create a basic app but is doesn’t mention where to place and load the JS from and the sam…
-
A slight enhancement on Developing tvOS Apps with Swift
Apple announced tvOS yesterday. Downloading Xcode 7.1 Beta comes with the SDK and simulator for tvOS apps. The official documentation starts to run through how to create a basic app but is doesn’t mention where to place and load the JS from and the sam…
-
Release news: Hungry Bunny & KeyChainItemCRUDKit
Not a technical post today, just a bit of news on the things I’ve been working on.
Firstly, my latest SpriteKit game written in Swift is now available on the App Store. It’s called Hungry Bunny and is effectively an endless runner/skill test. It’s free with ads.
Secondly, now that Hungry Bunny is complete I’ve returned to working on another project. This is nowhere near complete but I got to the point where I needed to securely store an OAuth2 token on iOS. I came across the Keychain API. However, the API for this was long winded and I only wanted to use it in a simple manner. Therefore I created a Swift framework to provide CRUD access to it along with a higher level interface where any type conforming to NSCoding and be saved, loaded & deleted.
This is available on github and also as my first ever CocoaPod. All the docs are in the README plus there’s an example iOS program (Single View App) and the Unit Tests.
-
Release news: Hungry Bunny & KeyChainItemCRUDKit
Not a technical post today, just a bit of news on the things I’ve been working on.
Firstly, my latest SpriteKit game written in Swift is now available on the App Store. It’s called Hungry Bunny and is effectively an endless runner/skill test. It’s free with ads.
Secondly, now that Hungry Bunny is complete I’ve returned to working on another project. This is nowhere near complete but I got to the point where I needed to securely store an OAuth2 token on iOS. I came across the Keychain API. However, the API for this was long winded and I only wanted to use it in a simple manner. Therefore I created a Swift framework to provide CRUD access to it along with a higher level interface where any type conforming to NSCoding and be saved, loaded & deleted.
This is available on github and also as my first ever CocoaPod. All the docs are in the README plus there’s an example iOS program (Single View App) and the Unit Tests.
-
Drawing into bitmaps and saving as a PNG in Swift on OS X
Not an in depth post today. For a small iOS Swift/SpriteKit game I’m writing for fun I wanted a very basic grass sprite that could be scrolled; to create a parallax effect. This amounts to a 800×400 bitmap which contains sequential isosceles triangles …
-
Drawing into bitmaps and saving as a PNG in Swift on OS X
Not an in depth post today. For a small iOS Swift/SpriteKit game I’m writing for fun I wanted a very basic grass sprite that could be scrolled; to create a parallax effect. This amounts to a 800×400 bitmap which contains sequential isosceles triangles …
-
When a Swift immutable collection isn’t or is at least immutable-ish
Take the following code: struct Foo { var value: Int } let foo = [Foo(value: 1), Foo(value: 2)] By using ‘let foo’ an immutable array has been created. As such no members of this array can be replaced and nor can an element’s …
-
When a Swift immutable collection isn’t or is at least immutable-ish
Take the following code: struct Foo { var value: Int } let foo = [Foo(value: 1), Foo(value: 2)] By using ‘let foo’ an immutable array has been created. As such no members of this array can be replaced and nor can an element’s …
-
Book review: Swift Essentials
Disclaimer I was asked to review: Swift Essentials by Alex Blewitt from Packt Publishing (I’d previously reviewed another book of theirs for the ACCU) and ideally publicise the review. In return I was given a free copy of the eBook and offe…
-
Book review: Swift Essentials
Disclaimer I was asked to review: Swift Essentials by Alex Blewitt from Packt Publishing (I’d previously reviewed another book of theirs for the ACCU) and ideally publicise the review. In return I was given a free copy of the eBook and offe…
-
Optional chaining with dictionaries (in Swift)
Whilst learning Swift and SpriteKit I came across an issue with the documentation for SKNode.userData. In an early XCode beta it was specified as an implicitly unwrapped optional whereas now it is clearly an optional. Therefore the code I origina…
-
Optional chaining with dictionaries (in Swift)
Whilst learning Swift and SpriteKit I came across an issue with the documentation for SKNode.userData. In an early XCode beta it was specified as an implicitly unwrapped optional whereas now it is clearly an optional. Therefore the code I origina…
-
Resolving strong references between Swift and Objective-C classes – Using unowned and weak references from Swift to Objective-C classes
My Swift and SpriteKit exploration continues. At the moment I’m writing the collision handling code. Rather than derive game objects from SKSpriteNode with each derived class containing the code for handling collisions with the other types of game obj…
-
Resolving strong references between Swift and Objective-C classes – Using unowned and weak references from Swift to Objective-C classes
My Swift and SpriteKit exploration continues. At the moment I’m writing the collision handling code. Rather than derive game objects from SKSpriteNode with each derived class containing the code for handling collisions with the other types of game obj…
-
Beware: Despite the docs SKNode userData is optional
In the Swift documentation for SKNode the userData member (a dictionary) is defined as follows: userData A dictionary containing arbitrary data. Declaration SWIFT var userData: NSMutableDictionary! OBJECTIVE-C @property(nonatomic, reta…
-
Beware: Despite the docs SKNode userData is optional
In the Swift documentation for SKNode the userData member (a dictionary) is defined as follows: userData A dictionary containing arbitrary data. Declaration SWIFT var userData: NSMutableDictionary! OBJECTIVE-C @property(nonatomic, reta…
-
XCode 5 versus XCode 6 default generated Game (Sprite Kit) project and scene sizes
As a way to learn about Swift I’ve been trying to write a simple game using Sprite Kit. My initial plan was to just allow a ball to be dragged around the screen and ensure it was constrained by the screen edges. This was a little harder than originally…
-
XCode 5 versus XCode 6 default generated Game (Sprite Kit) project and scene sizes
As a way to learn about Swift I’ve been trying to write a simple game using Sprite Kit. My initial plan was to just allow a ball to be dragged around the screen and ensure it was constrained by the screen edges. This was a little harder than originally…
-
Subclassing Objective-C classes in Swift and the perils of Initializers
— Begin update 1. The post below applies to Xcode 6 Beta 2. With Beta 3 & 4 the relationships between the Swift and Objective-C regarding the calling of super class initializers has been formalized. 1a. A Swift class can have multiple non-conve…
-
Subclassing Objective-C classes in Swift and the perils of Initializers
— Begin update 1. The post below applies to Xcode 6 Beta 2. With Beta 3 & 4 the relationships between the Swift and Objective-C regarding the calling of super class initializers has been formalized. 1a. A Swift class can have multiple non-conve…
-
Keyboard configuration for Windows’ developers on OS X (& also IntelliJ)
Recently I’ve been doing some ActionScript programming. Rather than target a Flash Player app. I’ve been using ActionScript in combination with Adobe AIR in order to create an iOS app. This has meant I’ve been spending time in OS X and using IntelliJ w…
-
Keyboard configuration for Windows’ developers on OS X (& also IntelliJ)
Recently I’ve been doing some ActionScript programming. Rather than target a Flash Player app. I’ve been using ActionScript in combination with Adobe AIR in order to create an iOS app. This has meant I’ve been spending time in OS X and using IntelliJ w…
-
Capturing lvalue references in C++11 lambdas
Recently the question “what is the type of an lvalue reference when captured by reference in a C++11 lambda?” was asked. It turns out that it’s a reference to whatever the original reference was too. This is just like taking a reference to an existing …
-
Capturing lvalue references in C++11 lambdas
Recently the question “what is the type of an lvalue reference when captured by reference in a C++11 lambda?” was asked. It turns out that it’s a reference to whatever the original reference was too. This is just like taking a reference to an existing …
-
Windows 8 Pro on an early 2009 iMac 21.5 (Core 2 Duo)
A couple of weeks back I thought I’d have a go writing a Windows Store App. To do this requires Windows 8. At the time I was running Windows 7 Home Premium on an early 2009 iMac 21.5 (Core 2 Duo). This had been installed using Boot Ca…
-
Windows 8 Pro on an early 2009 iMac 21.5 (Core 2 Duo)
A couple of weeks back I thought I’d have a go writing a Windows Store App. To do this requires Windows 8. At the time I was running Windows 7 Home Premium on an early 2009 iMac 21.5 (Core 2 Duo). This had been installed using Boot Ca…
-
Specifying the directory to create SQL CE databases when using Entity Framework
In the last few posts I’ve been describing how to create instances of SQLCE in order to perform automated Integration Testing using NUnit and accessing the dB using Entity Framework. I covered creating the dB using both Entity Framework and the S…
-
Specifying the directory to create SQL CE databases when using Entity Framework
In the last few posts I’ve been describing how to create instances of SQLCE in order to perform automated Integration Testing using NUnit and accessing the dB using Entity Framework. I covered creating the dB using both Entity Framework and the S…
-
Integration Testing with NUnit and Entity Framework
This post gives a quick introduction into creating SQL CE dBs for performing Integration Tests using NUnit. In the previous post Using NUnit and Entity Framework DbContext to programmatically create SQL Server CE databases and specify the databse…
-
Integration Testing with NUnit and Entity Framework
This post gives a quick introduction into creating SQL CE dBs for performing Integration Tests using NUnit. In the previous post Using NUnit and Entity Framework DbContext to programmatically create SQL Server CE databases and specify the databse…