Now I can program my robot using Swift!!!! SwiftyGPIO
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
Until Swift gets a native regular expression class of it's own we are stuck with the Objective-C version - NSRegularExpression. The Objective-C version is very capable and works very well but it's important to remember that it is working on Objective-C NSStrings which, unlike Swift's native Strings, are based on the UTF-16 encoding. What this … Continue reading Avoiding a Swift NSRegularExpression Pitfall
From now on with each new version of Swift that comes out I'm going to take some time a dig through all the Swift Evolution Proposals that made it into that release. Some real gems made it into the last few releases that I didn't know anything about but are really cool. The one I'm … Continue reading Swift Property Wrappers
I am really going to have to start playing around with the SwiftSyntax library! It looks like I'd be able to write some real code timesavers with it.
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
Here's just a little tidbit that I ran across recently where Xcode, which normally does a good job covering all the bases, fell short just a bit. When you're working with dynamic libraries in just about any environment, especially Linux and MacOS, there is a two-way street when it comes to a program or another … Continue reading Working with Dynamic Libraries in Xcode
The designers of Swift seem to have really odd opinions regarding the merits of certain patterns that are very common across other languages. For example, they have deemed that the prefix and postfix operators "++" and "--" are, for some reason, not desirable. Weird. 🧐 Not a biggie because they also built Swift with the … Continue reading Bringing Back Some Old Friends
Learning Swift is a lot easier thanks to Playgrounds!
So, one of the first things I wanted to do in Swift was to start to port the Java model of XML over to Swift. But to do that I needed to be able to read the XML files as a series of bytes so that I could convert all the various character encodings (UTF-8, … Continue reading Byte Level File I/O in Swift