Categories
Development Technology

Fixing Int, Identifiable, and ForEach in SwiftUI Beta 5

I installed beta number 5 of SwiftUI this week and my app, ExerPlan, died an impressive death at the hands of deprecation and weirdly unhelpful error messages!

My app calls for a calendar-style interface. I use some code to iterate over the number of weeks a plan has been setup for, creating a row of UI for each week:

ForEach( 1…planDetail.planWeeks) { week in

Unfortunately, this stopped working in beta 5 as Int (which is what planWeeks is above) no longer conforms to Identifiable. It took me a while to understand the fix, but the code below eventually saw my project compile again.

ForEach( 1…planDetail.planWeeks, id: \.self) { week in

I have made sure that all relevant structs in my code conform to Identifiable, so this was a frustrating error, but at least the fix is easy.

Categories
Development Fitness

ExerPlan – Exercise Planning App

ExerPlan is the working title of a new app I’m working on, designed as a general exercise planner.

In the past I used Excel to plan my running training. More recently I’ve started doing more types of exercise, such as strength training, yoga, and lots of walking. I wanted an app to record and monitor my plans, rather than having to use Excel, and so I started work on ExerPlan.

With Excel and a big screen it was easy to see a full training plan at once. That won’t be possible on an iPhone screen, but my aim is to offset the loss of readability with the fact that I’ll have the plans to hand more often. I may eventually extend the app to iPad so I can get some of that big screen functionality back, but my initial focus will be on the iPhone.

ExerPlan will be based around the concept of activity types and sub-types. An activity will be something like “Running”, “Walking”, “Yoga”, while a sub-type might be “Hill Running” or “Intervals”. The app will allow the user to plan sessions of those activities in one of two ways. They’ll be able to add the planned activities to a calendar-style view, but also group activities into Plans. For example, a user might want to do yoga twice a week but not have it be part of any particular plan. Whereas, another user might want to enter a 16-week marathon training plan. ExerPlan will allow for both these things to be logged.

Once an activity is added it can be updated with the actual activity, e.g. I planned to run 5 miles, but only ran 3. In this way I’ll be able to track planned vs actuals, and provide data visualisations. I’ll be able to track performance against the plan, and also against specific activity types, e.g. how often do I plan a Hills session and how often do I actually complete them! I may also implement a badge system to “reward” users if they complete enough planned activities, but I think that’ll be a V2 development.

I’ve been designing ExerPlan for a few weeks and I finally started coding the app last week. Most of the database gubbins has been written and I’ll be moving onto the good bit next; the UI.

Well, that’s the plan 🙂

Categories
Development Technology

Upgrading App Development Kit

My current setup for developing iOS apps is a Mac Mini (2018 model) and an iPad Pro (2018 model). After 6 years of working on a MacBook Air, I decided to upgrade in 2018.

In 2009 I started developing for iOS when I bought a Mac Mini. My goal was to create games, but it wasn’t until 2011 when I started working with Corona that I released anything, a game called Super Smoothies co-created with a friend. The game was developed with a basic text editor as that was all that was required for coding. In 2012 I wanted a faster machine and also one that was mobile, so I opted for a MacBook Air. In 2013 I released another game, Discbord, again created using Corona.

In the last year I decided I wanted to combine my love of running and exercise with my love of technology and coding. It became clear that building an app using xCode and Interface Builder wasn’t an experience I was happy with on a MacBook Air. Even connecting my MBA to an external monitor was still a poor experience. I opted to upgrade my kit and as I knew Apple were to announce new hardware in late-2018 it became a waiting game.

My initial plan was to purchase an iMac with a 5k screen, but Apple messed that up by not releasing new iMacs in 2018. Instead I opted for the new Mac Mini, and bought my own 27-inch 4K monitor to use it with. As I also had my older 1080p 23-inch monitor I ended up with a great dual-screen setup.

However, the picture wasn’t complete. I do a lot of note-taking when designing apps and I wanted to digitise those. My idea was to get a new iPad Pro and Apple Pencil, so that instead of having folders full of paper notes, I could have virtual folders full of digital notes. I’m so happy with the iPad that I’m writing this article on it, using the Apple Keyboard Folio. Note-taking with the Apple Pencil is good, but taking a little getting used to after years of using paper.

That’s my hardware setup for the foreseeable future, and one I’m more than comfortable with using to design and develop apps for iOS. There are a still a few kinks to work out, but for now I am well on the way to getting a good workflow up and running.