The completed project
I recently completed the development of an iOS app as a code exercise. The goal was to display the top 100 albums across all genres using the Apple RSS generator. You can find the TopAlbums project on GitHub. The project description contains an animated GIF of the finished product, along with the detailed set of requirements.
What I wanted to do in this post is review my thought process in developing the app, along with any intricacies I came across.
I enjoy discovering new APIs to experiment with. In this case I came across Unsplash which is a source of high resolution images which are free to use. The developer API is well documented and it is a simple process to register an app to obtain an API key.
To skip ahead and see what I built using this API, see my Unsplash demo app on GitHub.
An opportunity to build an iOS app
An Image API service provides a nice basis for building an iOS app. It lends itself to working with table views, collection views, storage and many other iOS features. The following screenshots show what I was able to achieve.
Posted in API, iOS, Swift
Tagged Alamofire, api, combine, core data, iOS, mvvm, NSFetchedResultsController, Swift, unsplash
I really enjoy programming in Swift, but I’ve always been bothered a bit by what I perceived as a couple of shortcomings related to the String class.
There is no support for subscripting a String.
Try the following in a Playground and you’ll get an error:
let str = "Hello"
str // 'subscript' is unavailable: cannot subscript String with an Int
str[1..<3] // 'subscript' is unavailable: cannot subscript String with an integer range
You can find a mention of this restriction in some source code comments.
Matrix Layer Rotation
I enjoy solving interesting HackerRank algorithm problems. I came across one recently called Matrix Layer Rotation – appropriately labeled “hard” by the author.
I posted my solution as a playground on GitHub.
The problem is to print out a rotated representation of a m x n matrix given the parameters:
m – number of rows
n – number of columns
r – number of rotations
Looking at the constraints
2 <= m, n <= 300
1 <= r <= 10^^9
min(m,n) % 2 = 0
I’ve completed the initial release of a project I’ve been working on called AppDeveloperKit. It is a tool for iOS developers to assist in developing reusable, configurable Swift classes.
Properties are declared in classes and coded to affect appearance and behavior. The values for these properties are stored in a property list (plist) file. A macOS app provides a UI to edit these properties in real-time as an app is actively running on a device or simulator. An iOS framework coordinates access to the plist file and communication to the macOS app.
This is a list of the main features that AppDeveloperKit offers: