38 questions from the last 7 days
4
votes
1
answer
161
views
SwiftUI horizontal drag-to-reorder view feels jittery – how can I make the drag smooth?
I’m building a horizontal “carousel” style view in SwiftUI where items can be reordered by dragging (similar to an editor timeline).
The basic idea:
Items are laid out in a horizontal track inside a ...
1
vote
2
answers
68
views
SwiftUI @FocusState doesn’t focus a desired TextField
I have a SwiftUI view with multiple TextFields and a @FocusState bound to my view model. I want the first field to automatically get focus whenever the view appears(when coming back from a SecondView)....
-4
votes
1
answer
61
views
How to move window control buttons (traffic light) in macOS SwiftUI [closed]
How to make it possible to place the buttons slightly below and to the right of a regular window without using (toolbar, navigationSpitView, etc) like in the Chrome or FireFox browsers
the image ...
1
vote
0
answers
76
views
How to dynamically size TextEditor like TextField in SwiftUI
In SwiftUI, you can dynamically size a TextField like this which expands vertically as the user types.
TextField("Enter text", text: $text, axis: .vertical)
I would like to do the same thing ...
1
vote
2
answers
59
views
How do I extend the background of child views to their parent without using GeometryReader and without affecting the natural height in SwiftUI
As you can see in the image below, I want the left (star) and right (sun) views’ backgrounds to fill their parent (HStack) without using GeometryReader or altering the HStack’s natural height.
struct ...
1
vote
1
answer
65
views
How to dynamically update an existing AVComposition when users add a new custom video clip?
I’m building a macOS video editor that uses AVComposition and AVVideoComposition.
Initially, my renderer creates a composition with some default video/audio tracks:
@Published var composition: ...
Advice
0
votes
5
replies
45
views
Strange behavior draggesture
I am exploring the use of drag gestures.
Below is a small test code to see what happens and because I want to know the location on the screen / map.
The first time I drag, it works fine, but when I ...
1
vote
2
answers
58
views
Updating a property in @Observable ViewModel trigger a redraw of all Views using it
I’m using the @Observable, @Bindable in SwiftUI.
I have a simple ViewModel with two properties:
@Observable
final class AlarmLevelSetupViewModel {
var displayedValueLevel1: Decimal = 1
var ...
-2
votes
0
answers
51
views
Homography in soccer app not work properly [closed]
I'm having trouble calculating the inverse homography that would draw the players on the 2D pitch in the view.
The homography calculation seems perfect to me because the virtual pitch drawn on the ...
-2
votes
1
answer
41
views
Segmented control has design bugs in Navigation Bar with Liquid Glass
When I put a SwifUI segmented control in a navigation bar, liquid glass seems to be making it render incorrectly. The capsule has vertical clipping and the sides show layered backgrounds.
Here is my ...
1
vote
1
answer
70
views
How to structure SwiftUI so that pages keep their state when switching between different UI layouts?
I have a SwiftUI view that switches between two completely different container layouts:
a TabView layout (for compact width)
a sidebar + content layout using HStack (for regular width). I am using a ...
2
votes
1
answer
40
views
How to use NavigationStack with path and multiple enum type destinations in SwiftUI
I want to use NavigationStack with a custom navigation path array supporting multiple destination types. For example:
enum A: Hashable { ... }
enum B: Hashable { ... }
NavigationStack(path: $...
1
vote
1
answer
38
views
How to create a SwiftUI Menu with multiple Pickers without extra dividers?
I'm trying to create a SwiftUI Menu containing two Picker to control content and sort. However, I cannot replicate menu appearance shown in my reference screenshot.
No matter which approach I try, I ...
0
votes
0
answers
36
views
How do I create a Preview for a Scene?
The top level of my app looks like:
struct MyApp: App {
var body: some Scene {
DocumentGroup(newDocument: MyDocument()) { file in
MyContentView(document: file.$document)
...
-1
votes
0
answers
33
views
Smooth page scrolling with drag gesture
The issue I'm having is that, even though scrolling with the trackpad and the drag gesture both work to flip through pages in the scrollview, the animation when landing on a page is jerky and not ...
0
votes
0
answers
23
views
Swift can’t load resource folder at runtime (“No such file or directory”) even though files are added to Xcode [duplicate]
I'm building a macOS app in SwiftUI and I'm trying to load a folder called Wallpapers that I added to my Xcode project.
The folder contains subfolders (categories) and each category contains wallpaper ...
0
votes
0
answers
23
views
Coloring the SwiftUI Toggle in macOS26 no longer works
on macOS26 / 26.1 Tahoe the Toggle stopped being colored / tinted by using modifier
.tint(toggleColor())
it just remains with the current system color... e.g. blue or the tint central to the whole ...
0
votes
0
answers
23
views
How to add multiple device-only xcframeworks to enable simulator run too in SwiftUI?
So, I have SwiftUI project, which is multi-modular project. All the modules are included in the form of SPM. Everything works fine until now when we are required to integrate third party sdks which ...
Advice
0
votes
0
replies
32
views
Implementation of view that covers predictive text panel
I am trying to place a custom view so that it will cover, partially, predictive text panel from the iOS keyboard. However i can't seem to manage implementing it, the predictive text panel is always ...