November 22, 2022

The app status of Stoins has changed to Pending Developer Release

Would you look at that. Henlo got rejected a bunch of times and it seems I learned a few things in the process. Very unintuitive things like “Even though there’s a dedicated input field to link to the privacy policy you better put the same link in the description of the app or you might get rejected”.

Stoins will be released tomorrow!

November 21, 2022

Stoins is waiting for review

I did it. Stoins is ready to be pushed out the door. I don’t expect it to get through review without a few resubmissions but that’s just part of the game. 馃

November 17, 2022

Lost in Localizable.strings

Update: Somebody actually solved my issue. Internet is great. Scroll down to see how this is fixed.

When I wrote about the couple of problems I don’t know how to solve in Stoins, I didn’t anticipate to quickly run into the next one. Stoins is supposed to be available in English and German. With English as the default, I set out to add German translations and watched a couple of tutorials on how to do so.

It’s relatively straight-forward.

  1. Create a Localizable.strings file for every language you want
  2. Xcode finds all translatable strings automatically and you translate them one by one
  3. Done

Unfortunately that’s not exactly how it went. Most strings were found, sure, but those outside of Text() views weren’t and I don’t understand why or how to force Xcode to translate them.

An example

Take everything with a grain of salt. I don’t know what I’m doing. I’m that much of a beginner that we can just accept the fact that literally anything I do can be done in a better way. For now my main goal is for stuff to just work. I don’t want to win any prizes for great code. Yet.

This is an object in Stoins. It’s the blueprint for an achievement:

struct Achievement: Identifiable {
    let id = UUID()
    let name: String
    let description: String
    let image: String
    let badge: String
    
    var conditionAchieved: (() -> Bool)
}

I have an array of objects like this that I use to create the interface. The array looks a little like this:

@Published var achievementsStreaks = [
        Achievement(name: "Fortnight", description: "Have a 14 days streak", image: "badge_fortnight", badge: "badge_fortnight.gltf") {
            var result = false

            // Code that defines if 'result' is true or false

            }
            return result
        },
        
        // Second Achievement
        // Third achievement
        // etc
]

(I’m a bit proud of my use of closures here, ngl. They were very brain-breaking for me and now I’m able to use them without hurting myself in confusion.)

So far, so good. All of this works surprisingly well in terms of how the app is supposed to behave. The only remaining problem is that I can’t seem to figure out how to localize the name and description. Xcode doesn’t manage to automatically find the name and description attributes and when I add them manually to Localizable.strings nothing happens.

I thought I found the answer in this WWDC video about localization in SwiftUI but using LocalizedStringKey only works for views not structs, it seems.

For now I’ll leave it as it is. Only the about screen and achievements are affected which means it’s not an app-breaking issue for those who don’t speak English. Not great. Not terrible. A solid 3.6.

Still, I’d love to publish an update to this post where I explain how somebody helped me solve this and how it was a very easy fix. If that’s you, hit me up. There’s a very cozy comments section down below.

Update: As expected the answer to this couldn’t be more easy, I just wasn’t able to find it. Thanks Philipp for pointing me to this article. And thanks Bei Li! Every user facing string needs to be wrapped in String(localized:""). That’s it. Everything works now. lol.

November 16, 2022

Manufactured motivation and perfectionism

The hardest thing about learning to code is when my ingrained software-design-perfectionism clashes with what I’m able to do. Stoins is going great. I’d say it’s an above average app for somebody who just started coding. Yet I can’t wrap my head around the solutions to some of the problems I’m facing and I struggle with accepting flaws that are solely there because I’m not good enough yet.

Everything works, don’t get me wrong. It’s just not as good as I know it could be. I think a better understanding of concurrency could solve one of the problems. Perhaps a second problem would go away with more knowledge about threads. Oh and something, something state machines? I just don’t understand any of it enough to solve my app’s bugs.

Here’s the thing though: Motivation doesn’t come and go by some magical whim of fate. Motivation is something you create. I know that my motivation is heavily influenced by progress. I tried fixing these issues for so long without getting anywhere that I’m at a point where I need to accept that those are flaws I need to live with. It’s my second self-coded app ever, of course it has problems.

I’m sure my next project will teach me some of the things I need to learn to come back to Stoins and fix it. A cycle of learning through manufactured motivation and not giving in to perfectionism.