90 questions
0
votes
0
answers
44
views
List animations broken in macOS Sequoia but work in Sonoma (FetchRequest, Picker filters)
In macOS Sonoma, my SwiftUI code performs smooth, expected animations when List contents change — both when using @FetchRequest with a changing predicate and when filtering manually via Picker ...
2
votes
1
answer
163
views
How to remove internal padding to the right of SwiftUI Picker
I'm curious, have you noticed how Pickers have different internal padding when in a Form vs not? Of course, there are many controls that have special looks within the context of a Form. But I would ...
3
votes
1
answer
108
views
How do I extract the choices of a menu picker in XCTest?
My app uses the SwiftUI Picker, and I'd like to test that it only contains the expected choices. When I try to extract the choices in XCTest, I get back an extra entry, Choose an option, Option 1, i.e....
0
votes
1
answer
96
views
Selecting in Picker does not change selection
I am trying to display the picker and the selected emoji on the screen.
Here is the ContentView:
struct ContentView : View {
@StateObject private var viewModel = ContentViewModel()
@State ...
0
votes
0
answers
270
views
SwiftUI Navigation Link Picker Style selection problem
I am working on a small todo app project with SwiftUI/Swift in Xcode 15.4. I have a model like this:
@Model
class Category {
var catTitle: String = ""
var catEmoji: String = ""
...
0
votes
1
answer
503
views
SwiftUI Picker selection trailing alignment
I am fairly new to SwiftUI and trying to figure out how to achieve trailing alignment for the Picker view selection. Eg for UIKit, in a normal UITableView cell, you can have a Right Detail cell with a ...
0
votes
1
answer
71
views
Coloured options in a drop down Picker using ForEach in Swift UI
I'm interested in creating menu similar to one displayed in the screenshot below.
This menu is accessible via Rules settings of Mail.app. I'm interested in colouring the symbol on the left hand side. ...
0
votes
0
answers
135
views
Assign custom font to picker view choices
I use a custom font throughout my app (font is correctly setup). I'd like the SwiftUI Picker appearance to use the same custom font.
Here's a simpler sample code where the text should be in bold but ...
0
votes
2
answers
127
views
Can't get Swift picker to display selected choice
I can't for the life of me figure out why my first picker is not changing. It is stuck displaying "Option A" always no matter what I pick. The other pickers work just fine.
struct ...
0
votes
1
answer
394
views
How to increase Picker selection width?
How can I adjust the width of the list displayed when the user taps a picker? Note that I don't need to adjust width of the picker itself - only what is displayed over it.
For example, consider a ...
1
vote
2
answers
111
views
“Cannot convert return expression of type” error in custom Picker init method
I’m trying to build an extension on a SwiftUI Picker, but I’m getting the following error inside the content closure when trying to compile:
Cannot convert return expression of type 'ForEach<Data, ...
0
votes
1
answer
163
views
Why does data not populate list inside popover in SwiftUI?
What I'm Looking For
I'm hoping someone can help me understand what's going on and why SwiftUI is behaving the way it is in this scenario.
What I was trying to do
I was originally trying to create a ...
1
vote
1
answer
2k
views
How to create searchable picker menu in swiftUI
I am finding to create picker menu with self contain search bar view and once user enter any character as per result of search filter picker menu will automatically reloads in SwiftUI.
Below is the ...
1
vote
1
answer
615
views
When scrolling in a Menu - Picker, releasing the tap mid-scroll causes it to keep jumping to the top
struct PlainTextPicker<T: Hashable>: View
{
@Binding var selection: T?
let defaultString: String?
var options: [T]
var toLabel: (T) -> String
// body
Menu
{
...
0
votes
1
answer
2k
views
SwiftUI How to implement a custom dropdown menu like a Picker
I have been brainstorming ideas for implementing a button dropdown view similar to what you see in a default Picker. I have been experimenting with this in general to find a way to overlay a view on ...
2
votes
0
answers
173
views
SwiftUI Picker in WatchOS throws Scrollview-Error when using Digital Crown
The following WatchOs App example is very short, but already not functioning as it is expected, when using Digital Crown (full code):
import SwiftUI
struct ContentView: View {
let array = [&...
0
votes
1
answer
211
views
How to fix SwiftUI picker not displaying horizontally centered?
I created a simple Picker like so:
struct ContentView: View {
private let options = ["Action", "Comedy", "Drama", "Horror", "Zombie"]
@State ...
0
votes
0
answers
162
views
Picker Animation Issue SwiftUI
I have a Picker that's just listing a bunch of strings, but when I switch from a longer string to a shorter string, it does this weird animation because it's confining the long string to the size of ...
0
votes
2
answers
117
views
Experiencing trouble with Picker in SwiftUI
Running into an issue using a Picker against an enum. Trying to create a workout app, where each Day (type, 7) of the ExercisePlan needs assigned to a DayType (enum). Then I'd build out the ability to ...
0
votes
1
answer
219
views
Why doesn't Picker onTap and onChange work together?
I have a picker (segmented). I need onTap and onChange both on it. onTap works but onChange doesn't work. If I remove tap, just the onChange code works.
I need both because I am prefilling question....
0
votes
2
answers
3k
views
SwiftUI Picker in Menu
I want to display the selection when using a picker in menu like in the reminders app for Sort By and I cannot for the life of me figure out how to do it.
This is what I want:
https://i.sstatic.net/...
0
votes
1
answer
579
views
SwiftUI Form Picker options are not selecting
Why can't I select items from this picker view? The difference here is my selection array consist two different Structs('CustomOptionOne' and 'CustomOptionTwo') that conforms to the same protocol '...
0
votes
1
answer
1k
views
How to make SwiftUI Picker take the whole free space in HStack?
I need to make an input field in which I use standard SwiftUI Picker. Here is my view:
struct CustomPickerRowView<Content:View>: View {
let icon: String
let picker: () -> ...
0
votes
1
answer
380
views
getting error !! Picker: the selection "nil" is invalid and does not have an associated tag, this will give undefined results
this is my main file getting error in picker not able to select the value from picker getting error in first picker
import SwiftUI
struct MainView: View {
@ObservedObject private var ...
3
votes
1
answer
1k
views
How to customize selected item checkmark icon in SwiftUI Picker in List
Using SwiftUI how can I customize the checkmark icon of the selected flavor in this simple Picker?
struct ContentView: View {
var flavors = ["orange", "strawberry", "lemon&...
1
vote
1
answer
130
views
How to make Picker onChange update a selected struct?
I have two structures. One of these structures Idea has a field that stores an instance of the other structure Option. In turn, Option has a list of IDs of Idea structures associated with it.
I ...
0
votes
1
answer
1k
views
SwiftUI Picker not showing selected value
I am aware there are other questions about this, but none of them answer the question.
There are two slightly different cases that are resulting in the same behaviour: using an enum for the Picker ...
1
vote
1
answer
1k
views
SwiftUI: List and TabView are getting over-lapped each other
In my app, i am trying to display: SegmentedPicker on top of the screen, Then List, Then a simple button on bottom-right of the screen using safeAreaInset, and then a tabBar using TabView
My problem ...
0
votes
1
answer
1k
views
SwiftUI Picker in List adding extra row on top when using sections
I have a SwiftUI inline picker in a list. It works fine however when I enclose it in a section, an empty row appears on top of each section with an inline picker. Is there anyway to remove this ...
0
votes
0
answers
510
views
SwiftUI horizontal wheel picker cell item size
I'm currently trying to achieve a horizontal picker view where the user can select its avatar shirt. The rotation and adjustments of the picker works fine but my selected picker view cell size does ...
-2
votes
1
answer
360
views
Create wrapper for SwiftUI Picker View with elements and selection parameters
This is my code:
import SwiftUI
struct VPickerView<T: Hashable>: View {
private let elements: [T]
private let selection: Binding<T>
init(elements: [T], selection: Binding&...
0
votes
0
answers
189
views
Swiftui Picker with protocol type - Compiler is unable to type-check this expression
Given this Struct who conforms to Relationable protocol
struct RomanticRelation: Relationable{
typealias Relationship = RomanticRelationType
typealias Relation = RomanticRelation
var ...
3
votes
1
answer
360
views
SwiftUI Picker Options Flipped in RTL
As you can see in the attached image, the picker options are not aligned automatically to the right-hand side for RTL languages, and also flipped.
The picker is nothing fancy either, the standard way....
2
votes
1
answer
251
views
SwiftUI Picker strange behavior when in an EquatableView
I post the minimum code to reproduce the behavior. Tested on latest macOS and Xcode.
The picker in this example is just a wrapper for the default picker and conforms to Equatable (this is a must to ...
0
votes
0
answers
87
views
How to change the selection of the second picker after changing the first picker?
Here I'm trying to create the first little app that helps to convert a value from one unit of measurement to another.
The first conversion picker helps me to select data for the second picker(from ...
1
vote
1
answer
344
views
SwiftUI ScrollView messing up picker selection behaviour
I'm building a WatchOS-app (SwiftUI) with multiple pickers, but as soon as I add them to a ScrollView I can no longer simply tap a picker to select it.
When I tap a picker the first picker on the ...
0
votes
2
answers
53
views
Picker not selecting the desired option
I am trying to setup a picker, simple. I am successfully fetching an array of projects from firebase and populating the picker with the names of the projects. The problem that I am having is that I ...
0
votes
2
answers
191
views
Picker .onChange doesn't change when choosing default
I have pretty much same question as here:
SwiftUI Picker onChange or equivalent?,
but .onChange won't solve it exactly I need.
I have wrote a question in that link, but I was told to ask a new ...
4
votes
2
answers
4k
views
swiftui picker how to hide up down arrows (ios16)
Is there a good way to hide the up down arrows in the picker default style. I am using ios 16. It seems that the older version does not have such arrows.
Also, is there a setting to set the picker's ...
2
votes
2
answers
1k
views
Applying padding to SwiftUI Picker with menu style is causing multiline text
I have a Picker with menu style presenting a label with an icon and text. When applying a padding to any views containing the picker, the picker will behave as though there is not enough space and run ...
1
vote
1
answer
2k
views
SwiftUI Menu Picker Style shows strange double arrow
Basically I am using Menu Picker Style for display a set of numbers. I prefer it over Menu because it doesn't have checkmark in front of the selected item and because I need to change the text of the ...
3
votes
2
answers
2k
views
Why doesn't Picker's tint color update?
I found 2 unexpected (for me) behaviors of Picker in SwiftUI.
The default style for Picker on iOS inside the List view seems to be .menu and it does not take any tint color at all (fair enough). ...
0
votes
0
answers
208
views
SwiftUI picker save return object
I have a background in .NET backend and I have decided to learn swift.
It is going very well, but I have a few issues in SwiftUI.
My problem right now is with the picker.
My goal is to pick an item ...
1
vote
0
answers
31
views
How modify list values from a Pickervalue
I have a list which is already containing different values. For each List postitions I have made a button which leads to a sheet View which contains a Picker to change the value of minutes and seconds....
10
votes
4
answers
2k
views
App crashes when SwiftUI view with Picker disappears (since iOS 16)
We have an application with some 'chat' functionality where questions are asked and the user can answer with some predefined options: for every question a new view is presented. One of those options ...
12
votes
4
answers
8k
views
SwiftUI Picker with option for no selection in iOS16
I am using Picker with option for no selection, in iOS15 it is working fine, but in iOS16 it has a default value, how can I remove this default value, I don't need to show the text to the right of the ...
0
votes
1
answer
222
views
SwiftUI TimePicker Bindings to the view of the parent view
Hello, I would like to take some advice on my requirement. I have a parent view which has a child view and that has one more child view. Basically, I would like to pass the binded value to the parent ...
0
votes
2
answers
2k
views
SwiftUI picker with TextField for optional entry
Picker with a choice of names. If ‘other’ is selected a TextField appears. User enters something into the TextField and the user entered value needs to also be reassigned to the Picker variable. I've ...
1
vote
1
answer
201
views
How to update observableObject class after value is updated by picker - swiftui
I have an ObservableObject class that fetches the remote data based on month and year value. Initially it works fine because I use current month and year values however I want to update and re run the ...
1
vote
0
answers
1k
views
How to remove background blur from SwiftUI Picker
In SwiftUI, Segmented Pickers (Pickers with SegmentedPickerStyle()) ) come default with a blur in the background of each item. Is there a way to remove this?
As you can see, option2 has a gray blur ...