Problem
Our app use UIPasteControl for people taps to place pasteboard contents in UITextView.
It worked fine at first, but recently received a lot of user feedback and the button suddenly disappeared
This problem usually occurs when an App switches between the front and back
More Information
When the button disappears, we find that the child view of the UIPasteControl control which name _UISlotView has a size of zero.
we use UIKit and AutoLayout,limit button size (100, 36)
let config = UIPasteControl.Configuration()
config.displayMode = .labelOnly
config.cornerStyle = .fixed
config.baseForegroundColor = .white
config.baseBackgroundColor = .black
config.cornerRadius = 18
let btn = UIPasteControl(configuration: config)
pasteBtn = btn
addSubview(pasteBtn)
pasteBtn.snp.makeConstraints { make in
make.trailing.equalTo(-20)
make.bottom.equalTo(-10)
make.size.equalTo(CGSize(width: 100, height: 36))
}
UI view information
<UIPasteControl: 0x107dda810; frame = (0 0; 100 36); layer = <CALayer: 0x3010ff000>>
(lldb) po [0x107dda810 subviews]
<__NSSingleObjectArrayI 0x30152ff00>(
<_UISlotView: 0x107dea630; frame = (0 0; 100 36); userInteractionEnabled = NO; layer = <CALayer: 0x3010eb460>>
)
anyone meet before? is there a workaround?
Explore the various UI frameworks available for building app interfaces. Discuss the use cases for different frameworks, share best practices, and get help with specific framework-related questions.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have a UITableView which contains a UICollectionView in the first row. It used to work fine in iOS17, but now I get a crash when running with Xcode 16 / iOS18 beta:
Expected dequeued view to be returned to the collection view in preparation for display. When the collection view's data source is asked to provide a view for a given index path, ensure that a single view is dequeued and returned to the collection view. Avoid dequeuing views without a request from the collection view. For retrieving an existing view in the collection view, use -[UICollectionView cellForItemAtIndexPath:] or -[UICollectionView supplementaryViewForElementKind:atIndexPath:]
This is my UITableView delegate call:
AddEditDataCell *cell = nil;
if (indexPath.section == 0) {
if (indexPath.row == 0) {
AddEditDataContactsCell *contactNameCell = (AddEditDataContactsCell *)[self cellForContactNamesCollectionAtIndexPath:indexPath tableView:tableView];
return contactNameCell;
- (AddEditDataContactsCell *)cellForContactNamesCollectionAtIndexPath:(NSIndexPath *)indexPath tableView:(UITableView *)tableView {
AddEditDataContactsCell *contactsCell = (AddEditDataContactsCell *)[self.tableView dequeueReusableCellWithIdentifier:@"ContactsCell" forIndexPath:indexPath];
if (self.collectionNameCell == nil) {
self.collectionNameCell = [contactsCell.collectionView dequeueReusableCellWithReuseIdentifier:@"LogContactNameCollectionCellIdentifier" forIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
contactsCell.nameCellDelegate = self;
}
contactsCell.frame = CGRectZero;
[contactsCell setNeedsLayout];
[contactsCell.collectionView reloadData];
contactsCell.collectionViewHeightConstraint.constant = contactsCell.collectionView.collectionViewLayout.collectionViewContentSize.height;
[contactsCell.collectionView.collectionViewLayout invalidateLayout];
return contactsCell;
}
Topic:
UI Frameworks
SubTopic:
UIKit
Hi,
I am trying out the new UITabBar stuff in iOS18, and I don't think it'll be a good fit for my app. Is there a way to revert to the old iPad UITabBar look and placement that we've been using before? I don't want to make such a big change like this just yet, but I would need to make other changes to the app as well and I don't want to use the new UITabBar just yet. Is there a way to achieve this?
Hello,
I face an error everytime I want to interact with a TextField. The XCode debug area is showing :
CLIENT ERROR: TUINSRemoteViewController does not override -viewServiceDidTerminateWithError: and thus cannot react to catastrophic errors beyond logging them
There is no crash, and the text field is working fine.
I am developing for MacOS using a macbook pro Intel from 2019 with Sonoma 14.5 and Xcode 15.4 and I think that I noticed since the release of Sonoma. I was not particularly concerned by it but I noticed that interacting with the textField was leading to severe hang in my app, and micro-hang in the test app and I am wondering is these two issues could be related.
The message is easy to reproduce. Just create a new Project/Application/App using SwiftUI and add a TextField to the ContentView.
When you start app, click or double click on the text field, enter a message and press enter.
import SwiftUI
struct ContentView: View {
@State var value: String = ""
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
TextField(text: $value,
label: {
Text("Test")
}
)
}
.padding()
}
}
Did you notice the same thing ? How I could solve it ?
Note : I already posted the problem on Swift forums but it was close because related to SwiftUI https://forums.swift.org/t/error-when-clicking-on-textfield-client-error-tuinsremoteviewcontroller-does-not-override-viewservicedidterminatewitherror-and-thus-cannot-react-to-catastrophic-errors-beyond-logging-them/72134/1
Thank you
I was hoping for an update of SwiftData which adopted the use of shared and public CloudKit containers, in the same way it does for the private CloudKit container.
So firstly, a big request to any Apple devs reading, for this to be a thing!
Secondly, what would be a sensible way of adding a shared container in CloudKit to an existing app that is already using SwiftData?
Would it be possible to use the new DataStore method to manage CloudKit syncing with a public or shared container?
It looks like Xcode 16 has changed this behaviour so I'm not sure if this is a bug or not.
When a SwiftUI Button wraps a UIImageView and the button style is .plain the button doesn't work without setting isUserInteractionEnabled.
struct ContentView: View {
var body: some View {
Button {
print("Hello World!")
} label: {
UITestImage()
}
.buttonStyle(.plain)
}
}
struct UITestImage: UIViewRepresentable {
func makeUIView(context: Context) -> UIImageView {
let view = UIImageView()
// view.isUserInteractionEnabled = true // Fix
view.image = UIImage(systemName: "plus")
view.contentMode = .scaleAspectFit
view.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
view.setContentCompressionResistancePriority(.defaultLow, for: .vertical)
view.layoutMargins = .zero
return view
}
public func updateUIView(_ uiView: UIImageView, context: Context) {}
}
This feels unexpected, is this a bug?
Based on the session content, it seems that setting the TextView property writingToolsBehavior = .complete should bring up the writing tools bottom panel view. However, it does not appear to be working. Is this a feature that will be added in a future update, or is there something additional I need to do?
Test on:
XCode 16.0 beta (16A5171c),
iOS Simulator 18.0 Beta,
iPhone 11 Pro iOS 18.0 Beta
When you try to present medium height popover from the bottom of iPhone view then popover is clipped in iOS18 but works in old devices
Sample code
Button("Show Popover") {
showPopover.toggle()
}
.popover(
isPresented: $showPopover,
arrowDirection: arrowDirection
) {
conent
}
Result
Is MultiPolygon overlay support going to be integrated with SwiftUI?
I have made a post on here previously without a reply :(
Any suggestions on how to display multi-polygons within MapKit for SwiftUI(https://developer.apple.com/documentation/mapkit/mappolygon)?
At the moment it is not supported and only supported by MapKit for UIKit(https://developer.apple.com/documentation/mapkit/mkmultipolygon).
Is there currently an option to make generated asset symbols public?
If not, would it be possible to set the generated asset symbol so they are public. It's quite common to have an apps design system implemented in a separate framework. Currently the generate assets symbols is useless for this as they can't be access in the framework consumer.
It would be great to add it to this new dropdown in Xcode 16 or along side it. (113704993 in the release notes) So the options would be Internal, Public and Off. This should affect the symbols, the extensions and the framework support.
(There's a post on the swift forums about this as well here: https://forums.swift.org/t/generate-images-and-colors-inside-a-swift-package/65674)
In a SwiftUI app for MacOS, vertical sliders that I'd created using a rotationEffect of 90° disappeared when I upgraded to Sonoma 14.5 (23F79). With rotations less than 90°, the slider is still visible, but its button is enlarged, growing in size as the rotation angle approaches 90°.
Note that the sliders still work, even when rotated by 90° and invisible!
The screenshot and code below demonstrates the problem, which did not exist in MacOS 14.2.1
struct ContentView: View {
@State var speed = CGFloat(1)
var body: some View {
HStack {
let angle: [Double] = [0, 45, 80, 85, 90]
ZStack {
ForEach(0...4, id: \.self) { i in
ZStack () {
Rectangle()
Slider(value: $speed,
in: 0...10
)
}
.frame(width: 100, height: 10)
.rotationEffect(.degrees(angle[i]))
.offset(x: CGFloat(i * 100) - 180)
}
}
}
.padding()
.frame(width: 600, height: 200)
}
}
#Preview {
ContentView()
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
The Human Interface Guidelines for Live Activities provide several examples of compact presentations that have a timer counting down formatted like "3min" or "3m", similar to the timers in the Clock app. Such examples can be found in this Stack Overflow question: https://stackoverflow.com/questions/77551496/is-it-possible-to-make-an-only-minutes-1m-countdown-in-a-live-activity
A Timer initialized with init(timerInterval:pauseTime:countsDown:showsHours:) has provided a live countdown timer in widgets and live activities, but the formatting is limited. And since live activities come with limitations that prevent us from using Timers, there's no real way to implement this kind of thing ourselves.
What is Apple's official guidance for implementing this kind of timer for the compact presentation?
The widget I have create for iOS 17 uses the containerBackground to display an image in the background. This works fine. But when I set the home screen to the iOS 18 tinted option the background disappears. I want the background to stay because it contains an image of that is meaningful to the user.
I use the following code:
@ViewBuilder
var body: some View {
if let memory = entry.memory, let uiImage = memory.image {
Group {
if entry.showCaption {
memoryBody(with: memory)
} else {
Color.white.opacity(0.0000000001)
}
}
.foregroundStyle(.white)
.widgetBackground(
Image(uiImage: uiImage)
.resizable()
.scaledToFill()
)
} else if let memory = entry.memory {
memoryBody(with: memory)
.widgetBackground(Color.gray)
} else {
noMemoryBody()
}
}
extension View {
func widgetBackground(_ backgroundView: some View) -> some View {
if #available(iOSApplicationExtension 17.0, *) {
return containerBackground(for: .widget) {
backgroundView
}
} else {
return background(backgroundView)
}
}
}
I have a project with two local packages
One client package with an interface and some models with dynamic type in the Package.Swift
One feature package with the UI and a dependency to the client package
When I try to preview a view that is not using any models or code from the client package, it loads just fine e.g. a view that is just a container to display things like a card
But when I tried to preview any other view that actually uses models from the client package, it just fails
the first few lines of the preview error display
LinkDylibError: Failed to build <filename>.swift
Linking failed: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: search path '/Applications/Xcode-15.4.0.app/Contents/SharedFrameworks-iphonesimulator' not found
Undefined symbols for architecture arm64:
Also, I'm using Xcode 15.4 and iOS 17 as the min version
With the introduction of the new matchedTransitionSource from iOS 18, we can apply a zoom transition in the navigation view using .navigationTransition(.zoom) This works well for zoom animations.
However, when I try to apply a matched geometry effect to views that are similar in the source and destination views, the zoom transition works, but those views don't transition seamlessly as they do with a matched geometry effect.
Is it possible to still use matched geometry for subviews of the source and destination views along with the new navigationTransition?
Here’s a little demo that reproduces this behaviour:
struct ContentView: View {
let colors: [[Color]] = [
[.red, .blue, .green],
[.yellow, .purple, .brown],
[.cyan, .gray]
]
@Namespace() var namespace
var body: some View {
NavigationStack {
Grid(horizontalSpacing: 50, verticalSpacing: 50) {
ForEach(colors, id: \.hashValue) { rowColors in
GridRow {
ForEach(rowColors, id: \.self) { color in
NavigationLink {
DetailView(color: color, namespace: namespace)
.navigationTransition(
.zoom(
sourceID: color,
in: namespace
)
)
.edgesIgnoringSafeArea(.all)
} label: {
ZStack {
RoundedRectangle(cornerRadius: 5)
.foregroundStyle(color)
.frame(width: 48, height: 48)
Image(systemName: "star.fill")
.foregroundStyle(Material.bar)
.matchedGeometryEffect(id: color,
in: namespace,
properties: .frame, isSource: false)
}
}
.matchedTransitionSource(id: color, in: namespace)
}
}
}
}
}
}
}
struct DetailView: View {
var color: Color
let namespace: Namespace.ID
var body: some View {
ZStack {
color
Image(systemName: "star.fill")
.resizable()
.foregroundStyle(Material.bar)
.matchedGeometryEffect(id: color,
in: namespace,
properties: .frame, isSource: false)
.frame(width: 100, height: 100)
}
.navigationBarHidden(false)
}
}
#Preview {
ContentView()
}
In a SwiftUI macOS application, when removing the title bar by setting window.titleVisibility to .hidden and window.titlebarAppearsTransparent to true, the title bar space is still accounted for in the window height. This results in a delta (red area) in the height of the window that cannot be ignored by usual SwiftUI view modifiers like .edgesIgnoringSafeArea(.top). My actual view is the blue area.
I want to have the view starting in the top safeArea and the window to be the exact size of my view. I am struggling to achieve this. I have also tried with window.styleMask.insert(.fullSizeContentView) to no effect.
Can I get some help? 🙂
Here is my source code to reproduce this behavior:
windowApp.swift
@main
struct windowApp: App {
@NSApplicationDelegateAdaptor private var appDelegate: AppDelegate
var body: some Scene {
WindowGroup {
ContentView()
.edgesIgnoringSafeArea(.top)
.background(.red)
.border(.red)
}
}
}
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
if let window = NSApplication.shared.windows.first {
window.titleVisibility = .hidden
window.titlebarAppearsTransparent = true
window.styleMask.insert(.fullSizeContentView)
}
}
}
ContentView.swift
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
}
.frame(minWidth: 400, minHeight: 200)
.background(.blue)
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Hello everyone,
I'm working on a SwiftUI app that requires location services, and I've implemented a LocationManager class to handle location updates and permissions. However, I'm facing an issue where the location permission popup does not appear when the app is launched.
Here is my current implementation:
LocationManager.swift:
import CoreLocation
import SwiftUI
class LocationManager: NSObject, ObservableObject, CLLocationManagerDelegate {
private let locationManager = CLLocationManager()
@Published var userLocation: CLLocation?
@Published var isAuthorized = false
@Published var authorizationStatus: CLAuthorizationStatus = .notDetermined
override init() {
super.init()
locationManager.delegate = self
checkAuthorizationStatus()
}
func startLocationUpdates() {
locationManager.startUpdatingLocation()
}
func stopLocationUpdates() {
locationManager.stopUpdatingLocation()
}
func requestLocationAuthorization() {
print("Requesting location authorization")
DispatchQueue.main.async {
self.locationManager.requestWhenInUseAuthorization()
}
}
private func checkAuthorizationStatus() {
print("Checking authorization status")
authorizationStatus = locationManager.authorizationStatus
print("Initial authorization status: \(authorizationStatus.rawValue)")
handleAuthorizationStatus(authorizationStatus)
}
func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
print("Authorization status changed")
authorizationStatus = manager.authorizationStatus
print("New authorization status: \(authorizationStatus.rawValue)")
handleAuthorizationStatus(authorizationStatus)
}
private func handleAuthorizationStatus(_ status: CLAuthorizationStatus) {
switch status {
case .authorizedAlways, .authorizedWhenInUse:
DispatchQueue.main.async {
self.isAuthorized = true
self.startLocationUpdates()
}
case .notDetermined:
requestLocationAuthorization()
case .denied, .restricted:
DispatchQueue.main.async {
self.isAuthorized = false
self.stopLocationUpdates()
print("Location access denied or restricted")
}
@unknown default:
DispatchQueue.main.async {
self.isAuthorized = false
self.stopLocationUpdates()
}
}
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
DispatchQueue.main.async {
self.userLocation = locations.last
}
}
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
print("Location manager error: \(error.localizedDescription)")
}
}
MapzinApp.swift:
@main
struct MapzinApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
@StateObject private var locationManager = LocationManager()
var body: some Scene {
WindowGroup {
Group {
if locationManager.authorizationStatus == .notDetermined {
Text("Determining location authorization status...")
} else if locationManager.isAuthorized {
CoordinatorView()
.environmentObject(locationManager)
} else {
Text("Location access is required to use this app. Please enable it in Settings.")
}
}
}
}
}
Log input:
Checking authorization status
Initial authorization status: 0
Requesting location authorization
Authorization status changed
New authorization status: 0
Requesting location authorization
Despite calling requestWhenInUseAuthorization() when the authorization status is .notDetermined, the permission popup never appears. Here are the specific steps I have taken:
Checked the Info.plist to ensure the necessary keys for location usage are present:
NSLocationWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription
Verified that the app's target settings include location services capabilities.
Tested on a real device to ensure it's not a simulator issue.
I'm not sure what I might be missing. Any advice or suggestions to resolve this issue would be greatly appreciated. Thank you!
We have a UITabBarController in our iPhone App which has 5 tabs with UITableViewControllers (constructed from the storyboard). Before iOS18 beta 1 (and 2) this was working fine without any problems (objective-C).
Since iOS18 beta 1 (and beta 2 still has this problem) a strange render glitch occurs when activating a tab from the tab bar at the bottom.
As soon as a tab is activated (by tapping on the icon at the bottom) the tab with the UITableViewController becomes visible and draws its content starting at the very top of the screen (pos 0,0) right through/over the Navigation bar which at that point is showing a title and a rightBarButtonItem.
The tab with the UITableViewController seems not aware there is a navigation bar visible.
Then after ~0.3 seconds the tab with the UITableViewContoller is automatically rendered again or moved down and now its content starts below the UINavigationBar as expected, this is 100% reproducible and occurs on every activation of a tab in the UITabBarController.
Is anyone else also getting this behavior in their App since iOS18?
I'm aware that UITabBarController is being renewed but I can't find any information on why this behavior might occur. I was hoping beta 2 would solve the problem but it doesn't.
Constructing the UITabBarController in the code with the new UITab objects (instead of constructing them from the storyboard) also shows this problem.
I’m seeing a crash in production for a small percentage of users, and have narrowed it down based on logging to happening as or very shortly after an alert is presented using SwiftUI.
This seems to be isolated to iOS 17.5.1, but since it’s a low-volume crash I can’t be sure there aren’t other affected versions. What can I understand from the crash report?
Here’s a simplified version of the code which presents the alert, which seems so simple I can’t understand why it would crash. And following that is the crash trace.
// View (simplified)
@MainActor public struct MyView: View {
@ObservedObject var model: MyViewModel
public init(model: MyViewModel) {
self.model = model
}
public var body: some View {
myViewContent
.overlay(clearAlert)
}
var clearAlert: some View {
EmptyView().alert(
"Are You Sure?",
isPresented: $model.isClearAlertVisible,
actions: {
Button("Keep", role: .cancel) { model.clearAlertKeepButtonWasPressed() }
Button("Delete", role: .destructive) { model.clearAlertDeleteButtonWasPressed() }
},
message: {
Text("This cannot be undone.")
}
)
}
}
// Model (simplified)
@MainActor public final class MyViewModel: ObservableObject {
@Published var isClearAlertVisible = false
func clearButtonWasPressed() {
isClearAlertVisible = true
}
func clearAlertKeepButtonWasPressed() {
// No-op.
}
func clearAlertDeleteButtonWasPressed() {
// Calls other code.
}
}
Incident Identifier: 36D05FF3-C64E-4327-8589-D8951C8BAFC4
Distributor ID: com.apple.AppStore
Hardware Model: iPhone13,2
Process: My App [379]
Path: /private/var/containers/Bundle/Application/B589E780-96B2-4A5F-8FCD-8B34F2024595/My App.app/My App
Identifier: com.me.MyApp
Version: 1.0 (1)
AppStoreTools: 15F31e
AppVariant: 1:iPhone13,2:15
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.me.MyApp [583]
Date/Time: 2024-06-21 20:09:20.9767 -0500
Launch Time: 2024-06-20 18:41:01.7542 -0500
OS Version: iPhone OS 17.5.1 (21F90)
Release Type: User
Baseband Version: 4.50.06
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001a69998c0
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [379]
Triggered by Thread: 0
Kernel Triage:
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter
Thread 0 name:
Thread 0 Crashed:
0 libswiftCore.dylib 0x00000001a69998c0 _assertionFailure(_:_:file:line:flags:) + 264 (AssertCommon.swift:144)
1 AttributeGraph 0x00000001d0cd61a4 Attribute.init<A>(body:value:flags:update:) + 352 (Attribute.swift:473)
2 SwiftUI 0x00000001ac034054 closure #1 in Attribute.init<A>(_:) + 128 (<compiler-generated>:0)
3 SwiftUI 0x00000001ac033cac partial apply for closure #1 in Attribute.init<A>(_:) + 32 (<compiler-generated>:0)
4 libswiftCore.dylib 0x00000001a6ad0450 withUnsafePointer<A, B>(to:_:) + 28 (LifetimeManager.swift:128)
5 SwiftUI 0x00000001ad624d14 closure #2 in UIKitDialogBridge.startTrackingUpdates(actions:) + 268 (UIKitDialogBridge.swift:370)
6 SwiftUI 0x00000001ad624ae0 UIKitDialogBridge.startTrackingUpdates(actions:) + 248 (UIKitDialogBridge.swift:369)
7 SwiftUI 0x00000001ad6250cc closure #4 in UIKitDialogBridge.showNewAlert(_:id:) + 72 (UIKitDialogBridge.swift:471)
8 SwiftUI 0x00000001abfdd050 thunk for @escaping @callee_guaranteed () -> () + 36 (:-1)
9 UIKitCore 0x00000001aa5722e4 -[UIPresentationController transitionDidFinish:] + 1096 (UIPresentationController.m:651)
10 UIKitCore 0x00000001aa571d88 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.114 + 320 (UIPresentationController.m:1390)
11 UIKitCore 0x00000001aa5cb9ac -[_UIViewControllerTransitionContext completeTransition:] + 116 (UIViewControllerTransitioning.m:304)
12 UIKitCore 0x00000001aa34a91c __UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK__ + 36 (UIView.m:16396)
13 UIKitCore 0x00000001aa34a800 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 624 (UIView.m:16429)
14 UIKitCore 0x00000001aa349518 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 436 (UIView.m:0)
15 UIKitCore 0x00000001aa356b14 -[UIViewAnimationState animationDidStop:finished:] + 192 (UIView.m:2400)
16 UIKitCore 0x00000001aa356b84 -[UIViewAnimationState animationDidStop:finished:] + 304 (UIView.m:2422)
17 QuartzCore 0x00000001a96f8c50 run_animation_callbacks(void*) + 132 (CALayer.mm:7714)
18 libdispatch.dylib 0x00000001aff61dd4 _dispatch_client_callout + 20 (object.m:576)
19 libdispatch.dylib 0x00000001aff705a4 _dispatch_main_queue_drain + 988 (queue.c:7898)
20 libdispatch.dylib 0x00000001aff701b8 _dispatch_main_queue_callback_4CF + 44 (queue.c:8058)
21 CoreFoundation 0x00000001a808f710 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780)
22 CoreFoundation 0x00000001a808c914 __CFRunLoopRun + 1996 (CFRunLoop.c:3149)
23 CoreFoundation 0x00000001a808bcd8 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420)
24 GraphicsServices 0x00000001ecf3c1a8 GSEventRunModal + 164 (GSEvent.c:2196)
25 UIKitCore 0x00000001aa6c490c -[UIApplication _run] + 888 (UIApplication.m:3713)
26 UIKitCore 0x00000001aa7789d0 UIApplicationMain + 340 (UIApplication.m:5303)
27 SwiftUI 0x00000001ac27c148 closure #1 in KitRendererCommon(_:) + 168 (UIKitApp.swift:51)
28 SwiftUI 0x00000001ac228714 runApp<A>(_:) + 152 (UIKitApp.swift:14)
29 SwiftUI 0x00000001ac2344d0 static App.main() + 132 (App.swift:114)
30 My App 0x00000001001e7bfc static MyApp.$main() + 52 (MyApp.swift:0)
31 My App 0x00000001001e7bfc main + 64
32 dyld 0x00000001cb73de4c start + 2240 (dyldMain.cpp:1298)
Hi,
When I use 'listSectionSeparator' on hide the section separator on a List 'section', it works as expected on iOS, but doesn't have any effect on macOS. Is that a known issue? Are there any workarounds for this?
Here's a basic reproducible example:
import SwiftUI
struct TestItem: Identifiable, Hashable {
let id = UUID()
let itemValue: Int
var itemString: String {
get {
return "test \(itemValue)"
}
}
}
struct TestListSelection: View {
let testArray = [TestItem(itemValue: 1), TestItem(itemValue: 2), TestItem(itemValue: 3), TestItem(itemValue: 4)]
@State private var selectedItem: TestItem? = nil
var body: some View {
List (selection: $selectedItem) {
Section("Header") {
ForEach (testArray, id: \.self) { item in
Button {
print("main row tapped for \(item.itemValue)")
} label: {
HStack {
Text(item.itemString)
Spacer()
Button("Tap me") {
print("button tapped")
}
.buttonStyle(.borderless)
}
}
.buttonStyle(.plain)
}
}
.listSectionSeparator(.hidden) // has no effect on macOS
Section("2nd Header") {
ForEach (testArray, id: \.self) { item in
Text(item.itemString)
}
}
.listSectionSeparator(.hidden) // has no effect on macOS
}
.listStyle(.plain)
}
}
#Preview {
TestListSelection()
}