A Better RegularExpression

As promised a while ago I've sat down and hammered out a better replacement for Swift's NSRegularExpression class. As I said then, NSRegularExpression is not actually a Swift class but rather an Objective-C class that has been bridged over to Swift via Swift's excellent ability to interface with C, C++, and Objective-C libraries directly. But … Continue reading A Better RegularExpression

Fastest Way To Get The Time

So, for my 6502/6510 emulator project I've been trying to figure out the best (read that, "fastest") way to get the time with nanosecond resolution. I need this because the North American version of the Commodore 64 ran at 1.02MHz (1,022,727Hz) and so that means the clock "ticks" every 977.8 nanoseconds. And that's just for … Continue reading Fastest Way To Get The Time

Swift Struct vs. Class

I've been having a tough time in Swift with the Struct vs. Class issue. Unlike Java and Objective-C, Swift allows value type "classes" known as Struct types. These behave very similar to C++ objects that are created without dynamic memory allocation - in other words they're created on the stack instead of the heap. This … Continue reading Swift Struct vs. Class

What in the Hell is a Grapheme Cluster?

In my previous post I talked about Swift's handling of strings and the problems making the characters of a string randomly accessible because of Swift Strings being Unicode compliant. Another part of the issue, and the reason that we can think of Characters in Swift as just Strings in and of themselves, is the concept … Continue reading What in the Hell is a Grapheme Cluster?