Mobile Messages…

Messages from Hobbyist Software

You can create your own SwiftUI Environment…

Every now and then, I’m frustrated that SwiftUI is missing an obvious environment variable.I really expected it to have @Environment(.keyboardShowing) var keyboardShowing It doesn’t. But you can make your own.Simple example of how you use it here: In this example, we show a ‘keyboard down’ button if the keyboard is showing. The button clears focus

Read more →

How to access related files in the Mac Sandbox

I’m building an app which needs to load Objective C files.If the user gives me access to the ‘.m’ file, I need to be able to open the ‘.h’ file. You don’t get this ability without a bit of a dance. I didn’t find any clear tutorial or example, so I’m adding one now. Firstly

Read more →

@MainActor – The Rules!

I’m going to have a shot at defining what @MainActor does, and what it does not guarantee. Why? I keep seeing tutorials and talks explaining @MainActor with something like the following quote Isolation to the main actor is expressed with the MainActor attribute. This attribute can be applied to a function or closure to indicate

Read more →

Swift Concurrency Protocol & @MainActor

At this stage, I’m just riffing on different ways to ‘break’ swift concurrency. I wondered if protocols would provide an opportunity, and indeed they do! Take this scenario. We have a simple protocol – but the class implements it with an @MainActor annotation. If you do this all within the main class definition, then you

Read more →

Five ways to break Swift Concurrency

I really like Swift Concurrency. I just wish Apple would clearly document what it actually guarantees Generally, sites (including Apple) explain that marking a function with @MainActor guarantees that it will always run on main. By adding the new @MainActor annotation to Photos, the compiler will guarantee that the properties and methods on Photos are

Read more →

@MainActor – not guaranteed

tldr – marking methods with @MainActor does not guarantee that they run on the main thread. Swift has a magical new structured concurrency model. ‘using Swift’s language-level support for concurrency in code that needs to be concurrent means Swift can help you catch problems at compile time’ -the swift programming language One of the new

Read more →

Fool me once… Reporting bugs to Apple

About a year ago, I decided to give up reporting bugs to Apple. Like many others, I got fed up of them simply being ignored. At WWDC in in June of 2021, I signed up for a SwiftUI lab, and showed the two Apple engineers a bug that had been annoying me. The bug is

Read more →

Dynamic Wallpaper Wierdness (again)

tldr; Multi Monitor Wallpaper can give you the daytime images for your dynamic wallpaper even if you use dark mode. One of the trickier things that Multi Monitor Wallpaper does is pull apart dynamic wallpapers so that it can build separate ones for each of your monitors. It then puts them back together again. These

Read more →

Apple Reviewers can Punish You

tl;dr – Apple policy may now say they won’t hold up your urgent bugfix, but that doesn’t stop them holding it ‘in review’ for an unusually long time so that it is never actually released… I have had plenty of ‘robust discussions’ with App Review. Sometimes they come round to my way of thinking –

Read more →

Page 1 of 15