Now I can program my robot using Swift!!!! SwiftyGPIO
Did you know that, just like Python, Bash scripts, etc., you can run a Swift source file right from the command-line as if it was an already compiled executable? You betcha! 😎 The Swift REPL program honors the SHEBANG line in a Swift source file. #!/usr/bin/swift import Foundation print("") print(" Int8 - size: \(MemoryLayout<Int8>.size); stride: … Continue reading Scripting with Swift
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
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
As promised, here's the link to the build of Swift for the ODROID C2. This build was done on Ubuntu 20.04. Your results on other platforms/distros will most certainly vary. USE AT YOUR OWN RISK - I provide absolutely NO WARRANTY, implied or otherwise, with this what so ever. EDIT: 2020-09-22 - You will probably … Continue reading Swift 5.3 on Odroid C2
Over the weekend I managed to get a build of Swift working on the Odroid C2 SBC. As soon as I get a chance I'll TAR up the build and put it up on Dropbox. The build for the Raspberry Pi is still compiling. Here's the little sample program I wrote to test it out. … Continue reading Swift on an Odroid C2
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.
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?
Okay, I really do understand the plight. Honestly I do. I mean, I get it! Strings in Swift are not randomly accessible collections of bytes like they are in C or 16-bit words like they are in Objective-C or Java. In Swift a String is a collection of grapheme clusters. So, why not allow you … Continue reading Thoughts on Strings in Swift
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