Main menu

Daniel's Stuff

Category: swift

I’ve been making some apps recently. One for the new Windows 8 modern UI and one for iOS using swift. One was a joy to code, the other was not 😉

Swift is an interesting language and I look forward to writing more code in it. C# is also a nice language, however writing code for “modern” Windows apps is much harder than it should be. This is mainly because many of the more useful parts of the .Net API just are available any more 🙁 No System.Data was the real problem for me and meant that I had to roll my own database access layer on top of a SQLite database. An app that should have taken a couple of days to whip up took a couple of weeks. Every time I thought I was getting somewhere I would hit yet another assembly or class that wasn’t available, or worked slightly differently to the “normal” way things should work.

I’ve been fascinated by the Scala language since I first saw it. I’ve been fortunate enough to be able to use Scala in a couple of projects. One of the parts of the Scala standard library I really like is the parser combinator stuff. I’ve been spending a bit of time recently playing with some ideas as to how something like it could be made for the new Swift language from Apple and I’ve made a first cut here.

It still needs a lot of work, but at the moment it is usable. What I’m thinking is I will use it as the basis of a much nicer one that follows the Scala version more closely now that I have a better understanding of how Swift works. I doubt I’ll be able to make it a nice as the Scala one, but I may be able to get close with any luck 🙂

I’ve been spending a bit of time having a play with Apple’s Swift. So far I find the language to be interesting.

It seems to be missing a few things. Working with strings is a real pain 🙁 Hopefully this will be fixed in later versions of the language/compiler.

I’m also hitting many problems with the Xcode 6.0 beta crashing, but more annoyingly after getting a fairly large amount of Swift code ready it seems to be crashing the compiler 🙁

I’m trying to port the pegged parser generator to swift. The first step is to update the existing tool to generate swift as output. This I got working fairly quickly, then it was down to fixing the various syntax errors and learning how things are done in Swift. Now there are no syntax errors, but it still won’t compile 🙁 Ah well. Maybe I should just have a go at writing one from scratch 😉