Swift library for verifying Finnish PIDs

I created a Swift library for verifying Finnish Person Identification (PID) numbers (henkilötunnus in Finnish), FinnishPIDVerifier.

Using these PIDs in apps should be used only if really, really needed. Use some other ways to identify users / customers / members of a club or anyone. An UUID or something.

I’ve used the Finnish PID verification as a small programming task in several courses, mainly to check prerequisites in programming skills when students enter my courses.

Anyhows, I just wanted to try out creating a reusable Swift library as a Swift package. Another thing I wanted to learn is to write documentation using Swift DocC. Third thing I wanted to experiment with this project was to add the library to Swift Package index.

The Swift Package Index is a place to find packages you may find useful and actually import into your own apps. Now you can find the FinnishPIDVerifier in the Swift Package Index too.

New Swift tools

I’ve been working on my sorting methods demonstration app recently when I’ve had time for it. Most of my time currently is spend with evaluating student exercise projects submitted at the end of June for the Software Architectures course.

So, not much new functionality in the sorting app now. I am now mostly trying to make sure code so far is good and documented. Since my plan is to use it as an example and demonstration in the new course I am teaching in Fall, Data structures and Algorithms, I want the demo well documented and of good quality.

To make this happen, I’ve installed several Swift related tools and tried them out.

I am using Swift lint to make sure code is clean and following the Swift coding conventions. Though I had to disable some rules that are too tight for this demo app, using the .swiftlint.yml configuration file.

disabled_rules:
 - multiple_closures_with_trailing_closure
 - line_length
 - todo

For generating html documentation from the comments in the code, I’ve experimented with Jazzy and Swift-doc. Currently Jazzy seems to be in a better shape for my needs, since Swift-doc currently documents only public properties of the project.

Apparently Swift-doc has been used mainly for documenting APIs and libraries and their public APIs. There is a pull request in the GitHub repository, not yet accepted, enabling specifying the level of protection (open, public, fileprivate, private) to document. I tried out the fork which enables protection level configuration, results of which can be seen here. In addition to the protection level issues, there are issues with links. If you try to navigate using the class graphs on the page, the links are not correctly generated by the tool.

The Jazzy generated documentation does not have these issues, and I like the visual apprearance of the Apple themed documentation page (screenshot below).

Well, back to evaluating the SWA exercise work projects, after finishing the study program Zoom meeting I am currently listening to ?

Jazzy generated html documentation of the sorting demo app.