Neighboring buttons dip down a few pixels in iOS 16 (but not 15.5), despite a ButtonStyle
that changes only opacity.
UnexplainedVerticalMicroMovement.mp4
ProblematicPress.mov
Xcode: Version 14.0 (14A309)
I hereby claim:
To claim this, I am signing this object:
Some approaches to presenting a UIActivityViewController
in SwiftUI work for some compositions, but sporadically fail for others. In those cases, your UI can appear to hang because the dismiss callback is never reached.
Since on iPad UIActivityController
presentation is modal (and requires a valid origin rect), the host VC must be in the active view hierarchy before calling present
. However, that insertion may not occur when expected (e.g., when updateUIViewController
is called).
In D_Gen3.memgraph, Xcode memory debugger reports one leaked type, the Color
for the bullseye in an HSV color picker, which adapts to brightness. Instruments would report thousands of leaks, 99% not referring to app code.
% leaks D_Gen3.memgraph
9 com.apple.SwiftUI 0x1c94e6318 partial apply for closure #1 in ViewBodyAccessor.updateBody(of:changed:) + 44
8 Inclusivity 0x102dc53e8 protocol witness for View.body.getter in conformance HSVHueSatWheelBullseye + 40 <compiler-generated>:0
7 Inclusivity 0x102dc3594 HSVHueSatWheelBullseye.body.getter + 820 HSVHueSatWheelBullseye.swift:12
6 com.apple.SwiftUI 0x1c9e748ac ZStack.init(alignment:content:) + 180
5 Inclusivity 0x102dc409c closure #1 in HSVHueSatWheelBullseye.body.getter + 960 HSVHueSatWheelBullseye.swift:20
Only one alert may be attached to a view. To avoid collisions and clutter, one could handle alerts centrally using the func alert<Item>(item: Binding<Item?>...
modifier on a senior view.
The init above accepts a binding for any identifiable object and provides a closure to map it into multiple types of Alert
views. To minimize code in that closure and simplify call sites, below is a minimalist example wrapper and implementation. This isn’t complex at all, but while the API is decent it could be simpler.
@main
struct SomeApp: App {
@StateObject var coordinator: AppCoordinator
On Mac, SwiftUI's .onHover
closure is not always called on mouse exit, particularly with high cursor velocity. A grid of targets or with finer target shapes will often have multiple targets falsely active after the mouse has moved on.
It is easy to run back to AppKit's safety. Below is a SwiftUI-like modifier for reliable mouse-tracking. You can easily adapt it for other mouse tracking needs.
import SwiftUI
While making the default insertion caret pop a little wider for better accessibility, I ran into an issue where the insertion point ghosted on arrow key presses. Christian Tietze observed the same issue.
My culprit was settings an x offset for the rect inside drawInsertionPoint
. While Christian's blog code doesn't include an offset, there's otherwise no difference in our approach.
Below draws wider insertion caret with rounded corners.
class FatRoundInsertionCaretTextView: NSTextView {