If you want to display an outline in SwiftUI you may use the framework supplied OutlineGroup
construct. That’s based on a nested tree of DisclosureGroup
and is quite nice. But on appearance of the OutlineGroup
all outlines are collapsed. Well, in one of my projects I wanted to display the outline all expanded on show up. No way to do that with OutlineGroup
as far as I know. But then I found this nice variant (https://stackoverflow.com/questions/62832809/list-or-outlinegroup-expanded-by-default-in-swiftui) with a control of expansion:
Swift
Text Fields in Lists on macOS SwiftUI
Today’s post is a bug report. I’ve sent a developer feed back to Apple already but got no response yet. I don’t know exactly when Apple introduced this bug. But it may well be with the first release of macOS Ventura (13.0) and it’s still not fixed as of macOS 13.4.1.
At that time I’ve noticed that the text fields of one of my macOS Apps got an unintended left padding when included in a List
. Here is a very simple test code to demonstrate the problem:
Missing Tiles in MKTileOverlayRenderer
Well, there is a bug in Apple’s MapKit since iOS 13.2, as the folks in developer community say: If you want to use non-Apple maps (e.g. OpenStreetMap®) occasionally tiles are not rendered although you supply the correct data in your sub-class of MKTileOverlayRenderer
. There seems to be no obvious systematic but if you scroll around the map you’ll soon find missing tiles. There seems to be no real fix for that problem and your app will not be notified if that happens; the delegate method mapViewDidFinishRenderingMap(mapView:fullyRendered:)
will always signal „fullyRendered
“ although tiles may be missing. Weiterlesen
.fileExporter and .fileImporter Won’t Work inside a Menu in SwiftUI
Recently, I noticed that the newly introduced fileImporter
and fileExporter
view modifiers in SwiftUI won’t work inside a Menu
view. It’s not a big deal to put the file modifiers outside of the menu, but it took quite a while for me to pin down the problem.
SwiftUI and the Problems of Timing
Well, SwiftUI is certainly a big improvement on building maintainable, robust and nice user interfaces on iOS and macOS compared to the old MVC architecture (Massive View Controller) and the NIB (Next Interface Builder). But it is mainly a declarative framework and from the application developer’s point of view it’s sometimes hard to anticipate what is really going on behind the scenes and especially when its going to happen. There are situations where the promised behaviour doesn’t take place and I’ve already struggled hours for hours to look for a workaround.
Especially the .onAppear
modifier seems to be problematic. It looks as if the supplied closure will be executed too early sometimes and the statements inside do not have the desired effect.