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.

All subtopics
Posts under UI Frameworks topic

Post

Replies

Boosts

Views

Activity

No macro named 'Preview' - error
So I am trying to move an old project from ios16 to ios17... wanted to play around with the new previews, and animations and first error I get is the above. When I create a new project I can use the macro just fine. What is more: when I add a new swiftUI file I get the same error with the #Preview macro. I went through the project and target settings, making sure everything is set to ios17 and Swift5, but can't find any other settings. Cleared the build cache and rebuilt from scratch. Hoping someone else ran onto the same problem and found a solution? Without using #Preview
3
0
1.5k
Nov ’24
Canvas view crashing with Core Graphics-based drawing
One of my SwiftUI applications using a Canvas view started to crash with Xcode 16. It was working flawlessly with Xcode 15. I was able to come up with a minimal SwiftUI app that shows the issue: @main struct CanvasTest: App { var body: some Scene { WindowGroup { VStack { Canvas { context, size in context.withCGContext { cgContext in let z = Int(size.width / 3.0) for i in 0..<18000 { // crashes from 17413 on cgContext.beginPath() cgContext.move(to: CGPoint(x: (i % z) * 3, y: (i / z) * 2)) cgContext.addLine(to: CGPoint(x: (i % z) * 3 + 2, y: (i / z) * 2)) cgContext.strokePath() } } } } } } } The canvas displays 18000 lines and the context.withCGContext invocation also completes successfully. Yet, the application crashes immediately after like this (details below): Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x00000001800eabb4 Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [2162] I was wondering if anyone else noticed that change and found a way to fix it? Alternatively, I am looking for workarounds. I have to be able to display large drawings created via core context-based graphics. Is this worth reporting to Apple? Thanks already now for any help and advice. Hardware Model: Mac15,9 Process: CanvasTest [2162] Path: /Users/USER/Library/Developer/CoreSimulator/Devices/0C372C7C-3D00-48AA-8124-799CB9A35C1E/data/Containers/Bundle/Application/EBAEC7A2-C93D-48B7-9754-4F3F54A33084/CanvasTest.app/CanvasTest Identifier: com.objecthub.CanvasTest Version: 1.0 (1) Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd_sim [98324] Coalition: com.apple.CoreSimulator.SimDevice.0C372C7C-3D00-48AA-8124-799CB9A35C1E [58431] Responsible Process: SimulatorTrampoline [3499] Date/Time: 2024-12-01 14:33:07.7617 +0100 Launch Time: 2024-12-01 14:33:07.4151 +0100 OS Version: macOS 15.1.1 (24B91) Release Type: User Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x00000001800eabb4 Termination Reason: SIGNAL 5 Trace/BPT trap: 5 Terminating Process: exc handler [2162] Triggered by Thread: 0 Application Specific Information: Abort Cause 268435470 Thread 0 Crashed:: Dispatch queue: com.Metal.CommandQueueDispatch 0 libxpc.dylib 0x1800eabb4 _xpc_connection_release_message.cold.1 + 60 1 libxpc.dylib 0x1800c9910 _xpc_connection_release_message + 240 2 libxpc.dylib 0x1800c80b4 _xpc_connection_enqueue + 264 3 libxpc.dylib 0x1800c8b9c xpc_connection_send_message + 128 4 MTLSimDriver 0x2275c6e7c -[MTLSimCommandQueue submitCommandBuffers:count:] + 368 5 Metal 0x19eabdfd4 -[_MTLCommandQueue _submitAvailableCommandBuffers] + 480 6 Metal 0x19eabe4ac __40-[_MTLCommandQueue submitCommandBuffer:]_block_invoke + 24 7 libdispatch.dylib 0x180178de0 _dispatch_client_callout + 16 8 libdispatch.dylib 0x180188ac8 _dispatch_lane_barrier_sync_invoke_and_complete + 92 9 Metal 0x19eabe46c -[_MTLCommandQueue submitCommandBuffer:] + 112 10 MTLSimDriver 0x2275c5fc8 -[MTLSimCommandBuffer commitAndWaitUntilSubmitted] + 40 11 RenderBox 0x1c6e9015c RB::RenderFrame::~RenderFrame() + 240 12 RenderBox 0x1c6e6e9dc __38-[RBLayer displayWithBounds:callback:]_block_invoke.27 + 500 13 libdispatch.dylib 0x180178de0 _dispatch_client_callout + 16 14 libdispatch.dylib 0x180188ac8 _dispatch_lane_barrier_sync_invoke_and_complete + 92 15 RenderBox 0x1c6e6de38 -[RBLayer displayWithBounds:callback:] + 2480 16 RenderBox 0x1c6e6d46c -[RBLayer display] + 172 17 QuartzCore 0x18b0c7e74 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 392 18 QuartzCore 0x18affca50 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 464 19 QuartzCore 0x18b02b260 CA::Transaction::commit() + 652 20 UIKitCore 0x185af0f70 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 32 21 CoreFoundation 0x18041b58c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20 22 CoreFoundation 0x18041acc4 __CFRunLoopDoBlocks + 352 23 CoreFoundation 0x1804153cc __CFRunLoopRun + 812 24 CoreFoundation 0x180414c24 CFRunLoopRunSpecific + 552 25 GraphicsServices 0x19020ab10 GSEventRunModal + 160 26 UIKitCore 0x185ad82fc -[UIApplication _run] + 796 27 UIKitCore 0x185adc4f4 UIApplicationMain + 124 28 SwiftUI 0x1d290b41c closure #1 in KitRendererCommon(_:) + 164 29 SwiftUI 0x1d290b144 runApp<A>(_:) + 84 30 SwiftUI 0x1d266bef4 static App.main() + 148 31 CanvasTest.debug.dylib 0x105061c64 static CanvasTest.$main() + 40 32 CanvasTest.debug.dylib 0x105061d14 __debug_main_executable_dylib_entry_point + 12 (CanvasTest.swift:11) 33 dyld_sim 0x10519d410 start_sim + 20 34 dyld 0x10539a274 start + 2840 Thread 4:: com.apple.uikit.eventfetch-thread 0 libsystem_kernel.dylib 0x1050f5290 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x1051066c4 mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x1050fd3f4 mach_msg_overwrite + 536 3 libsystem_kernel.dylib 0x1050f55cc mach_msg + 20 4 CoreFoundation 0x18041b000 __CFRunLoopServiceMachPort + 156 5 CoreFoundation 0x180415528 __CFRunLoopRun + 1160 6 CoreFoundation 0x180414c24 CFRunLoopRunSpecific + 552 7 Foundation 0x180f319c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208 8 Foundation 0x180f31be8 -[NSRunLoop(NSRunLoop) runUntilDate:] + 60 9 UIKitCore 0x185b858c0 -[UIEventFetcher threadMain] + 404 10 Foundation 0x180f58810 __NSThread__start__ + 720 11 libsystem_pthread.dylib 0x10507f6f8 _pthread_start + 104 12 libsystem_pthread.dylib 0x10507a940 thread_start + 8
Topic: UI Frameworks SubTopic: SwiftUI
0
0
315
Dec ’24
NSOutlineView with Diffable Data Source
Hi, On macOS, there seems to be a NSTableViewDiffableDataSource and an NSCollectionViewDiffableDataSource, but there seems to be nothing for NSOutlineView. Is it possible to somehow use NSTableViewDiffableDataSource with NSOutlineView that I'm missing? If not, is it possible to use NSTableView with NSTableViewDiffableDataSource to show a 'table' with section headers?
Topic: UI Frameworks SubTopic: AppKit Tags:
5
0
649
Dec ’24
UIDocumentPickerViewController: open to specific folder
Hi, With UIDocumentPickerViewController, there is a directoryURL property that says we can use to 'specify the starting directory for the document picker'. But it's not clear how to get the directory of a folder in iCloud Drive / Files app. How can I get the 'root' directory for a user's iCloud Drive or Dropbox folder, or the Downloads folder on their device, that I could pass to this directoryURL to make it easier for the user to pick their files? Thanks.
0
0
478
Dec ’24
SwiftUI charts, how do I align these X axis labels correctly?
Hi there, so I have this chart that's taking in a Date for it's x values and a time interval for their y values. For some reason, the labels aren't centering on each bar, the only fix I see is to add an offset to each label but that seems hacky. My code: Chart { ForEach(weekBreakdownArr, id: \.startDate) { bd in BarMark( x: .value("Date", bd.startDate), y: .value("Duration", bd.durationWorkDone), width: .fixed(15) ) .foregroundStyle(Color.redYarn) .cornerRadius(2) } //... } // shownXValues are just the start dates in an array .chartXAxis { AxisMarks(position: .automatic, values: shownXValues) { val in AxisValueLabel { Text("Th") .useAppFont(size: 12, relativeTo: .body, weight: .regular) } } }
1
0
635
Dec ’24
Xamarin application crashing in iOS 18.1
My xamarin application running fine in iOS 17 and below versions. but in iOS 18 and above when I open application and then when I use it for few min it gets crashed automatically and does not even show any crash report in mobile. When I checked the console logs in XCode then I found out that One error is logging more than 700 times in a sec. that is why the application is crashing. I will attach the error below. Modifying properties of a view's layer off the main thread is not allowed: view <Xamarin_Forms_Platform_iOS_FrameRenderer: 0x7f9605e5e7a0> with nearest ancestor view controller <Xamarin_Forms_Platform_iOS_GroupableItemsViewController_1: 0x7f9605f96dc0>; backtrace: ( 0 UIKitCore 0x0000000152d29c00 -[UIView(UIKitManual) _raiseExceptionForBackgroundThreadLayerPropertyModification] + 453 1 UIKitCore 0x0000000152d2a188 -[UIView(UIKitManual) actionForLayer:forKey:] + 609 2 QuartzCore 0x0000000126f731da -[CALayer actionForKey:] + 151 3 QuartzCore 0x0000000126f7a425 ZN2CA5Layer12begin_changeEPNS_11TransactionEjP11objc_objectRS4 + 199 4 QuartzCore 0x0000000126f7ead8 _ZN2CA5Layer6setterEj12_CAValueTypePKv + 974 5 QuartzCore 0x0000000126f727e9 -[CALayer setOpacity:] + 49 6 Leadrat.Mobile.Forms.iOS 0x0000000101122fc9 xamarin_dyn_objc_msgSend + 217 7 ??? 0x00000001a315f176 0x0 + 7031091574 8 ??? 0x00000001b312d0bb 0x0 + 7299322043 9 ??? 0x000000019d76712b 0x0 + 6936752427 10 Mono 0x000000010b9b70b5 mono_jit_runtime_invoke + 1621 11 Mono 0x000000010bbac1e8 mono_runtime_invoke_checked + 136 12 Mono 0x000000010bbb1c9d mono_runtime_delegate_try_invoke + 157 13 Mono 0x000000010bbd0957 start_wrapper_internal + 647 14 Mono 0x000000010bbd06ae start_wrapper + 62 15 libsystem_pthread.dylib 0x000000012a21018b _pthread_start + 99 16 libsystem_pthread.dylib 0x000000012a20bae3 thread_start + 15
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
513
Dec ’24
SwiftUI List .scrollPosition not working
Hi, I am trying to read in which section in a list the user is currently located and want to scroll him to a specific section. Therefore I would like to use the new .scrollPosition modifier. Best would be the ability to implement the same snapping effect from ScrollView. So I used this snippet: struct Item: Identifiable{ var id: Int static func getMany() -> [Item] { var items = [Item]() for i in 0..<100 { items.append(Item(id: i)) } return items } } struct ContentView: View { @State var items = Item.getMany() @State var scrolledID: Item.ID? var body: some View { NavigationStack { List { ForEach(items) { item in ItemView(item: item) } } .scrollTargetLayout() .scrollPosition(id: $scrolledID) .navigationTitle("Hello, \(scrolledID ?? 0)") } } } struct ItemView: View { var item: Item var body: some View { Text("Hello world, \(item)") } } Doesn't work. So I tried to place the modifiers in different places in the code to attack several different parts of the list as the "scrollTargetLayout" - but this doesn't change anything here. Isn't the List View just the Form inside a ScrollView?! This doesn't work either. If I place the Form OR List inside a ScrollView, the contents of the list aren't displayed anymore. This seems logical, because the list is a LazyVStack rendering without a height, as it doesn't know its final height. Can we fix this somehow?
2
0
593
Dec ’24
SwiftUI Toolbar Item buttons not registering taps
Before I updated to iOS 18 everything worked fine. I pushed out an update to my application on the App Store and I had no issues. After updating to the latest OS many of my touch events are no longer working and I have no idea why. Sometimes when the app runs the touch events work fine and other times I can't click on half of my views & buttons. I am completely lost as to what might be happening. I am having issues all over the application but let's focus on the navigation stack and the toolbar item buttons. I will post some code snippets, I have been unable to replicate this in a small playground project. This is my setup, I have two buttons but lets focus on the home & notifications view. The custom Router import SwiftUI import Foundation @Observable class HomeRouter { var navPath = NavigationPath() @MainActor func navigate(to destination: HOME_ROUTES) { navPath.append(destination) } @MainActor func navigateBack() { navPath.removeLast() } @MainActor func navigateToRoot() { navPath.removeLast(navPath.count) } } Home View import os import SwiftUI import CoreLocation import NotificationCenter struct Home: View { @State public var router: HomeRouter @State private var showDetail = false @State private var showMoreFields = false @EnvironmentObject private var session: SessionStore private var log = Logger(subsystem: "com.olympsis.client", category: "home_view") init(router: HomeRouter = HomeRouter()) { self._router = State(initialValue: router) } var body: some View { NavigationStack(path: $router.navPath) { ScrollView(.vertical) { //MARK: - Welcome message WelcomeCard() .padding(.top, 25) .environmentObject(session) // MARK: - Announcements AnnouncementsView() .environmentObject(session) // MARK: - Next Events NextEvents() .environmentObject(session) // MARK: - Hot Events HotEvents() .environmentObject(session) // MARK: - Nearby Venues NearbyVenues() .environmentObject(session) Spacer(minLength: 100) } .toolbar { ToolbarItem(placement: .topBarLeading) { Text("Olympsis") .italic() .font(.largeTitle) .fontWeight(.black) } ToolbarItemGroup(placement: .topBarTrailing) { Button(action: { router.navigate(to: .messages) }) { ZStack(alignment: .topTrailing) { Image(systemName: "bubble.left.and.bubble.right") .foregroundStyle(Color.foreground) if session.invitations.count > 0 { NotificationCountView(value: $session.invitations.count) } } } Button(action: { router.navigate(to: .notifications) }) { ZStack(alignment: .topTrailing) { Image(systemName: "bell") .foregroundStyle(Color.foreground) if session.invitations.count > 0 { NotificationCountView(value: $session.invitations.count) } } } } } .background(Color("background-color/primary")) .navigationDestination(for: HOME_ROUTES.self, destination: { route in switch route { case .notifications: NotificationsView() .id(HOME_ROUTES.notifications) .environment(router) .environmentObject(session) .navigationBarBackButtonHidden() case .messages: HomeMessagesView() .id(HOME_ROUTES.messages) .environment(router) .environmentObject(session) .navigationBarBackButtonHidden() case .full_post_view(let id): AsyncPostView(postId: id) .id(HOME_ROUTES.full_post_view(id)) .environmentObject(session) .navigationBarBackButtonHidden() } }) } } } #Preview { Home() .environmentObject(SessionStore()) } The Notifications View import SwiftUI struct NotificationsView: View { @State private var notifications: [NotificationModel] = [] @Environment(HomeRouter.self) private var router @EnvironmentObject private var session: SessionStore var body: some View { ScrollView { if notifications.count > 0 { ForEach(notifications, id: \.id){ note in NotificationModelView(notification: note) } } else { VStack { Text("No new notifications") HStack { Spacer() } }.padding(.top, 50) } } .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .topBarLeading) { Button(action:{ router.navigateBack() }) { Image(systemName: "chevron.left") .foregroundStyle(Color.foreground) } } ToolbarItem(placement: .principal) { Text("Notifications") } } .task { notifications = session.invitations.map({ i in NotificationModel(id: UUID().uuidString, type: "invitation", invite: i, body: "") }) } } } #Preview { NavigationStack { NotificationsView() .environment(HomeRouter()) .environmentObject(SessionStore()) } }
Topic: UI Frameworks SubTopic: SwiftUI
1
0
469
Dec ’24
NSToolbarItemGroup dynamically update subitems in toolbar
Developing on Monterey 12.7.5 I'm having trouble with updating subitems on NSToolbarItemGroup when selecting the item directly from the NSToolbar items array. I select the group item off the items array on the toolbar, and then call setSubitems: on the item, with a new array of NSToolbarItems. The group item disappears from the toolbar. It seems to leave a blank invisible item in the toolbar taking up space. I can't manually reinsert the item into the toolbar until I drag out the blank item, then drag back in the real item. Once dragged back in from the palette it displays correctly. The workaround I've come up with is to remove the item with NSToolbar removeItemAtIndex: and reinsert it with NSToollbar insertItemWithItemIdentifier:atIndex:. This works to update the subitems. Every other toolbar item property that I've tried has been able to update the item directly in the toolbar. It's only the group item's subitems that don't want to update correctly. Is there a correct way to do this that I'm missing? Calling [toolbar validateVisibleItems] didn't seem to help.
Topic: UI Frameworks SubTopic: AppKit Tags:
0
0
389
Nov ’24
In iOS 18, UINavigationController continuously executes pushViewController, and the lifecycle method is not executed when the viewController enters the stack
let home = homeViewController() let rootNav = UINavigationController(rootViewController: home) window?.rootViewController = rootNav window?.makeKeyAndVisible() let second = SecondViewController() home.navigationController?.pushViewController(second, animated: false) let third = ThirdViewController() home.navigationController?.pushViewController(third, animated: false) After the above is executed, the viewdidload and other related lifecycle methods in the SecondViewController are not executed。 Except for iOS18, other versions don't have this problem, so it's not a bug in iOS18, or iOS18 has optimized UINavigationController
Topic: UI Frameworks SubTopic: UIKit
2
0
569
Jan ’25
Best Way to Support Different Devices in SwiftUI?
Hi, I have pretty much finished my app's layout but realized I needed to scale it for different devices. I have read online that hardcoding values (esp in frames) is a big no-no, and GeometryReader should be heavily utilized. Also was recommended ViewThatFits. The problem is, I want the app to look the exact same across all devices. What is the best way to get started? Also, when testing, do I only have to test on an iPad and iPhone or are the dimensions significantly different amongst each class of devices?
1
0
638
Dec ’24
ScrollViewReader
I'd like to use ScrollViewReader, but on a list of static text that has formatting such as font colors and bold text. Essentially, my list has a bunch of: Text("some text ") + Text(" and more text").fontWeight(.bold).foregroundStyle(boldColor) Switching to AttributedString would be a pain, and I'm not so sure ScrollViewReader is working correctly. It seems like there are a lot of bugs reports about it. Plus, do we really need a separate string format, just to have proper formatting? Really? Is there another version I'm missing? One that can scroll to anchor points that I could set?
0
0
296
Nov ’24
MFMessageComposeViewController attachments button disabled
Hello everyone! I was implementing a MFMessageComposeViewController to send messages. Currently I'm observing behaviour that attachments button is always disabled. But thing is that I'm showing MFMessageComposeViewController only when canSendText() && canSendAttachments() are true. if MFMessageComposeViewController.canSendText() && MFMessageComposeViewController.canSendAttachments() { let composeVC = MFMessageComposeViewController() composeVC.messageComposeDelegate = self composeVC.body = "Test message" self.present(composeVC, animated: true, completion: nil) } I've checked that mms are enabled.
3
0
396
Dec ’24
SwiftUI crashed on iOS16 when use List with .animation
When I use the following code List { ForEach(data.items, id: \.knowledgeInfo.mediaID) { item in SelectableKnowledgeListItem(knowledgeData: item, baseID: data.knowledgeBaseID, isSelectionMode: $isSelectionMode, selectedItems: $selectedItems) .KnowledgeListItemStyle() } // 添加底部加载更多 if !data.isEnd && !isRefreshing { ProgressView() .frame(maxWidth: .infinity, alignment: .center) .onAppear { self.isRefreshing = true manager.getKnowledgeList(knowledgeBaseID: data.knowledgeBaseID, completion: { self.isRefreshing = false }) } } } .animation(.interactiveSpring) .scrollContentBackground(.hidden) .environment(\.defaultMinListHeaderHeight, 7) The number of Views rendered in the List remains unchanged after he adds an item to data.items (data is an ObservedObject, items is Published) at runtime.When I removed .animation(.interactiveSpring), it would be processed normally.And if I perform a delete operation after adding, it will cause a crash. *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the collection view after the update (11) must be equal to the number of sections contained in the collection view before the update (10), plus or minus the number of sections inserted or deleted (1 inserted, 1 deleted).
Topic: UI Frameworks SubTopic: SwiftUI
0
0
182
Dec ’24
onMove bug
I'm not sure where to report this, so here it is. If you have a list of items and you make them clickable and movable, moving one or more items in the list and then clicking will cause them to move. This is yet another reason that SwiftData needs to track onMove. Minimal reproducible code: // // ContentView.swift // exampleBug // // Create a new project. // Replace the default Item class with the one below, and replace ContentView with its class below // Run the app and add a few items a few seconds apart so you can tell them apart. // Drag an item to a new position in the list. // Click one of the checkboxes and watch the list positions change for no reason! // import SwiftUI import SwiftData @Model final class Item { var timestamp: Date var checkbox: Bool = false init(timestamp: Date) { self.timestamp = timestamp } } struct ContentView: View { @Environment(\.modelContext) private var modelContext @State private var editMode = EditMode.inactive @Query private var items: [Item] var body: some View { NavigationStack { List { ForEach(items) { item in HStack { Text(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard)) Button("", systemImage: item.checkbox ? "checkmark.circle.fill" : "circle") { item.checkbox.toggle() try? modelContext.save() } } } .onMove(perform: { indices, newOffset in var theItems = items theItems.move(fromOffsets: indices, toOffset: newOffset) }) } .environment(\.editMode, $editMode) .moveDisabled(false) .toolbar { ToolbarItem(placement: .navigationBarTrailing) { EditButton() } ToolbarItem { Button(action: addItem) { Label("Add Item", systemImage: "plus") } } } } } func addItem() { withAnimation { let newItem = Item(timestamp: Date()) modelContext.insert(newItem) } } func deleteItems(offsets: IndexSet) { withAnimation { for index in offsets { modelContext.delete(items[index]) } } } } #Preview { ContentView() .modelContainer(for: Item.self, inMemory: true) } code-block
Topic: UI Frameworks SubTopic: SwiftUI
2
0
435
Nov ’24
tableView works properly in older iphones, but fails in newer ones
I have an ios application where I have a tab and a container view. Container view changes according to the tab I have selected. Issue I am facing is that that my table view shows all cells properly in older iphones(iphone with home button), while in newer iphones(iphone with home bar), table view doesn't scroll till the end and hides bottom cell. I have tried adding all necessary constraints and content insets, but still it is giving me same issue I have different class for tabBar, tabBar+containerView, and all related view controllers based on tab selected. Please help me find the solution to this. Thanks
0
0
341
Dec ’24
Getting error while building the project
Error:App is ambiguous for type lookup in this context code in UnqueHolidayApp import SwiftUI import RealmSwift @main struct UniqueHolidayApp: App { init() { migrateRealmIfNeeded() } var body: some Scene { WindowGroup { ContentView() } } private func migrateRealmIfNeeded() { let config = Realm.Configuration( schemaVersion: 1, migrationBlock: { migration, oldSchemaVersion in if oldSchemaVersion < 1 { // Realm will handle changes automatically for simple additions/removals } } ) Realm.Configuration.defaultConfiguration = config } }
0
0
272
Nov ’24
swift ui in tableview cell gesture sometimes not call back
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let message = self.parent.viewModel.messages[indexPath.row] // var cell: RCBaseMessageCell? = tableView.dequeueReusableCell(withIdentifier: String( message.type.rawValue)) as? RCBaseMessageCell var cell = tableView.dequeueReusableCell(withIdentifier: "cell") if #available(iOS 16.0, *) { cell?.contentConfiguration = UIHostingConfiguration { Text("123").onTapGesture { print("123") } } return cell } on ios 18.1 onTapGesture sometimes will not callback ,but ios 17 16 is ok,how can i fix it
1
0
243
Dec ’24