iPhone App Creation

A small app Dec 22, 2019 Tags: Swift iOS UIKit


I’ve been working on a smallish iPhone app for a couple months alongside other projects, and I’m finally finished it. It’s nothing special in terms of size and feature set but regardless I’m proud of this one. I call it “Monchies” not really the most inventive name, but it’s a small personal food blogging app.

The idea is simple, you just take photos of the places you eat and you can keep track of where you’ve eaten at. I figured I’d keep the app small to avoid setting the bar for myself too high overwhelming me, that and also to avoid feature creep which has definitely plagued me in older projects.

I’ve learned a great deal about app development using UIKit while creating this app. As an example, I wanted to create a floating button for adding new locations and I thought I essentially got it working on the first try. It wasn’t until I ran a test that seeded a few entries did I notice the button was effectively at the bottom of the listView. I went through documentation to figure out how to get this working (the documentation is great but how they label and reference methods broke my brain for a second). Documentation wasn’t really providing me the answers I was looking for, so I searched for how Twitter handled it being well aware they were using React-Native not Swift & UIKit, but I figured if I could get a guess of the React/CSS/JS implementation I would be able to transfer that logic to Swift.

It was pretty straightforward, absoluting of the button’s position with some padding. Seemed easy enough, Swift’s equivalent is constraints, and how it handled constraints was different than what I was used to but I was able to reason about it after messing around with it (admittedly it was mostly me plugging in random coordinates to see where the button would render at. In hindsight I could have simply looked up where 0,0 renders to and go from there).

It still took many hours, headscratches, and coffee to get the button working correctly as errors pertaining to the button and the new screen kept popping up, unfortunately I can’t remember the errors specifically.

There are somethings I need to clean up codewise, especially handling the temp image, camera icon swapping to user’s image in the new restaurant screen and other small issues. The image is fairly simple, instead of simply saying the image is optional (image?) and using the nil-coalescing operator to conditionally render either the user image or the default image, I created two image objects one as the default image, and the other being the ImagePicker image the user supplies and used an if statement to check if the user grabbed an image from her/his gallery or took a picture to determine which to render. It’s not bad, it’s simply not Swift convention.

Adding the onboarding screen was fun trying to learn how to implement it, and saving user data with CoreData was also a learning experience. Getitng it up and running was a struggle as apparently there’s a bug where even if you implement everything correctly, sometimes Xcode and your codebase won’t see that you’re using CoreData and will complain that your core data entities don’t exist, which I didn’t know about so it resulted in me spending hours deleting and recreating my Restaurant entity and it’s attributes.

I won’t be releasing this app (mostly because I don’t have an Apple Developer account), but I am proud of it, I still prefer React Native for somethings, working with Xcode and Swift feels “slower” to me, but I can definitely see the appeal and why millions of developers love it. It’s rock solid, reliable, and well documented. My next app will be built using SwiftUI/Combine.