Categories
Development Technology

Swift SQLite With GRDB

Any app like ExerPlan needs a good data model and data store, and given my SQL skills and the fact that SQLite is part of iOS there was only ever one choice for me.

I work with Microsoft SQL Server in my day job and I am very comfortable with writing SQL code to handle inserts, updates, and deletes. I come into contact with lots of different systems at work, and as such I witness many crimes against data. These range from column names making as much sense as Brexit, to seemingly well-designed schemas that lack the database constraints to enforce that design. I wanted to ensure that I created a database that didn’t suffer from these problems.

Swift and SQLite don’t necessarily play well together because it’s not as though SQLite is part of the Swift standard library. But Swift is open source and so maybe there’d be an open source solution for me?

Enter GRDB a “SQLite databases toolkit with a focus on application development”.

I’ve looked at a few such toolkits for SQLite and Swift, but GRDB is by far my favourite. The main reason is that SQL code is front and centre in GRDB if you want it to be, and with my background I very much do. GRDB has some really nice abstractions away from SQL if you want to use them, but as the docs say “your SQL skills are welcome”.

I’ll address how I’m using GRDB more fully in a later post, but for now it’s enough to say that GRDB and Swift play very nicely together. I’ve now got a solid base to work with, and GRDB feels as much like Swift as the standard library.

Select “Happy” As MyFeelingAboutGRDBAndSwift

Categories
Development Technology

Workflow V2.0

Since upgrading my hardware and buying a Mac Mini and an iPad Pro, my workflow has undergone a big change for the better.

I used to spend time designing on lots of A4 paper, creating written notes and drawings of UIs. This was a good way of working, but it meant either carrying around loads of A4 to wherever I was working, or more often just leaving the paper notes behind thus rendering them useless: Enter iPad Pro, Apple Pencil, and Notability.

Notability is my note-taking app of choice, as it combines typed notes and drawings in one note. I’m now able to make design notes sat in front of the TV (relaxed working), and take them with me when I need to translate the notes into Swift code at my computer desk (focused working). No more piles of A4 cluttering up my desk.

ExerPlan UI notes.
ExerPlan UI notes.

Another app that’s been useful on the iPad is Swift Playgrounds. I can try out code ideas before I delve into Xcode and doing this has helped me learn a lot about Swift in isolation. Again, I can take the iPad with me when working at my desk, and transfer what I’ve learnt to my main app.

Finally, I’ve been using Numbers to store my data model. A spreadsheet is a good tool for a data model, as the tabular format makes entering a table’s column details easy. In conjunction with the excellent Git client Working Copy, I’ve been easily keeping the data model and code base up to date.

Although it was a big investment in new kit I’m really glad I did it. My workflow has altered for the better and I am more productive with my app work than I’ve ever been.

Now if you’ll excuse me I’ve got some websites to search for details of implementing UIViewControllers in Swift code…

Categories
Development Technology

Upgrading App Development Kit

My current setup for developing iOS apps is a Mac Mini (2018 model) and an iPad Pro (2018 model). After 6 years of working on a MacBook Air, I decided to upgrade in 2018.

In 2009 I started developing for iOS when I bought a Mac Mini. My goal was to create games, but it wasn’t until 2011 when I started working with Corona that I released anything, a game called Super Smoothies co-created with a friend. The game was developed with a basic text editor as that was all that was required for coding. In 2012 I wanted a faster machine and also one that was mobile, so I opted for a MacBook Air. In 2013 I released another game, Discbord, again created using Corona.

In the last year I decided I wanted to combine my love of running and exercise with my love of technology and coding. It became clear that building an app using xCode and Interface Builder wasn’t an experience I was happy with on a MacBook Air. Even connecting my MBA to an external monitor was still a poor experience. I opted to upgrade my kit and as I knew Apple were to announce new hardware in late-2018 it became a waiting game.

My initial plan was to purchase an iMac with a 5k screen, but Apple messed that up by not releasing new iMacs in 2018. Instead I opted for the new Mac Mini, and bought my own 27-inch 4K monitor to use it with. As I also had my older 1080p 23-inch monitor I ended up with a great dual-screen setup.

However, the picture wasn’t complete. I do a lot of note-taking when designing apps and I wanted to digitise those. My idea was to get a new iPad Pro and Apple Pencil, so that instead of having folders full of paper notes, I could have virtual folders full of digital notes. I’m so happy with the iPad that I’m writing this article on it, using the Apple Keyboard Folio. Note-taking with the Apple Pencil is good, but taking a little getting used to after years of using paper.

That’s my hardware setup for the foreseeable future, and one I’m more than comfortable with using to design and develop apps for iOS. There are a still a few kinks to work out, but for now I am well on the way to getting a good workflow up and running.