SwiftUI Popover replaces existing popover without moving it or pointing it at the correct view

Development / iOS / Making of Captionista

While building our new subtitling app Captionista we changed the UI to have a couple of buttons in the navigation bar that show popups on iPad.

I hit another fun bug with Popovers in SwiftUI: if you have multiple UI elements that can show a popover, if the user does not dismiss the previous popover, the next one will be shown in the previously active popover.

Unfortunately SwiftUI replaces the previous popover content but does not move the popover on iPad to point at the correct UI element, which is very bad.

Workaround: None that I know of yet.

There’s a feedback: FB8889229 “With SwiftUI, opening a new popover on iPad when the previous is still active, replaces the content of the old popover”

Colouring the arrow of a Popover in SwiftUI

Development / iOS / Making of Captionista

If you have custom background colours or e.g. force dark mode on your View as we do in Captionista, you will be sad to discover that the popover in SwiftUI draws the arrow without allowing you to colour it. If you use a NavigationView this is hidden from you as the navigation bar “fills” the arrow space also, but if you don’t… you end up with the system background colour in the arrow, and your custom colour in the body of the popover.

Read More

Me: “Why is my SwiftUI view not updating when the model changes?”

Development / iOS / Making of Captionista

The initialisers of Views in SwiftUI have some surprising and obscure behaviours related to state. If you’ve used SwiftUI at all you will likely have discovered this.

In addition, the rules around how properties that are wrapped with Property Wrappers are accessed are interesting when inside the initialiser of the type. It is this latter issue that bit me.

Read More

xCloud and its ilk should never be allowed on the App Store

Uncategorized

This was originally posted as a tweet storm, preserved here for those who prefer an old fashioned post

I think the whole Apple and MSFT xCloud spat is not really much about MSFT and games and content review. It’s about preventing alternative app stores, which is a longstanding App Store rule. Buckle up! 👨‍🚒

[Note that this is all my opinion only and in no way indicative of the views of my client]

The nub of it is that Microsoft want to make more money from their games but don’t want to bother porting them to iOS/macOS. They’d rather have you pay to use their data centres to stream the existing code they have.

Once this kind of cloud streaming of games is allowed, it’s not a stretch to think someone else will do this with other kinds of apps. Maybe in 2021 we get an “aCloud” that lets you run Android apps on iOS by streaming them. Yay! Nope 😡

As Jason Snell explained in Upgrade this week (but is not Jason’s view), this can be seen from Apple’s perspective as devaluing the entire Apple platform prospect. Apple devices reduced to input/output “pipes” are not differentiated enough.

Imagine this but for almost all apps. That don’t integrate with all the things Apple has made possible; Apple Pay, PassKit, Widgets, Siri Intents, Siri Suggestions, iCloud etc.

How would Apple be able to deny other such streaming app store-like apps if it accepts gaming ones? Why are games different? What makes a game? Gamify your To-Do list app and you’re in!

It is my belief this would hold back tech progress for all of us if “commodity” users move to other platforms due to lack of differentiation. Apple’s life-improving features need mass adoption.

Consider a world where 2007 and the iPhone never happened. Our current tech timeline was not inevitable, and we have a lot to thank Apple for. Read the full thread before you “ha fanbois!” me.

We all love to complain about how even very large companies don’t bother making native Mac client apps, so we know this “well we can compromise on X to launch quicker and cheaper” attitude is common.

I don’t really think we’d see a streamed version of Office 365 but… who knows. These are commercial decisions from brutal capitalist beasts like Microsoft. You can see the argument “…why are we spending $$$$$ on developing MS Word for iOS?”

If general app streaming existed it could become commonplace – one or two “killer” apps like the next TikTok debut there and younger users go to the new “app store” in droves and the service owns their identity for all apps.

Then it becomes the “place to be” to launch new apps because it has a big audience. As a hardware and OS maker the last thing you want is people bypassing everything you’ve created.

(Ironically it seems this has already happened to some extent with WeChat, though I have never used it and limited to China. It seems the relationship with Chinese infrastructure & politics plays a large part here.)

Importantly, you clearly can’t do as much to protect user’s privacy when you don’t require app review and use of native device APIs. You might be able to require a transferable security and privacy policy that the sub-store must apply?

It’s true that the “Reader app” categorisation is a really hard argument to settle as it relies on very precise descriptions of what content actually is — a movie is content, a game is content, is a utility app content?

Is a mail app content? Is your To-Do list content? Most of these can be done with web-apps already but people who appreciate native experience know this usually sucks. The web is effectively app streaming, and the same issues apply there.

This would dilute the value of the native experience and we’d maybe even end up with web apps being streamed like a game 🤯. Yes, you can bet somebody would try this as a “great low-cost cross platform app solution”.

Do we really want iOS and iPadOS to become like macOS where people don’t bother making native apps anymore because there’s a cheap and lazy alternative?

