41,764 questions
-1
votes
1
answer
40
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
0
answers
39
views
Incorrect display of the TabBar when selecting a tab with scroll view inside
I'm trying to implement a tab bar on iOS 26 like the Music or Health apps on iPhone.
On a white background this is not noticeable, but when changing the background color to dark at the start of the ...
2
votes
1
answer
61
views
SwiftData update causes render with initial data overwriting changes
I'm working on a SwiftUI app using SwiftData, and I'm very new to both frameworks, and swift in general to be honest. I'm trying to create a webview that embeds a monaco editor that will then send the ...
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 ...
1
vote
0
answers
32
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
1
answer
49
views
How to present app-wide alerts/sheets above existing sheets in SwiftUI (central presenter like UIKit)?
TL;DR: my app has some global alerts and modals (e.g. hints about trial limits, the in-app purchase screens, etc.) which should be available through out the app. In UIKit I could always present alerts ...
1
vote
1
answer
63
views
Pre-Selecting Values for a MultiDatePicker
Premise
I have a MultiDatePicker bounded to a closed range of the current month. In addition, I have a datePicker representing a "Start Date" that is the current day. I want the Day of the ...
1
vote
2
answers
57
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 ...
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 ...
0
votes
1
answer
58
views
How to use custom style for macOS app ToolbarItem (the sidebar toggle button)?
This is what I want to achieve for the sidebar toggle button:
When hovering:
When not hovering:
This is what I have now (macOS 26):
When hovering:
When not hovering:
I want to remove the border ...
0
votes
1
answer
57
views
Content of TabView is going beyond safe areas in the NavigationStack
import SwiftUI
struct OnboardingView: View {
@ObservedObject var viewModel: OnboardingViewModel
var body: some View {
TabView(selection: $viewModel.currentPage) ...
-3
votes
1
answer
43
views
Text Layout Inconsistency with maxHeight and fixedSize
I'm experiencing inconsistent layout behavior with SwiftUI Text when using maxHeight constraints combined with fixedSize().
I have a long text string that behaves differently depending on the ...
2
votes
1
answer
92
views
Reloading another iOS widget's timeline from an AppIntent
I’m working with two iOS widgets (WidgetA and WidgetB) that both display the value of a flag stored in SwiftData. Each widget can update the flag by triggering an AppIntent when a button is pressed.
...
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 ...
1
vote
2
answers
55
views
Automatic Grammar Agreement with an In-line If Statement
Normally in Swift 5.5+, Automatic Grammar Agreement allows you to inflect a word based on the quantity of an associated numerical variable, such as the following:
Text("I have ^[\(dogCount) dogs](...
-1
votes
0
answers
81
views
How to implement native Tab Bar search (.searchable) for a Dictionary view in SwiftUI? [closed]
I'm trying to implement native SwiftUI search for my Dictionary screen. The goal is simply to make .searchable show the system search UI (either the expanding tab-bar search, or the regular navigation ...
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 ...
0
votes
0
answers
25
views
NLTagger sentimentScore always returns 0.0 [closed]
I’m using NLTagger with the .sentimentScore tag scheme to analyze text sentiment. The setup is straightforward, and the code looks like this:
import NaturalLanguage
struct Scorer {
let tagger = ...
1
vote
0
answers
41
views
Error running application, ”request was denied by service delegate” [duplicate]
I am getting this error after my application installs on IOS Simulator then it fails to launch the application on it.
It seems the app is crashing just after launching and my mac or simulator are ...
Best practices
1
vote
2
replies
53
views
What is the best pattern for SwiftUI Document Application?
I am trying to create a full SwiftUI Document app (using swift 6, as it matters).
Apple doc says that the Document init(configuration:)and fileWrapper(configuration:)are called on a background thread -...
Best practices
0
votes
2
replies
48
views
How to preserve View state when switching between completely different SwiftUI layouts?
My app uses different layouts depending on device orientation. For example:
in portrait: a TabView-based layout
in landscape: a NavigationSplitView-style layout
When switching between these layouts, ...
0
votes
0
answers
56
views
Selected image from pagination not correctly showing in Preview screen
I have a pagination for grid where selected image not correctly showing
this is servicecall:
@Published var isLoadingPage = false
func getPhotosAlbumDetails(ID: String, resetPage: Bool, showHud: Bool ...
0
votes
0
answers
26
views
NSTextField without bezel - text beginning cut off when editing
In MacOS app I need a transparent textfield, that shows only editable text and nothing else. I am using SwiftUI, but to achieve this, I have created NSViewRepresentable for NSTextField. This is how my ...
0
votes
0
answers
26
views
onGeometryChange on scrollview in swiftui availability issue [closed]
`onGeometryChange`
The feature is showing as available only on iOS 18, whereas Apple’s documentation states that it should be supported from iOS 16 onwards. I’m currently building with SDK 26, so I’...
2
votes
1
answer
59
views
iOS Picture-in-Picture stops unexpectedly despite using AVPlayerLooper - How to keep PiP running continuously?
I'm building a teleprompter app that uses iOS Picture-in-Picture (PiP) to display scrolling text while users record videos with the camera app. The text is rendered into a video which plays in PiP ...