iOS Swift development

December 15, 2017

#Apple #iOS #Swift #Xcode

Lists App Icon

It’s been over two years since I looked at it because other projects came along. But I spent much of 2015 learning Swift – initially working through Developing iOS 8 Apps with Swift course on Stanford's iTunes U. I very much enjoyed being completely immersed in the code and concepts. During this period I was also fairly active on stackoverflow. Most of my questions and answers over there still relate to Swift. During that period the language was transitioned through various version 2 releases. Today I would almost need to start again. Especially given that syntactically it shares many similarities with other basically C – like languages. I used various different programming languages and environments over the years (including COBOL, Pascal, Basic, C, C++, Visual Basic, PHP, Javascript + jQuery). I feel that I only really know a thing well whilst I am fully involved in using it. It’s the patterns we remember most.

Lists is a Universal iOS app I built in in Xcode. 100% Swift – it was also an exercise to find out how to build and deploy an iOS app. The various generations of source code usefully document much of what I learned along the way. I built it using the UISplitViewController class with UITableViews. The split view adjusts automatically depending upon whether the app is used vertically or horizontally. Built using Auto Layout and Size Classes, the app resizes intelligently and is responsive to the type of device it is run on.

Simple One-To-Many Relationship
Simple One-To-Many Relationship

Early versions of the app persisted data using XML files. Finding out how to save and parse XML using Swift was a useful learning process but I quickly switched to using Apple’s Core Data framework. Core Data provides a layer of classes which encapsulate a variety of mechanisms including SQLite for persisting and querying data. Whilst various third-party alternatives exists, Core Data is a robust technology which offers the clear advantage of not risking 3rd-party dependencies.

The app synced via iCloud between iOS devices logged into the same account. My experience of this at the time was that it was not always especially reliable – this also seemed to be the opinion of much of the developer community. I got it mostly working – but then there would be unexpected glitches. Especially when using mobile data. Perhaps it is more stable today.

Device specific settings data were stored using NSUserDefaults – for example the need to know whether the app was being run for the first time after installation on any specific device. The app incorporated Twitter’s cross-platform Fabric framework for crash reporting and analytics. Fabric has since become part of Firebase, Google’s mobile development platform. The app was tested and tweaked (memory allocation etc) using Apple’s Instruments and distributed for beta testing via TestFlight.

 

Storyboard Layout
Storyboard Layout
Xcode IDE
Xcode IDE


Show All Posts