Beyond gaming: How Swift is hitting the reset button on mobile enterprise development
To start, it’s worth sharing a little bit about the challenge we needed to solve at City Furniture. Our inventory of returned items has scaled linearly with increased sales. It’s an age-old problem in the furniture industry that most retailers solve using obvious solutions such as opening additional clearance centers, but we wanted to apply an efficient digital solution.
These returned items, usually large pieces of furniture, would take up valuable space in our warehouse, and they almost always overstay their welcome because they are difficult to resell. We can only sell them at our clearance center in Tamarac, Florida.
How would we be able to create an efficient import process — which involved photographing these returned items, pricing them and integrating them back into our systems of record? From there, how would we be able to display them for sale and make them available for purchase?
An app to solve the issue of returns
The import process made sense to solve with a mobile app. The mobile app had to integrate with our existing IT systems and provide a simple intake process for each item (capture photos, collect item information from our system, allow an employee to assign a rating and so on). Once all this information is collected and posted to a back-end API, the item can be listed on the website for resale.
The mobile solution delivers several benefits to the company. By speeding up a process that’s a critical part of our business, it reduces City Furniture’s inventory of clearance items and ultimately helps us grow sales and profits. Clearly, this required not only developing an app with an intuitive user experience and design, but also ensuring it could access different internal systems to provide the right data and context.
Picking the right development platform
Since this was City Furniture’s first foray into a mobile application, we spent some time trying to decide which mobile development platform was right for us. This lead us to questions such as, “Should we go native versus HTML/CSS/JS?” and “Do we need something for cross-platform development, just in case?”
The majority of our greenfield development projects are done using dynamic languages. Though this enables us to iterate faster, it can sometimes come at a performance trade-off where the dynamic language may not perform efficiently or quickly enough for CPU-intensive processes. Because Swift’s syntax is so approachable and because Swift compiles down to native code and can run circles around some of the dynamic languages in our stack, it is a great option for us to add to our toolkit for any applications that require that level of performance and efficiency.
Putting Swift to the test
Our first attempt on server-side Swift was to recreate a back-end API service that is consumed by the mobile client. Using the same language (Swift) for both the client (mobile app) and server (API) was a nice experience. We worked with IBM and utilized many of the Swift packages they have developed for server-side Swift such as Kitura, which provided most of the heavy lifting for us on the server side. We were pleased to find packages for interfacing with Redis and CouchDB as well.
We were able to recreate 90 percent of the functionality of the previous API, which was written in PHP, using Swift and the Kitura framework, in a fraction of the time. On top of that, the performance of the new API in Swift is better in every way than the API it replaced, while the code is actually simpler. I was happy to learn that I could use Xcode to create server-side applications as well (after running the command “swift build -X” in my project’s directory).
In a nutshell, Swift ended up playing an important role in helping us take this leap to modernize our business. The iOS app we developed for processing furniture returns uses Swift on the client side and server side through the Kitura web framework. We are using Redis as a job queue with tasks created by Kitura via POST requests. Persistence is handled with CouchDB through IBM Cloudant, which is a service on IBM Bluemix.
More recently, I’ve had an opportunity to preview the recently released beta of IBM Cloud Tools for Swift, which is a GUI app for Mac. It was amazing to see how easy it is to take a Kitura project developed on your Mac and deploy it to the IBM Bluemix service for hosting. No server management or configuration necessary. If you’re an iOS developer who is interested in using Swift to power your back-end services but you don’t have web service development or management experience, this could be a very appealing option.
Looking forward to the next mobile app
At City Furniture, we’ve adopted an agile approach to development, and we’re now working on our next mobile initiative — an iOS app that will enable sales floor employees to access inventory information and complete customer transactions from anywhere in the showroom. The development team at City Furniture is hoping to move toward doing more development with Swift. It’s gaining popularity, and as more packages become open source in Swift, I think it will become even easier to use for businesses.
Now that we’ve had a chance to use Swift on the server side, I could see us using it more and more for new back-end web service development projects. I can see Swift becoming an obvious choice for cloud-based development in the future. It’s fast, efficient, native and easy to write. Usually, you’d have to sacrifice in one of those areas when choosing a language, but with Swift, it feels like you “get it all.”