Swift 5 was released as part of Apple's update of iOS and macOS yesterday (3/25/19) and I had literally just finished submitting an update to Fedora's Bodhi system for the previous development snapshot. I admit I was worried that there'd be some 11:59:59 change to Swift that wouldn't make it compile properly under Fedora, but nope, it built and tested perfectly first time! Kicked off the builds on the Fedora system for Rawhide, F30 and F29, went to bed, and in the morning did a fedpkg update
that put them on the track to be publicly available. The link for the current version of Fedora (29 as of right now) is here and the next version (31) is here. As I recall there is a week or so where folks are invited to test and give feedback, and after that they can be pushed to be available to all. Whee.
ZestyClip now available on the Mac App Store!
ZestyClip is now available in the Mac App Store! Although it's not the first Mac app I've written, it's the first one I decided to try to get published in Apple's App Store. I decided to make it extra hard on myself by eschewing Xcode and Swift, but instead write it in C++ with QT; I chose this partially because I also want to try to make it available in the Windows App Store as well, but also to get more familiar with C++14 so I tried to be a good C++14 user whenever the opportunity arose.
I will outline some of the technical details of the code soon; there were a number of ... interesting ... issues that arose as part of this project and want to make sure I remember what they all were in case I have to handle similar situations.
Dunno why I thought this, and it probably reveals a lot about me, but the first thing I thought when I got the email saying the app had been approved was "Gee, Apple's really lowering their standards."
Undeclared Identifier in Swift after adding new file?
Spent a little too much time trying to figure out why my new Swift file with my new class was resulting in an "Undeclared Identifier" error from the compiler after adding the class as a member variable. Doing some searching resulted in a lot of basic "check for typos" posts as well as "...if it's a framework, don't forget to add the import..." except that this is just a class, not a framework.
Turns out that, at least as of Xcode 10.1, adding a new .swift
file does not automatically include it in the list of files for the compiler to build. After manually adding the file to the list of files to compile (Project/Targets/Compile Sources) it worked fine. Okay, great. Back to work!
Testing Swift on Linux
I've forked Ray Wenderlich's swift-algorithm-club
to include a Python script, build-n-run.py
that goes through all the projects, creates a linux
directory there, copies the playground's Contents.swift
file to the linux directory as main.swift
, along with any other non-test Swift files, then executes the swiftc compiler to build an executable then attempts to run it.
Because playgrounds are effectively interactive REPL sessions it makes sense that a lot of the executables that are built via the process above do not have any output as any results would be shown interactively and don't need to send anything to stdout. Still thinking about whether this is a big deal or not; the goal is to use this project as a compiler test, so a more formal test harness should probably be created to validate that the compiler builds the executable correctly, and that the results are in fact what are expected.
Swift 5.0 for Fedora
The first version of Swift 5.0-Dev for Fedora has been built and "works". The package is
swift-lang-5.0-0.11.20181116git201dcba.fc30.x86_64.rpm
and swift-lang-runtime-5.0-0.11.20181116git201dcba.fc30.x86_64.rpm.
I've tested these on a Rawhide Docker image (Podman, actually, on a SilverBlue laptop), and they compile Swift programs, but the REPL fails with:
error: Could not construct an expression context for the REPL
So clearly there's some more stuff to be done.
Hello world!
Decided to use this site to keep track of the myriad of notes from different things. Hope it works out.