Accepting streaming of apps, games or otherwise, is how you get there. Apple know this, because it has already happened to the Mac. This is in part why iOS apps are coming to the Mac! Doh!

Once we have a streaming app portal to any other apps, then it probably becomes “stream WebGL games through our webCloud app”… and then “use androidCloud to stream webCloud to run your favourite WebGL games from 2015” 🤦‍♂️

Don’t tell me people won’t do this stuff. People do this stuff all the time with emulators and VMs, and they are useful or fun toys for niche uses, but it should never be the norm.

There are already Mac, PC and Atari ST emulators in the browser after all: https://jamesfriend.com.au/pce-js/ (yes, spare me the irony that Apple won’t allow native versions of such emulators in the store, so “yay for web”!)

Let’s backtrack and ask on what do I base this view? I’ve been contracting long enough to see this cycle over & over. I’ve written assembly on the Atari ST, native DOS & Windows apps, Java desktop apps and J2ME phone apps.

I have worked on many web front- and back-ends and native apps for Apple Platforms, even touching on a React Native code base under duress. I never expected to end up back doing native coding, but I’m here for the great UX and superior product.

I’ve been in many web vs. native arguments before, and didn’t expect this MSFT xCloud issue to end up here but 🤷‍♂️

Right now we’re still in the phase where people incorrectly assume “writing web apps for mobile is the best solution”. WebAssembly and WebGL exist now. HTML Canvas has existed for a while. These are bad app stacks.

When canvas was announced years ago I predicted people would build custom UI components with it to make native-seeming “web apps”. Sure enough, here’s one example of this terrible idea made flesh http://www.zebkit.org/light/about.html

If there’s one thing I’ve learned it’s to never underestimate the propensity of smart developers to create stupid software stacks. This is fine for fun projects, but for the entire world it is definitely not.

There was Quake running inside Netscape in the late 90s (amazing job Niclas Thistle!). There were Java’s UI toolkits that assumed all OSes should have identical UI behaviours and just look a bit different. Sun’s dumb Java terminals? 🙅‍♂️

We’ve had web-based VNC streaming of remote desktops (just to work around firewall/software install policy issues) and now full-fledged “desktop” apps like Figma in the browser (Also not a fan, though technically impressive)

These things exist due to a mixture of “because we can” (just about), cost cutting / commercial pressures, and compromises e.g. there is no great native cross-platform collaboration protocol so web-based apps can win hearts in an org.

[They should be fixing that by the way — Apple, Google and Microsoft. Oh, except they won’t because Google and Microsoft are all about the web and Apple is slow to open up iCloud for interop.]

“Single code base!”
“Nothing to install!”
“Collaborate!”
“Continuous updates!”

It sounds great. The flip-side: usually a sub-par experience for all, vastly variable experience based on hardware, energy efficiency, offline etc. the usual stuff.

Most of the pro’s and con’s are about who is making money and how. A web service makes billions at the cost of millions of users having a daily experience that is lacklustre. MSFT Teams is a great example of this. Awful.

There are externalities to figure on both sides: energy use (and whether renewable) by server or device, performance, privacy, security, offline availability, and the more fuzzy and oft ignored ones…

…such as user happiness, frustration, productivity / time efficiency. These really matter but are rarely considered on a macro scale even by many UX designers. When things don’t go smoothly it affects our stress and emotional wellbeing.

Most of these externalities all get cancelled out by capitalism and inadequate investment in education for all. Ship fast and cheaply, using people who don’t need in-depth skills who we can hire easily because there’s a ton of them just raring to go.

I am not for a moment saying development should be hard and exclusive. I despise how complicated it is making apps native or otherwise. We should all just be waving our hands in the air and making things from blocks.

However we are nowhere near that and I don’t think we ever will get there. While many devs like me don’t have formal discipline, we ARE engineering and this is what the job requires for a result that factors in the externalities.

This is all that is wrong with our world. It’s why you can’t buy well made furniture unless you are rich and you’re left with chipboard and plywood crap you recycle a few years later instead of keeping it in your family for generations.

Let’s be clear: Apple is a company. It makes a lot of money. That’s why companies exist. It also has propelled us into the future. We give this up at our own peril, and I think the App Store issue is surprisingly, the keystone of this.

If the tide of app development shifts further to web and (shudder) streaming, and Apple’s fortunes turn because you might as well get commodity hardware to run your apps… we’re all screwed.

Don’t @ me with arguments in favour of web or React Native approaches. I know, you think it’s awesome that’s fine.

YES, GOOD NATIVE DEV IS REALLY HARD. I wish it was easier. That’s what we should all focus on fixing. (Microsoft however have no excuse. They have tons of money and resources to port the games).

It’s capitalism bullshit in the bigger picture, including the fact Apple earns so much and has this power. I however much prefer this and more tech progress than the Idiocratisation of software experiences.