Post

Replies

Boosts

Views

Activity

Reply to Section Does Not Seem To Expand/Collapse
The problem here is that your data model is a class. The @State property wrapper is primarily designed to work with value types (like struct and enum). When you assign a new value to a @State variable, SwiftUI can see that the entire value has changed and re-renders the view. But with a class, the reference stays the same when you just change its properties, so SwiftUI doesn't notice and doesn't update the view. However, that doesn't mean you can't use classes at all. The Observation framework allows a class to expose properties that, when changed, will cause the view to update. So, you have two options: Change your data model to a struct. Add the @Observable macro to your data model.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’25
Reply to textSelection does not work
What do you mean by "does not work"? I'll need more information such as the code you're using and the expected vs actual behaviour you are seeing. Also have a read of the documentation to see the usage and expected behaviour on both iOS and macOS. If you want a different behaviour or additional features, then submit an enhancement request.
Topic: UI Frameworks SubTopic: SwiftUI
Jul ’25
Reply to `ContextMenu` and `Menu` Item Layout: Icon/Title Order Discrepancy Between System and Custom Apps (iOS 26)
The new behaviour in iOS 26 is for labels in system menus to have the icon first then the title. The previous behaviour was a leading title and a trailing icon. According to your screenshots, "System App" shows the new iOS 26 behaviour and "Custom App" shows the older one. What iOS version is "Custom App" running on? If it is iOS 26, then make sure you are building new versions with Xcode 26 and also check to see if you've set the UIDesignRequiresCompatibility Info.plist key to YES (and change it to NO or just remove it). On your other point, there is very little customisation available in menus and the layout is handled by the system, so you can only set simple properties like title and icon.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’25
Reply to Documentation for UIListContentConfiguration is incomplete in UIKit
I don't think there's anything wrong with the documentation. ‎ states that I can get the default content configuration of a UICollectionViewCell The documentation doesn't actually state this. UICollectionViewCell is just a generic cell type where you, as a developer, can customise its contents and layout. So while it does have a defaultBackgroundConfiguration() method, there is no specific default content configuration that can exist. What the documentation does say is this: For views like cells, headers, and footers, use their defaultContentConfiguration() to get a list content configuration that has preconfigured default styling. Alternatively, you can create a list content configuration from one of the system default styles. If you navigate to the defaultContentConfiguration() method, you will see that it is defined on UICollectionViewListCell. This is the type you use for creating standard cells in a list with list-specific features. If you aren't using this type of cell or want different default styling, then you can follow the alternative and use one of the static UIListContentConfiguration methods. So maybe the documentation can be clearer in specifying UICollectionViewListCell, but I think its inferred with all of the list types, detailed further in sample projects and other documentation pages, and also the fact that you are creating a list.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’25
Reply to Make a grid of `TextField`s in SwiftUI
The issue is this part despite what the error message says: TextField("", text: c.strings[r][c]) The first quick point is that you are using c here as the environment object and the ForEach closure parameter, so Swift is getting confused and doesn't know which one you are referring to. I will be referencing the environment object property as controller. The second point is illustrated further by the example you gave. TextField("", text: $text) TextField expects to be passed a Binding<String> which is why you prepend the $ symbol to obtain one from a variable. However in your code, you are passing in controller.strings[r][c] which is just a regular String and not a binding, which is why the error occurs. To solve this, you need a way of getting a Binding<String> from your current String property. There are two ways of approaching this — pick whichever one you prefer. ‎ Use the Bindable property wrapper which facilitates creating bindings from the mutable properties of observable objects. var body: some View { @Bindable var controller = controller TextField("", text: $controller.strings[r][c]) } ‎ Manually create a Binding and pass that to the text field. TextField("", text: .init { controller.strings[r][c] } set: { controller.strings[r][c] = $0 })
Topic: UI Frameworks SubTopic: SwiftUI
Jul ’25
Reply to SWIFT UI - HTTP POST method sending as GET method
In your code, you've configured a URLRequest object but aren't using it anywhere. Currently, you're fetching data like this: URLSession.shared.dataTask(with: url) This performs a GET request to the specified URL. Instead, you should use the method that accepts a URLRequest: URLSession.shared.dataTask(with: request)
Topic: UI Frameworks SubTopic: SwiftUI
Jul ’25
Reply to UISplitView with "sidebar" and Liquid Glass
I don't know exactly what the Settings app uses internally, but using UICollectionView with a UICollectionViewCompositionalLayout.list layout in .sidebar style is the modern, recommended approach for creating lists with default styling and system backgrounds. Since Apple introduced modern collection views, they've recommended UICollectionView over UITableView for more complex layouts and advanced list styles. Check out Advances in UICollectionView, Lists in UICollectionView, and the official docs for more examples and code.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’25
Reply to iOS 26 how to disable swipe to navigate back
In iOS 26, UINavigationController has a new property called interactiveContentPopGestureRecognizer and is described as this: The interactive content pop gesture recognizes on the entire content area of the navigation controller in cases that are not covered by the interactive pop gesture recognizer and initiates an interactive pop. This property should only be used to set up failure requirements with it. So I believe now the pop gesture properties are defined as so: interactivePopGestureRecognizer is the swipe from the edge gesture interactiveContentPopGestureRecognizer is the swipe anywhere in the main content gesture So by disabling both gesture recognisers, you should be good to implement your custom swipe gestures. navigationController?.interactivePopGestureRecognizer?.isEnabled = false navigationController?.interactiveContentPopGestureRecognizer?.isEnabled = false
Topic: UI Frameworks SubTopic: UIKit
Jul ’25
Reply to .navigationTitle and List misbehaving with a Map()
That's actually what navigation bars looked like back in iOS 12 so maybe your simulator is getting nostalgic. I also noticed in your sample code you are embedding a NavigationStack inside another which isn't recommended, but that isn't the cause of the problem. I would definitely file a feedback because there is no reason for the navigation bar to look like that just because of a map somewhere in the view hierarchy. However, there is some good news… this doesn't seem to be a problem in iOS 26, and most importantly, I have a fix and it's this: .toolbarBackground(.automatic, for: .navigationBar) // renamed to toolbarBackgroundVisibility in Xcode 26 What you were seeing was the background of the navigation bar being permanently visible, regardless of the scroll position. It seems like the map sort of forced this behaviour.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’25
Reply to Shadow being drawn overtop stroke
When I preview your sample code I get this result (color = .red): This is the expected behaviour: a red rounded rectangle with a drop shadow and then stroked with a semi-transparent border. When you say the shadow is being draw over the top of the stroke, this isn't the case. It only appears like that because the stroke is 50% transparent so the shadow is visible through it. I'm not quite understanding the end result you want either. Do you want: A filled rounded rectangle with a drop shadow applied to it, and then a stroke border on top. RoundedRectangle(cornerRadius: 11) .fill(.red.shadow(.drop(color: .gray, radius: 2, x: 2, y: 2))) .stroke(.blue, lineWidth: 5) A filled rounded rectangle, and a stroke border with a drop shadow on top. RoundedRectangle(cornerRadius: 11) .fill(.red) .stroke( .blue.shadow(.drop(color: .gray, radius: 2, x: 2, y: 2)), lineWidth: 5 ) The reason I'm saying this, and also adding a blue border instead of 50% red, is because I think you are getting confused with what is happening because of the opacity you are adding to the stroke, and the fact that the stroke is half blending in with the rectangle and half overlapping the shadow which is seeping through. If I were to provide my solution to what I think you are trying to achieve, it would be this: RoundedRectangle(cornerRadius: 11) .fill(color.shadow(.drop(color: .gray, radius: 2, x: 2, y: 2))) .strokeBorder(color.mix(with: .white, by: 0.5), lineWidth: 5) I have used strokeBorder here because of the way stroking works. stroke(_:lineWidth:) traces the outline of the shape and draws itself half inside and half outside. This results in the shadow being drawn over. Using strokeBorder(_:lineWidth:) instead draws the border fully inside the shape's bounds. It's effectively the same as regularly stroking the shape that is inset by half the line width. Of course the colours and constants can be adjusted, but hopefully this explanation has helped and you have a solution to your problem.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’25
Reply to Using GlassEffectContainer with UIKit
The new Liquid Glass APIs are certainly not SwiftUI-only. They are available in UIKit and AppKit. You should use UIGlassContainerEffect to get the effects of morphing and grouping. [Documentation] When using UIGlassContainerEffect with a UIVisualEffectView you can add individual glass elements to the visual effect view's contentView by nesting UIVisualEffectViews configured with UIGlassEffect. In that configuration, the glass container will render all glass elements in one combined view, behind the visual effect view's contentView.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’25
Reply to Cell Delegate Method Not Being Called
Firstly, I would recommend making the delegate property in your cell weak to avoid retain cycles. weak var delegate: EmotionExplorerCellDelegate? Whether that's the cause of the issue or not, I don't know. Without you providing more code of the surrounding context, it will be difficult to figure out a solution. For example, how is the delegate defined, what does the custom cell and the configure method look like, are there any other things to note about the cell registration and data source — just to examine if there are any other potential causes, because there aren't any immediate issues visible.
Topic: UI Frameworks SubTopic: UIKit
Jul ’25