skeOver the past few months I’ve been trying to learn Swift as fast as possible. I’ve read numerous blog posts on Swift and the IOS framework. I’ve also purchased several eBooks and online tutorial services that pretty much talk about the same things. It does help to learn the basics of building an app and these tutorials certainly help. But the only way you’ll really learn, is by actually building your own app. When you’re forced to build a UITableView that’s based on your own design, you’d first start with what you know, then you need to adjust it to fit your scheme. This is where I think I and most people really start learning how to build apps.
I didn’t want to build a huge app with several screens and complex animations. I just need to think of one that was very simple to build and, of course, use. I remember one day my wife was texting me what I wanted from the Starbucks but it was either always the same thing or a slight variation to it. I hated having to retype it all the time. Wouldn’t it just be easier to use a pre-defined list of items that you can check off, then it will generate that list for you as though you wrote it manually? And so, I started using that as the start of 2txt. By no means is this app my breakthrough app that I’ll continue to support for years. This is just a simple project I wanted to get done in a few weeks.
I’ve used Sketch to design my apps before doing anything. When I was a web developer I usually coded it first and designed it along the way because I never really bothered to use Photoshop or Illustrator. I’m not a designer in any way so I figured, I’ll just build it first, make sure it works, then design it later. It was easy to do that in HTML and CSS, but for IOS it was a bit different. I was constantly adding views then constraining them to other views, then realizing that didn’t work so I had to redo my views and constraints and it just became a mess each time. So I decided to just design it first to see how it would look, then export it to Marvel to see how it would flow on my device, then i’d start coding. While it seems like a long process, it saves a lot of time in the end.
The great thing about Sketch is that it makes it very easy to create each screen.
I then exported my template to Marvel using their Sketch plugin. It didn’t take long to map out the buttons. After viewing it on my iPhone with the Marvel app and tweaking it a few more times in Sketch, I was ready to start coding.
It took me about 2 weeks to develop this simple app. The hardest part was giving each cell the ability to edit/delete/move by holding the cell down for a few seconds while also being able to swipe left or right to increase/decrease the quantity. For the swiping options I used MCSwipeTableViewCell (twitter.com/@alikaragoz) which did the job perfectly. The UX was unorthodox since I was giving the table cell a few more options that a normal iPhone user wouldn’t expect. But I feel it was the best way to implement it without adding any more buttons or actions.
Programming the texting part was fairly simple. Fortunately there was already a controller that handled it. One of the security issues when sending text messages from your app is you can’t do it for them. You can populate a text box but they have to manually press the “send” button. This means that when they’re ready to text, my app will then display the iMessage app in a modal with my pre-formatted text. The user just needs to select the recipients and press send. Once they press it, it’ll return back to my app. As much as I’d rather have them stay in my app, all apps have to conform to this protocol so I’m okay with it. At least it comes back to me after the message has been sent.
I’ve started mocking, prototyping, and coding this app for the Apple Watch. It pretty much does the same thing as the app but you can’t add or remove items from the list. You can only choose from the ones that have already been added. The only problem I ran into was that I couldn’t send a text from my app. Apple has not given developers the ability to send a text from an Apple Watch app. I couldn’t even send it to the Apple Watch’s messaging app at this time. The only way I could send it was to alert the user to open their phone which should send them to the 2txt app’s preview screen. From there, the user does what they’d normally do from the app. Hopefully by the time Swift 2 is released in October, they add this feature into watch OS2.
I won’t spend too much time on this app. This was just a side project to keep me learning new ways to use UITableVIew. I also learned a lot about CoreData which is used to store and query the data that appears on screen. If a lot of people start using it, then I’ll start thinking of a version 2.