Solve some strange behaviors of embedding List and Button in the Form view of iOS 15.3+ SwiftUI

insert image description here


problem phenomenon

In the iOS 15.3+ system, apps developed with SwiftUI will encounter some compatibility issues more or less.

We fixed several incompatibilities such as buttons not responding to clicks in the SwiftUI toolbar in iOS 15.3.1. This blog post has discussed some of the quirks in the toobar.

But the toolbar is not the only troublemaker, and the Form view in SwiftUI is by no means "a fuel-efficient lamp".

If you are adapting to a system above iOS 15.3, the Form view used as a container will encounter the following problems:

  • List view embedded in it cannot respond to Edit Mode changes
  • Buttons embedded in them that meet certain conditions will not respond to clicks

So is there any way to bypass the above problem?

Of course there are ways to avoid it!

Now, let's discuss the solution together!

Let’s Go!


The solution of the List embedded in the Form cannot respond to the edit mode

In iOS 15.3+, the following code fails to make the List respond to Edit Mode changes:

 

Guess you like

Origin blog.csdn.net/mydo/article/details/123156404