Ink and Ember App
Introduction
Here recently at work, I have been doing a lot of mobile development. We are providing a brand new mobile counter part to the main package we well. This has gotten me back into experimenting with mobile development. I’ve got a macbook and as you may have seen from prvious posts, I am a bit of a fan of swift. So, why not make some of my own apps?
But what to make?
The problem I always run into is, what to make. I am sure I am not the only one to have this thought and far from the last. But then it hit me, I read a lot. I also come across books that I want a lot. The problem is, how to keep track of this? In the past when I was in Barnes and Nobles or some book store and I come across a title that looks interesting, I snap pictures of it. I could solve this with just the notes app, but I didn’t like that. For one, it can be a pain to type out a book and an author and to also keep them all in the same note, or have a bunch of notes.
Sometimes I also want to keep track of the books I own or have read. A lot of the time it is me talking with a co-worker telling them about a book I think they might like, but I can’t remember the title off the tip of my tongue. But I know if I could see the title, I could tell it to them.
So now here comes my little app idea. Manage your library along with a wishlist of books. But with a bit of a twist. Typing sometimes suck, especially on a phone. Why not cut that down? Well, sometimes I have or want multiple titles by the same author. Keep track of the authors, when adding a book, can search across authors already in my library and get to them faster by not having to type the full thing out.
But there is also one more thing. Thinking back to walking around Barnes and Nobles, well books have a barcode. Having worked on point of sale systems, and specifically with devices that scan barcodes, I am reasonably comfortable working with barcodes. Phones also have a camera. How about if I can use the camera as a scanner and then use the encoded number to search for the book online? That sounds pretty cool.
In comes Ink&Ember
So now I have a problem for myself I want to solve. Time to embark.
Most of the app is pretty straight forward basic stuff. Views with lists or some sort of list operation with SwiftData for the persistant storage of that data by being an abstraction over SQLite. Have a list of books with their information, this is a title and an author. And another list of authors. Authors can have many books. Bam, there are my tables.
The interesting part is with the barcode scanning. As it so happens, Paul Hudson has a library on his github that is easy to use and turns the camera into a barcode scanner. I do have prior experience trying to do this on a .NET MAUI version of an app at work using the ZXing library, however that was a little bit of a pain. Paul Hudon’s library makes this so much easier and provides a pretty wide range of support for different formats.
I’ve worked on Point of Sale systems. However, our customers tend to not be book stores. Lots of hardware, lumber, pharmacy and other types of stores, but not books. So I learned something. Books have ISBNs, which I was aware of before, but what I did not know is that the barcodes on books are the ISBN. There are two flavors. Luckily Paul Hudon’s library makes it easy to support multitple types of barcodes by just configuring the scanner with an array of format that are defined by an numeration. What is also kind of cool is that is gives feedback to the user by default by causing the phone to vibrate, which was pretty cool. Not something I thought about or experience with my previous adventures with ZXing’s .NET MAUI library. THere, we got a short audio file that plays a scanner sound as feed back for when the camera detects and reads a barcode.
CodeScannerView(codeTypes: [.ean8, .ean13]) { response in
if case let .success(result) = response {
let code = result.string
scanned(code)
}
}
Yup, it really is that simple.
Next, where to query for this information?
Well, it turns out the Internet Archive has this thing call OpenLibrary. It has an API where an ISBN can be search on, or search for a book/books using a title or author name or other parameters. What is also pretty awesome is that, they will provide an image cover if that have one for that book. So I can use SwiftUI’s AsyncImage()
to display the cover.
Conclusion
It took about two weeks for the first iteration that I was comfortable putting to the App store, but I have some more ideas on what I would like to add for book lovers out there. I also ended up throwing together a website and providing a form for feature requests and bug reports for outside of the app store mechanisms. This was also my first time publishing an app on my own, which was an enlightening experience. At work, I help deploy to the App store, however most of the choices and stuff are fairly paint by the numbers because we have a communications department that does the descriptions and screenshots. Management also dictating all of the business stuff, so we really are just clicking the buttons that best match how we are asked to list it. But this one I had to go through it all on my own.
Apple gets a bad wrap for the app review process. I get it, but I also personally did not find it that bad. I had to do several rounds of fixing things, but once I read the feedback, I found it straight forward and reasonable for what they asked for. Most of it was that the App Store Connect portable is not designed well and doesn’t exactly behave how you would assume. Its also not clear all the things you need to do. For instance, everything with confirming that a build of the app isn’t doing any non-standard encryption stuff.