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

How do I make an editable NSTextField wrap inside an NSTableView cell?
Hi, I’m pretty new to AppKit and I’m trying to make an NSTextField inside an NSTableView both: Editable Multi-line / wrapping Right now, wrapping works fine until I set: tf.isEditable = true Then the text becomes a single line. How do I make it editable while still wrapping correctly? import AppKit final class ViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate { let tableView = NSTableView() let text = String(repeating: "A", count: 500) override func viewDidLoad() { super.viewDidLoad() view = tableView tableView.addTableColumn(NSTableColumn()) tableView.usesAutomaticRowHeights = true tableView.dataSource = self tableView.delegate = self } func numberOfRows(in tableView: NSTableView) -> Int { 1 } func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { let cell = NSTableCellView() let tf = NSTextField(wrappingLabelWithString: text) tf.lineBreakMode = .byCharWrapping if let tableColumn { tf.preferredMaxLayoutWidth = tableColumn.width } tf.isEditable = true // comment this out and wrapping works cell.addSubview(tf) tf.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ tf.leadingAnchor.constraint(equalTo: cell.leadingAnchor), tf.trailingAnchor.constraint(equalTo: cell.trailingAnchor), tf.topAnchor.constraint(equalTo: cell.topAnchor), tf.bottomAnchor.constraint(equalTo: cell.bottomAnchor), ]) return cell } }
4
0
148
12h
Swift ​Charts: ​Point​Mark annotation appears behind other ​Point​Marks
I’m using Swift Charts to show a scatter plot with multiple PointMarks. When the user selects a point, I attach an annotation to the selected PointMark to show a label like Strike 1. I expected the annotation to render above all chart marks, but in practice nearby PointMarks can be drawn over the annotation text/background. Simplified example: Chart { ForEach(points.filter { !$0.isSelected }) { point in PointMark( x: .value("X", point.x), y: .value("Y", point.y) ) .foregroundStyle(.black) } if let selectedPoint { PointMark( x: .value("X", selectedPoint.x), y: .value("Y", selectedPoint.y) ) .foregroundStyle(.orange) .annotation(position: .top) { Text("Strike \(selectedPoint.number)") .padding(.horizontal, 8) .padding(.vertical, 4) .background(Capsule().fill(.orange.opacity(0.15))) } } } screenshots
2
0
135
13h
LiveActivity via Push-To-Start and Update token questions.
We are implementing starting an activity via Push-To-Start. For the most part it works great, however we have run into a few edge cases. Currently, we send the "start activity" push notification and it creates the Activity as expected. If the app doesn't send an update token w/in a configured time, we assume the activity didn't start and try to start the activity again. Occasionally we get into a situation where there have been multiple activities started, but it should really only be one. Here is my theory: We store an auth token in the keychain for all REST endpoints if the phone has been restarted and not unlocked, the app doesn't have access to the auth token and fails to send the update token to our backend. Are there any best practices on how to manage PTS and UPDATE tokens? (updating these w/o authentication seems problematic)
0
0
74
13h
UIAlertController appears "shattered" on iOS 26
We are experiencing an issue with a few end users where the UIAlertController's UIView is rendered with a (for the lack of a better word) "shattered" effect (see attachments). It appears to be happening only occasionally which makes me think it's a bug with iOS 26 and/or hardware issue. I'm posting here hoping to get some type of guidance on a workaround or if this is already a known issue (I have not been able to find instances of this particular issue online). Has anyone experienced or seen others experience this issue? Does anyone know of a workaround or can confirm this is a bug with iOS 26? Thanks in advance.
Topic: UI Frameworks SubTopic: UIKit
1
0
50
17h
tvOS SwiftUI - Siri "On-Screen Actions" breaks lazy lists
Hey team, This is a weird one, when Siri + "On-Screen Actions" are enabled in the Apple TV settings (General Settings), LazyVStack experiences severe main-thread hangs and very high CPU usage. The issue only occurs when Siri + On-Screen Actions are enabled in Apple TV device settings (General Settings). Disabling On-Screen Actions completely resolves the issue. The issue has been verified on multiple Apple TV devices, running tvOS 26.3, 26.4 and 26.5. The behavior was not observed in Simulators, only on an actual device. This seems to be caused by some type of accessibility overlap with SwiftUI. Running the below code with "On-Screen Actions" enabled in the Siri settings will demonstrate a complete hang of the CPU at 100% struct TestData { let id = UUID() var title: String } struct TestView: View { @State private var test: [TestData] = [] var body: some View { ScrollView { LazyVStack { ForEach(self.test, id: \.id) { data in Button { } label: { Text(data.title) } } } } .task { var arr: [TestData] = [] for _ in 0..<30000 { let data = TestData(title: "Title") arr.append(data) } self.test = arr } } } Already submited a bug report FB22758928
0
0
101
1d
App crashes in CGFontStrikeRelease
This crash has been troubling us for a long time. We have this crash report in every release of our App, but can't reproduce it. Here is part of the crash info: Incident Identifier: xxxx Hardware Model: iPhone13,3 Process: MyApp [34550] Path: /private/var/containers/Bundle/Application/xxxx/MyApp.app/MyApp Identifier: xxx.xxx Version: xxx (296) AppStoreTools: 15F31c AppVariant: 1:iPhone13,3:15 Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Coalition: xxx.xxx [466] Date/Time: 2024-05-19 13:59:10.9716 +0800 Launch Time: 2024-05-19 12:18:24.8753 +0800 OS Version: iPhone OS 16.6.1 (20G81) Release Type: User Baseband Version: 3.80.01 Report Version: 104 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x322e323400000000 -> 0x0000003400000000 (possible pointer authentication failure) Exception Codes: 0x0000000000000001, 0x322e323400000000 VM Region Info: 0x3400000000 is in 0x1000000000-0x7000000000; bytes after start: 154618822656 bytes before end: 257698037759 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL commpage (reserved) fc0000000-1000000000 [ 1.0G] ---/--- SM=NUL ...(unallocated) ---> GPU Carveout (reserved) 1000000000-7000000000 [384.0G] ---/--- SM=NUL ...(unallocated) UNUSED SPACE AT END Triggered by Thread: 0 Thread 0 name: Thread 0 Crashed: 0 CoreGraphics 0x00000001bd1d0780 CGFontStrikeRelease + 76 (CGFontStrike.c:126) 1 CoreGraphics 0x00000001bd1dd0cc CGGlyphBuilderUnlockBitmaps + 476 (CGGlyphBuilder.cc:113) 2 CoreGraphics 0x00000001bd1eb8c8 render_glyphs + 412 (RIPContextDrawGlyphs.c:127) 3 CoreGraphics 0x00000001bd202ea4 draw_glyph_bitmaps + 1132 (RIPContextDrawGlyphs.c:210) 4 CoreGraphics 0x00000001bd21a0ec ripc_DrawGlyphs + 1320 (RIPContextDrawGlyphs.c:558) 5 CoreGraphics 0x00000001bd1d26d8 CG::DisplayList::executeEntries(std::__1::__wrap_iter<std::__1::unique_ptr<CG::DisplayListEntry const, std::__1::default_delete<CG::DisplayListEntry const> >*>, std::__1::__wrap_iter<std::__1::uniq... + 5852 (DisplayList.cpp:1657) 6 CoreGraphics 0x00000001bd1c86a8 CGDisplayListDrawInContextDelegate + 268 (DisplayList.cpp:2151) 7 QuartzCore 0x00000001bcc797d4 CABackingStoreUpdate_ + 468 (CABackingStore.cpp:1388) 8 QuartzCore 0x00000001bccf0c34 invocation function for block in CA::Layer::display_() + 64 (CALayer.mm:9699) 9 QuartzCore 0x00000001bcc78d54 -[CALayer _display] + 1720 (CALayer.mm:9732) 10 QuartzCore 0x00000001bcc785b4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 412 (CALayer.mm:2521) 11 QuartzCore 0x00000001bcc898d8 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 444 (CAContextInternal.mm:2714) 12 QuartzCore 0x00000001bccb8e80 CA::Transaction::commit() + 648 (CATransactionInternal.mm:432) 13 QuartzCore 0x00000001bcca2df0 CA::Transaction::flush_as_runloop_observer(bool) + 88 (CATransactionInternal.mm:940) 14 UIKitCore 0x00000001bdca34d0 _UIApplicationFlushCATransaction + 52 (UIApplication.m:3286) 15 UIKitCore 0x00000001bddf3d94 _UIUpdateSequenceRun + 84 (_UIUpdateSequence.mm:114) 16 UIKitCore 0x00000001be458894 schedulerStepScheduledMainSection + 144 (_UIUpdateScheduler.m:1015) 17 UIKitCore 0x00000001be457df0 runloopSourceCallback + 92 (_UIUpdateScheduler.m:1164) 18 CoreFoundation 0x00000001bb80a128 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957) 19 CoreFoundation 0x00000001bb8167b4 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001) 20 CoreFoundation 0x00000001bb79b5e8 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038) 21 CoreFoundation 0x00000001bb7b10d4 __CFRunLoopRun + 828 (CFRunLoop.c:2953) 22 CoreFoundation 0x00000001bb7b63ec CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418) 23 GraphicsServices 0x00000001f6ccc35c GSEventRunModal + 164 (GSEvent.c:2196) 24 UIKitCore 0x00000001bdb42f58 -[UIApplication _run] + 888 (UIApplication.m:3782) 25 UIKitCore 0x00000001bdb42bbc UIApplicationMain + 340 (UIApplication.m:5372) 26 MyApp 0x000000010468f978 main + 80 (main.m:15) 27 dyld 0x00000001dace8dec start + 2220 (dyldMain.cpp:1165) Thread 1 name: Thread 1: 0 libsystem_kernel.dylib 0x00000001fa6f6ca4 mach_msg2_trap + 8 (:-1) 1 libsystem_kernel.dylib 0x00000001fa709b74 mach_msg2_internal + 80 (mach_msg.c:201) 2 libsystem_kernel.dylib 0x00000001fa709e4c mach_msg_overwrite + 540 (mach_msg.c:0) 3 libsystem_kernel.dylib 0x00000001fa6f71e8 mach_msg + 24 (mach_msg.c:323) 4 CoreFoundation 0x00000001bb7b0024 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2622) 5 CoreFoundation 0x00000001bb7b1250 __CFRunLoopRun + 1208 (CFRunLoop.c:3005) 6 CoreFoundation 0x00000001bb7b63ec CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418) 7 Foundation 0x00000001b5a2efb4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373) 8 Foundation 0x00000001b5a2ee9c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:420) 9 UIKitCore 0x00000001bdc75cc8 -[UIEventFetcher threadMain] + 416 (UIEventFetcher.m:1376) 10 Foundation 0x00000001b5a48524 __NSThread__start__ + 716 (NSThread.m:963) 11 libsystem_pthread.dylib 0x000000021b5766b8 _pthread_start + 148 (pthread.c:893) 12 libsystem_pthread.dylib 0x000000021b575b88 thread_start + 8 (:-1) Thread 2: 0 libsystem_kernel.dylib 0x00000001fa6f7164 __semwait_signal + 8 (:-1) 1 libsystem_c.dylib 0x00000001c2c50888 nanosleep + 220 (nanosleep.c:104) 2 libsystem_c.dylib 0x00000001c2c61b1c sleep + 52 (sleep.c:62) 3 MyApp 0x00000001075ccb14 -[UTDCacheManager synchronizeData] + 104 (UTDCacheManager.m:133) 4 Foundation 0x00000001b5a48524 __NSThread__start__ + 716 (NSThread.m:963) 5 libsystem_pthread.dylib 0x000000021b5766b8 _pthread_start + 148 (pthread.c:893) 6 libsystem_pthread.dylib 0x000000021b575b88 thread_start + 8 (:-1)
4
0
1k
1d
SwiftData in-memory ModelContainer causes DefaultStore validation errors on consecutive xcodebuild test runs
When running parallel Swift Testing tests that each create their own in-memory ModelContainer, the first xcodebuild test run succeeds but all subsequent runs fail with DefaultStore save failed validation errors — unless DerivedData is deleted between runs. Setup Each test suite creates an isolated in-memory container with a unique name: ModelConfiguration(UUID().uuidString, schema: schema, isStoredInMemoryOnly: true) The @Model class has non-optional properties (e.g. var v: String, var entityDicMoveNr: Int) that are always set in init. Symptoms on second run SwiftData.DefaultStore save failed with error: Error Domain=NSCocoaErrorDomain Code=1560 "Multiple validation errors occurred." NSValidationErrorKey=v, NSValidationErrorValue=null NSValidationErrorKey=entityDicMoveNr, NSValidationErrorValue=null NSValidationErrorKey=historyBackup, NSValidationErrorValue=null The errors appear before test code executes — during SwiftData's internal DefaultStore auto-save. Properties that are always initialized in Swift show as nil in the Core Data layer. What we verified Each run uses a fresh xctest process (different PIDs) Container creation succeeds (no errors in our ModelContainer init) The @Model init always sets all fields — confirmed with debug prints Deleting DerivedData before each run fixes it (but forces a full rebuild) What didn't help Using ModelContext(container) instead of container.mainContext Setting autosaveEnabled = false on both mainContext and custom contexts Using /dev/null URL instead of isStoredInMemoryOnly: true build-for-testing + test-without-building Clearing only Logs/Test or TestResults subdirectories Why not run via swift test? We can't fall back to swift test because our project uses RealityKit custom components, which silently fail to decode in CLI swift test. So xcodebuild test is our only option, making the DerivedData workaround especially costly. Workaround Delete DerivedData before each xcodebuild test invocation. Environment macOS 15.5, Xcode 16.4, Swift Testing with @Suite @MainActor parallel test suites. Question Is there a way to fully isolate in-memory ModelContainer instances so that no metadata leaks between xcodebuild test runs without requiring a full DerivedData clean?
4
0
156
1d
SF Symbols .replace animation is partially missing
In SF Symbols 7, I'm observing a discrepancy between the .replace animation previewed in the SF Symbols app and the result when using the code template the app provides. Expected behavior: When previewing the .replace animation in the SF Symbols app (with Magic Replace preferred), the transition looks like: Actual behavior: When I implement the animation using the exact code template generated by the SF Symbols app, the result looks like: My code: struct PlaygroundSwiftUIView: View { @State var name = "folder.circle" var body: some View { Image(systemName: name) .font(.system(size: 60)) .contentTransition(.symbolEffect(.replace)) .onTapGesture { name = "tree" } } } #Preview { PlaygroundSwiftUIView() } The animation rendered in my app does not match the preview shown in the SF Symbols app. The drawOff animation is partially missing. Is there something missing from the code template, or is there an additional configuration step required to achieve the correct Replace effect? or is this a bug?
2
0
166
1d
SF Symbols Variable Color — "Draw" symbols show no effect in Default mode
I've noticed an inconsistency between how the SF Symbols app and SwiftUI code handle variable color for symbols that use the "Draw" animation mode. Background SF Symbols that support variable color fall into two categories based on their animation preference: Symbols suited for .symbolVariableValueMode(.color) — layers are highlighted/dimmed by color opacity Symbols suited for .symbolVariableValueMode(.draw) — layers are progressively drawn/erased When .symbolVariableValueMode is not set (i.e., the default mode), I expected the system to automatically choose the appropriate mode for each symbol. What SF Symbols app shows In the SF Symbols app, selecting thermometer.high, enabling variable color, and setting the value to 0.5 with "Default" mode selected produces a correct and expected result — the symbol renders identically to the explicit "Draw" mode. What SwiftUI code does In code, when symbolVariableValueMode is not specified (default), symbols from the "Draw" category receive no visual effect — they appear static, as if variable value is ignored entirely. // This works correctly Image(systemName: "thermometer.high") .symbolVariableValue(0.5) .symbolVariableValueMode(.draw) // This shows NO effect — expected to fall back to .draw, but doesn't Image(systemName: "thermometer.high") .symbolVariableValue(0.5) // no .symbolVariableValueMode set Symbols in the "Color" category appear unaffected — they render correctly with or without an explicit mode. Question / Bug? Is this a known limitation, or is the default mode in code intentionally different from what the SF Symbols app previews? If so, is there a programmatic way to query which symbolVariableValueMode a given symbol prefers at runtime, so I can set it explicitly without hardcoding per-symbol logic?
0
0
91
2d
SwiftUI + AppKit context menu wedges window-level mouse events when the menu's anchor view is deleted by the menu's own action
I'm on macOS 26.4 (SwiftUI + SwiftData + AppKit bridging). I have a SwiftUI canvas where each child view (a card) carries a per-card AppKit context menu via an NSViewRepresentable overlay (a small NSView subclass that overrides menu(for:) and returns an NSMenu whose items invoke a Swift closure). The closure for the "Delete" item removes the underlying model object. SwiftData mutates → SwiftUI re-emits the canvas → the card containing the menu's anchor NSView unmounts → that anchor NSView is removed from the AppKit view hierarchy. After this happens, the entire window's SwiftUI gestures stop receiving mouse events: pan, zoom, taps on a separate background Color view all go silent. The window's first responder ends up at the NSWindow itself. The wedge persists across switching to a sibling SwiftUI view in the same window (different SwiftData root), so the bad state is at the window/event-routing level, not in any one SwiftUI subtree. The wedge is reliably cleared by another right-click that successfully shows + dismisses any menu — strongly suggesting AppKit's menu/event-tracking cleanup is left in a half-finished state because the anchor view went away during the cleanup window. I've already verified: Switching from explicit NSMenu.popUpContextMenu(_:with:for:) to overriding menu(for:) does not change the behavior. Deferring the model deletion via DispatchQueue.main.async, asyncAfter (30 ms), or RunLoop.main.perform(inModes: [.default]) either doesn't help or only avoids the wedge if the delay is long enough to be perceptible (seconds), implying the cleanup window is event-driven, not time-driven. Triggering the same deletion from a SwiftUI Button (no AppKit menu involved) never wedges. My current understanding is that the standard AppKit pattern (e.g., NSTableView, NSOutlineView) attaches the context menu to a stable parent view, never to the per-row view itself, precisely so the menu's anchor outlives any single row's deletion. Restructuring my code so a single canvas-level AppKitContextMenuRegion returns the appropriate menu via hit-testing in menu(for:) should avoid the issue, but I'd like to confirm: Is the assumption that an NSMenu's anchor view must outlive the menu's tracking-end cleanup documented anywhere, or is it implicit? Is there a supported way to safely use a per-row anchor view that gets deleted by the menu's own action, or is the canvas-level / parent-level menu attachment the only correct pattern? 3. Are there any post-tracking notifications or APIs that guarantee AppKit's cleanup is complete before the anchor view is allowed to be torn down (so a per-row anchor could be made safe with the right ordering)? Thanks!
0
0
271
3d
Charts performance issue
Hi, I want to recreate a chart from Apple Health and I have code like this. When I scroll - especially the week and month charts, there are performance issues. If I remove .chartScrollPosition(x: $scrollChartPosition), it runs smoothly, but I need to know which part of the chart is currently displayed. Can you help me? import Charts import SwiftUI struct MacroChartView: View { var selectedRange: ChartRange var binnedPoints: [MacroBinPoint] @State private var scrollChartPosition: Date = .now var body: some View { VStack { Text("\(selectedRange.rangeLabel(for: scrollChartPosition))") Chart(binnedPoints) { point in BarMark( x: .value("Date", point.date, unit: selectedRange.binComponent), y: .value("Calories", point.calories) ) } .frame(height: 324) .chartXVisibleDomain(length: selectedRange.visibleDomainLength()) .chartScrollableAxes(.horizontal) .chartScrollPosition(x: $scrollChartPosition) .chartScrollTargetBehavior(.valueAligned(matching: selectedRange.scrollAlignmentComponents)) .chartXAxis { switch selectedRange { case .week: AxisMarks(values: .stride(by: .day)) { date in AxisGridLine() AxisTick() AxisValueLabel(format: .dateTime.weekday(.abbreviated)) } case .month: AxisMarks(values: .stride(by: .weekOfYear)) { date in AxisGridLine() AxisTick() AxisValueLabel(format: .dateTime.day()) } case .halfYear: AxisMarks(values: .stride(by: .month)) { date in AxisGridLine() AxisTick() AxisValueLabel(format: .dateTime.month(.abbreviated)) } case .year: AxisMarks(values: .stride(by: .month)) { date in AxisGridLine() AxisTick() AxisValueLabel(format: .dateTime.month(.abbreviated)) } } } } } } enum MeasurementHistoryMode { case macros case comparisons } enum MacroKindToDisplay { case protein, fat, carbs } enum MacrosDisplayMode: Equatable { case all case single(MacroKindToDisplay) } enum ChartRange: String, CaseIterable { case week = "T" case month = "M" case halfYear = "6M" case year = "R" var binComponent: Calendar.Component { switch self { case .week, .month: return .day case .halfYear: return .weekOfYear case .year: return .month } } var scrollAlignmentComponents: DateComponents { switch self { case .week: return DateComponents(hour: 0, minute: 0, second: 0) case .month: return DateComponents(hour: 0) case .halfYear: return DateComponents(weekday: 1) case .year: return DateComponents(day: 1) } } func visibleDomainLength() -> Int { switch self { case .week: return 7 * 24 * 60 * 60 case .month: return 31 * 24 * 60 * 60 case .halfYear: return 6 * 31 * 24 * 60 * 60 case .year: return 12 * 31 * 24 * 60 * 60 } } func start(for date: Date) -> Date { let cal = Calendar.current switch self { case .week, .month: return cal.startOfDay(for: date) case .halfYear: return cal.dateInterval(of: .weekOfYear, for: date)?.start ?? cal.startOfDay(for: date) case .year: return cal.dateInterval(of: .month, for: date)?.start ?? cal.startOfDay(for: date) } } func rangeLabel(for start: Date) -> String { let end = start.addingTimeInterval(TimeInterval(visibleDomainLength())) let f = DateFormatter() f.dateFormat = Calendar.current.isDate(start, inSameDayAs: end) ? "MMM d" : "MMM d" return Calendar.current.isDate(start, inSameDayAs: end) ? f.string(from: start) : "\(f.string(from: start)) – \(f.string(from: end))" } } struct MacrosPoint: Identifiable { var id: Date { date } let date: Date let calories: Double let proteinInGrams: Double let carbsInGrams: Double let fatInGrams: Double } struct MacroBinPoint: Identifiable { var id: Date { date } let date: Date let calories: Double let proteinKcal: Double let carbsKcal: Double let fatKcal: Double } func bin(points: [MacrosPoint], for period: ChartRange) -> [MacroBinPoint] { let grouped = Dictionary(grouping: points) { point in period.start(for: point.date) } let bins = grouped.map { (start, items) -> MacroBinPoint in var calories = items.reduce(0) { $0 + $1.calories } var proteinKcal = items.reduce(0) { $0 + $1.proteinInGrams * 4 } var carbsKcal = items.reduce(0) { $0 + $1.carbsInGrams * 4 } var fatKcal = items.reduce(0) { $0 + $1.fatInGrams * 9 } calories /= Double(items.count) proteinKcal /= Double(items.count) carbsKcal /= Double(items.count) fatKcal /= Double(items.count) return MacroBinPoint(date: start, calories: calories, proteinKcal: proteinKcal, carbsKcal: carbsKcal, fatKcal: fatKcal) } .sorted { $0.date < $1.date } return bins } struct ExampleData { static let macrosPoints: [MacrosPoint] = [ MacrosPoint(date: Date(timeIntervalSince1970: 1687949774), calories: 1895, proteinInGrams: 115, carbsInGrams: 192, fatInGrams: 72),... ]
2
1
482
3d
Programatically adding to a TextField and moving the TextSelection point in SwiftUI
Hi! I am trying to create a simple SwiftUI TextField, with an external button to add text to the field at the current insertion point (the cursor in the TextField). When I add the text, the cursor (I-Beam) remains at the original insertion point, so I want it to move over to the end of what I added. The trouble is, it sometimes moves further forward or to the end (visibly) but works as if it is still at the point I moved it to. This seems to possibly be due to emojis in the TextField (because, I assume, they are composed of more bytes). Further, sometimes the addition of the text can cause an emoji to appear unexpectedly, I assume because it is combining the bytes in an odd way. So moving the cursor seems to sometimes introduce weird behaviour. This comes from a much larger project, but I have distilled this down to the smallest example project I could. And I have a video to show how it behaves. Here's the main part of the code, and I'll attach an Xcode project: import SwiftUI struct ContentView: View { @State private var text: String = "abcdef🧁🧁🧁🧁ghijkl" @State private var selectedText: TextSelection? var body: some View { VStack { TextField("", text: $text, selection: $selectedText) .font(.title) Button("Add Z at Insertion Point in TextField") { // Get indices of any selection in the text field let from: String.Index, to: String.Index if let selectedText = selectedText { let indices = selectedText.indices switch indices { case .selection(let range): from = range.lowerBound to = range.upperBound case .multiSelection(let rangeSet): from = rangeSet.ranges.first!.lowerBound to = rangeSet.ranges.first!.upperBound default: from = self.text.endIndex to = self.text.endIndex } } else { from = self.text.endIndex to = self.text.endIndex } guard from <= to && from <= self.text.endIndex else { return } // Insert and update the cursor position self.text.replaceSubrange(from..<to, with: "Z") // Move cursor after the inserted character let newIndex = self.text.index(after: from) selectedText = TextSelection(insertionPoint: newIndex) } } .padding() } } STEPS TO REPRODUCE Run the app. Also view the video as it shows the steps. Put insertion point between c and d. Press the "Add Z" button. Note that Z is placed between c and d. This is great. Put insertion point between h and i. Press the "Add Z" button. Note that Z is placed between h and i. BUT, the insertion point I-beam moves to the end of the string. Press the "Add Z" button again. Z is added where you would have expected based on where the TextSelection insertion point was put, but the flashing I-Beam is still at the end. Press the "Add Z" button again. Same issue. insertion point is being shown at end, but to the button it is between Z and i. OF NOTE, if you use the keyboard and press delete, it deletes from end (where the I-beam is). Now put insertion point between the 4 cupcakes. Press "Add Z" two times. It behaves correctly. Press "Add Z" a third time. It adds a fairy emoji. So, any idea what I am doing wrong? I thought it might be an issue requiring me to update in a background thread, but I tried that, even delaying the update in the thread, but the issue remains. Thanks in advance. Here's a video: https://curmi.name/temp/SimpleTextField%20showing%20issues.mp4 And if it helps, here is the Xcode project: https://curmi.name/temp/SimpleTextfield.zip
0
0
204
3d
error: A NavigationLink is presenting a value of type “String” but there is no matching navigationDestination
please help, i am new to SWIFTUI getting an error: A NavigationLink is presenting a value of type “String” but there is no matching navigationDestination declaration visible from the location of the link. The link cannot be activated. struct debug_navigation_3: View { @State private var path = NavigationPath() @StateObject private var debug_Client_Lead_Data_ListVM = Debug_Client_Lead_Data_List_Model() var body: some View { NavigationStack(path:$path) { VStack { List(debug_Client_Lead_Data_ListVM.Debug_Client_Lead_Data_Rows, id: \.self) { curr_clientLeadRequest in NavigationLink(curr_clientLeadRequest.Client_Message, value: curr_clientLeadRequest.Client_Message) } } .navigationDestination(for:Debug_Client_Lead_Data.self) { curr_clientLeadRequest in debug_navigation_3_DetailView(rec_id: Int64(curr_clientLeadRequest.id)) } } .onAppear() { Task { await debug_Client_Lead_Data_ListVM.search(rec_id:Int64(0)) //bring all REST API } } } } // data model import Foundation struct Debug_Client_Lead_Data_Response: Decodable { let Debug_Client_Lead_Data_Rows: [Debug_Client_Lead_Data] private enum CodingKeys: String, CodingKey { case Debug_Client_Lead_Data_Rows = "rows" // root tag: REST API } } struct Debug_Client_Lead_Data: Decodable, Hashable, Identifiable { let id:Int32 let Client_Message: String private enum CodingKeys: String, CodingKey { case id = "id" case Client_Message = "Client_Message" } } //list view model import Foundation @MainActor class Debug_Client_Lead_Data_List_Model: ObservableObject { @Published var Debug_Client_Lead_Data_Rows: [Debug_Client_Lead_Data_ListViewModel] = [] func search(rec_id:Int64) async { do { let Debug_Client_Lead_Data_Rows = try await Webservice_debug_client_lead_data().getClientLeadRequestSummary(rec_id:rec_id) // '0' optional self.Debug_Client_Lead_Data_Rows = Debug_Client_Lead_Data_Rows.map(Debug_Client_Lead_Data_ListViewModel.init) } catch { print(error) } } } struct Debug_Client_Lead_Data_ListViewModel: Identifiable, Hashable { let debug_Client_Lead_Data: Debug_Client_Lead_Data var id:Int32 { debug_Client_Lead_Data.id } var Client_Message: String { debug_Client_Lead_Data.Client_Message } } //REST API import Foundation class Webservice_debug_client_lead_data { func getClientLeadRequestSummary(rec_id:Int64) async throws -> [Debug_Client_Lead_Data] { var components = URLComponents() components.scheme = Global_REST_API_URL_HTTP components.host = Global_REST_API_URL components.port = Global_REST_API_URL_port components.path = "/GetClientLeadRequest" components.queryItems = [ URLQueryItem(name: "rec_id", value: String(rec_id)) // Optional, pass '0' for all rows ] guard let url = components.url else { throw NetworkError.badURL } let (data, response) = try await URLSession.shared.data(from: url) guard (response as? HTTPURLResponse)?.statusCode == 200 else {throw NetworkError.badID } let Debug_Client_Lead_Data_Response = try? JSONDecoder().decode(Debug_Client_Lead_Data_Response.self, from: data) return Debug_Client_Lead_Data_Response?.Debug_Client_Lead_Data_Rows ?? [] } }
Topic: UI Frameworks SubTopic: SwiftUI
0
0
174
4d
setAlternateIconName system alert ignores CFBundleLocalizations and forces English in iOS 26.1+ (Unexpectedly triggers sceneWillResignActive)
Environment: Xcode Version: Xcode 26.3 Affected iOS Versions: iOS 26.1 and later Working iOS Versions: iOS 26.0 and earlier Tested Devices: iPhone 15 Pro (iOS 26.2) - ❌ Bug presents iPhone 17 (iOS 26.1) - ❌ Bug presents iPhone Air (iOS 26.0) - ✅ Works as expected iPhone 16 Pro Max (iOS 18.0) - ✅ Works as expected Description: We have identified a severe localization regression regarding the setAlternateIconName(_:completionHandler:) API starting from iOS 26.1. Our application is strictly restricted to support only Traditional Chinese (zh-TW / zh-Hant). We have correctly configured CFBundleLocalizations, CFBundleDevelopmentRegion, and explicitly set CFBundleAllowMixedLocalizations to YES in our Info.plist. In iOS 26.0 and earlier, when changing the app icon, the system alert correctly displays in Traditional Chinese. However, in iOS 26.1 and later, the alert unexpectedly falls back to English, completely ignoring the app's localization constraints and the user's preferred device language. Crucial Observation: We noticed a significant behavioral change: in iOS 26.1+, invoking setAlternateIconName forces the app to enter the sceneWillResignActive state before the alert appears. This behavior did not exist prior to iOS 26.1. This strongly suggests that the alert has been moved to an out-of-process overlay managed by SpringBoard. It appears that the system cache is failing to properly resolve the app's CFBundleLocalizations during this out-of-process presentation. Steps to Reproduce: Create an iOS application restricted to Traditional Chinese (zh-TW). Set CFBundleDevelopmentRegion to zh-Hant in Info.plist. Set the CFBundleLocalizations array to contain only zh-TW (or zh-Hant). Set CFBundleAllowMixedLocalizations to YES. Implement setAlternateIconName to trigger the app icon change. Run the app on a device running iOS 26.1 or later (ensure the device's system language is set to Traditional Chinese). Trigger the icon change action. Expected Result: The app should NOT trigger sceneWillResignActive (maintaining iOS 26.0 behavior); OR the out-of-process system alert must correctly read the Info.plist and display the prompt in Traditional Chinese. Actual Result: The app immediately triggers sceneWillResignActive and loses focus. The system overlay alert appears but ignores all Traditional Chinese settings, displaying an English interface instead. Any insights or workarounds from the engineering team would be highly appreciated. We'd like to know if this is a known SpringBoard rendering issue in iOS 26.1+. Thank you!
2
0
424
4d
Crash in PDFView / PDFPageAnalyzerV2
Hello. Some users of my app experience crashes that mention PDFKit. I managed to find out what specific PDF file caused the crash and created a sample that demonstrates the issue and created a bug report in Feedback Assistant (FB22409977). Unfortunately I didn't get any answer for over a month, hence I'm writing it here so others can see that this is a known issue. The crash repro sample is very simple, it's just a PDFView that opens a bundled PDF file upon application lanunch. To cause the crash it is only needed to zoom-in and move around the page that has a table. The crash happens when the system tries to do some sort of OCR. The original crash report came from iPhone 11 user running iOS 26.3.1. Recently another user with iPhone 16 Pro Max running 26.5 experienced the same crash. Thread 12 Queue : PDFKWit.PDFDocument.formFillingQueue (serial) #0 0x000000018d320bd8 in PageLayout::GetBoundsForRangeWithinLine () #1 0x000000018d320c88 in PageLayout::GetBoundsForTextRange () #2 0x000000018d393028 in CGPDFTaggedNodeCreateCopyWithStringRange () #3 0x000000018d316630 in invocation function for block in TaggedParser::InsertLinkAnnotationsIntoStructureTree(CGPDFTaggedNode*, CGPDFPage*, PageLayout&) () #4 0x000000018d104f00 in CGPDFPageEnumerateAnnotations () #5 0x000000018d106968 in CGPDFPageCopyRootTaggedNode () #6 0x000000018d106710 in CGPDFPageInsertTableDescriptions () #7 0x00000001957a65b8 in +[PDFPageAnalyzerV2 addTablesFromVisionDocument:documentImage:toPage:withBox:] () #8 0x00000001957a3030 in +[PDFPageAnalyzerV2 analyzePage:withBox:requestTypes:] () #9 0x000000019584c018 in __31-[PDFView visiblePagesChanged:]_block_invoke () When CG_PDF_VERBOSE env variable is set, "New text range needs to be within the original node's text range." warning is printed to console several times before the crash happens.
0
0
103
5d
MacCatalyst, UIScene and the green zoom/fullscreen button
Please show me where I’ve gone amiss in MacCatalyst and UIScenes with regard to the macOS green zoom/fullscreen button. Originally the MacCatalyst App used a secondary AppKit bundle for its NSWindow work, but at some point in time AppStore Connect complained about this secondary bundle which prevented new App uploads. To continue receiving green button notifications I switched to UINSWindow. That worked. Now that I’m forced to use UIScenes I’m in a pickle: a click on the green button forces an automatic jump to fullscreen, nothing I can do about it AFAIK. A poor, poor compromise would be to disable the green button but I have no idea how even to do that. I’d like my App to exist in two states, any suggestions? Thanks.
1
0
122
5d
Why doesn't .glassEffect tint render on a Menu in an iOS 26 toolbar?
This is what I am trying to achieve (from the Phone app, similar one is also in Photos) I have a standard SwiftUI Menu in a toolbar with a glass tint applied to indicate the filter is active: Menu { // …filter options } label: { Label("Filter", systemImage: "line.3.horizontal.decrease") } .glassEffect(.regular.tint(.accentColor).interactive()) The glass effect doesn't render at all, no tint. The button looks completely unstyled. If I switch the label from Label to Image, the glass renders, but as a stretched oblong pill. I have tried several other combinations too: Also in the Apple's version during hover (iPad) the highlight aligns with the tint itself (see second image above) rather than outside it like in example 3 from the list above: Is there a way to get a Menu's trigger inset tint to look as in the Phone app example?
0
0
46
5d
"any View cannot conform to View"
Hello, What is the solution to this problem, assuming that you are not supposed to use AnyView, which I hear over and over again? Given this protocol: protocol MyProtocol { associatedtype V: View var content: () -> V { get } } if I want to store a heterogenous collection of MyProtocol, let collection: [any MyProtocol], then the underlying V type of each is erased to any View, which (supposedly) does not conform to View. Is there no way to "unbox" the existential any View to get the underlying View back? That unboxing idea is something I heard in a few WWDC videos but it seems like it does not apply to View.
Topic: UI Frameworks SubTopic: SwiftUI
0
0
42
5d
Navigation Title and UIAlertViewController actions truncated/cut on iPhone 13/14/15 Pro Max with iOS 26.4/5 using Cyrillic localisation
Since iOS 26.4, we are observing an issue on iPhone 13 Pro Max, iPhone 14 Pro Max, and iPhone 15 Pro Max where text is truncated on first presentation when using Bulgarian (Cyrillic) localization. The issue affects: UINavigationBar title (both inline and large titles) UIAlertController action titles Behavior: On first presentation, the text is truncated/cut off. On subsequent presentations, the layout appears correct. Adding a zero-width space (\u{200B}) before the last character of the string prevents truncation. This appears to slightly increase the layout width calculation and avoids the issue. Has anyone else encountered this behavior or found a more appropriate workaround?
1
0
106
5d
How do I make an editable NSTextField wrap inside an NSTableView cell?
Hi, I’m pretty new to AppKit and I’m trying to make an NSTextField inside an NSTableView both: Editable Multi-line / wrapping Right now, wrapping works fine until I set: tf.isEditable = true Then the text becomes a single line. How do I make it editable while still wrapping correctly? import AppKit final class ViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate { let tableView = NSTableView() let text = String(repeating: "A", count: 500) override func viewDidLoad() { super.viewDidLoad() view = tableView tableView.addTableColumn(NSTableColumn()) tableView.usesAutomaticRowHeights = true tableView.dataSource = self tableView.delegate = self } func numberOfRows(in tableView: NSTableView) -> Int { 1 } func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { let cell = NSTableCellView() let tf = NSTextField(wrappingLabelWithString: text) tf.lineBreakMode = .byCharWrapping if let tableColumn { tf.preferredMaxLayoutWidth = tableColumn.width } tf.isEditable = true // comment this out and wrapping works cell.addSubview(tf) tf.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ tf.leadingAnchor.constraint(equalTo: cell.leadingAnchor), tf.trailingAnchor.constraint(equalTo: cell.trailingAnchor), tf.topAnchor.constraint(equalTo: cell.topAnchor), tf.bottomAnchor.constraint(equalTo: cell.bottomAnchor), ]) return cell } }
Replies
4
Boosts
0
Views
148
Activity
12h
Swift ​Charts: ​Point​Mark annotation appears behind other ​Point​Marks
I’m using Swift Charts to show a scatter plot with multiple PointMarks. When the user selects a point, I attach an annotation to the selected PointMark to show a label like Strike 1. I expected the annotation to render above all chart marks, but in practice nearby PointMarks can be drawn over the annotation text/background. Simplified example: Chart { ForEach(points.filter { !$0.isSelected }) { point in PointMark( x: .value("X", point.x), y: .value("Y", point.y) ) .foregroundStyle(.black) } if let selectedPoint { PointMark( x: .value("X", selectedPoint.x), y: .value("Y", selectedPoint.y) ) .foregroundStyle(.orange) .annotation(position: .top) { Text("Strike \(selectedPoint.number)") .padding(.horizontal, 8) .padding(.vertical, 4) .background(Capsule().fill(.orange.opacity(0.15))) } } } screenshots
Replies
2
Boosts
0
Views
135
Activity
13h
LiveActivity via Push-To-Start and Update token questions.
We are implementing starting an activity via Push-To-Start. For the most part it works great, however we have run into a few edge cases. Currently, we send the "start activity" push notification and it creates the Activity as expected. If the app doesn't send an update token w/in a configured time, we assume the activity didn't start and try to start the activity again. Occasionally we get into a situation where there have been multiple activities started, but it should really only be one. Here is my theory: We store an auth token in the keychain for all REST endpoints if the phone has been restarted and not unlocked, the app doesn't have access to the auth token and fails to send the update token to our backend. Are there any best practices on how to manage PTS and UPDATE tokens? (updating these w/o authentication seems problematic)
Replies
0
Boosts
0
Views
74
Activity
13h
UIAlertController appears "shattered" on iOS 26
We are experiencing an issue with a few end users where the UIAlertController's UIView is rendered with a (for the lack of a better word) "shattered" effect (see attachments). It appears to be happening only occasionally which makes me think it's a bug with iOS 26 and/or hardware issue. I'm posting here hoping to get some type of guidance on a workaround or if this is already a known issue (I have not been able to find instances of this particular issue online). Has anyone experienced or seen others experience this issue? Does anyone know of a workaround or can confirm this is a bug with iOS 26? Thanks in advance.
Topic: UI Frameworks SubTopic: UIKit
Replies
1
Boosts
0
Views
50
Activity
17h
tvOS SwiftUI - Siri "On-Screen Actions" breaks lazy lists
Hey team, This is a weird one, when Siri + "On-Screen Actions" are enabled in the Apple TV settings (General Settings), LazyVStack experiences severe main-thread hangs and very high CPU usage. The issue only occurs when Siri + On-Screen Actions are enabled in Apple TV device settings (General Settings). Disabling On-Screen Actions completely resolves the issue. The issue has been verified on multiple Apple TV devices, running tvOS 26.3, 26.4 and 26.5. The behavior was not observed in Simulators, only on an actual device. This seems to be caused by some type of accessibility overlap with SwiftUI. Running the below code with "On-Screen Actions" enabled in the Siri settings will demonstrate a complete hang of the CPU at 100% struct TestData { let id = UUID() var title: String } struct TestView: View { @State private var test: [TestData] = [] var body: some View { ScrollView { LazyVStack { ForEach(self.test, id: \.id) { data in Button { } label: { Text(data.title) } } } } .task { var arr: [TestData] = [] for _ in 0..<30000 { let data = TestData(title: "Title") arr.append(data) } self.test = arr } } } Already submited a bug report FB22758928
Replies
0
Boosts
0
Views
101
Activity
1d
hidesBottomBarWhenPushed in iOS 26
It appears that hidesBottomBarWhenPushed no longer works in iOS 26 Beta 1. Is it supposed to work, is it going away or is there a alternate behavior we should be using?
Topic: UI Frameworks SubTopic: UIKit
Replies
20
Boosts
3
Views
3k
Activity
1d
App crashes in CGFontStrikeRelease
This crash has been troubling us for a long time. We have this crash report in every release of our App, but can't reproduce it. Here is part of the crash info: Incident Identifier: xxxx Hardware Model: iPhone13,3 Process: MyApp [34550] Path: /private/var/containers/Bundle/Application/xxxx/MyApp.app/MyApp Identifier: xxx.xxx Version: xxx (296) AppStoreTools: 15F31c AppVariant: 1:iPhone13,3:15 Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Coalition: xxx.xxx [466] Date/Time: 2024-05-19 13:59:10.9716 +0800 Launch Time: 2024-05-19 12:18:24.8753 +0800 OS Version: iPhone OS 16.6.1 (20G81) Release Type: User Baseband Version: 3.80.01 Report Version: 104 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x322e323400000000 -> 0x0000003400000000 (possible pointer authentication failure) Exception Codes: 0x0000000000000001, 0x322e323400000000 VM Region Info: 0x3400000000 is in 0x1000000000-0x7000000000; bytes after start: 154618822656 bytes before end: 257698037759 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL commpage (reserved) fc0000000-1000000000 [ 1.0G] ---/--- SM=NUL ...(unallocated) ---> GPU Carveout (reserved) 1000000000-7000000000 [384.0G] ---/--- SM=NUL ...(unallocated) UNUSED SPACE AT END Triggered by Thread: 0 Thread 0 name: Thread 0 Crashed: 0 CoreGraphics 0x00000001bd1d0780 CGFontStrikeRelease + 76 (CGFontStrike.c:126) 1 CoreGraphics 0x00000001bd1dd0cc CGGlyphBuilderUnlockBitmaps + 476 (CGGlyphBuilder.cc:113) 2 CoreGraphics 0x00000001bd1eb8c8 render_glyphs + 412 (RIPContextDrawGlyphs.c:127) 3 CoreGraphics 0x00000001bd202ea4 draw_glyph_bitmaps + 1132 (RIPContextDrawGlyphs.c:210) 4 CoreGraphics 0x00000001bd21a0ec ripc_DrawGlyphs + 1320 (RIPContextDrawGlyphs.c:558) 5 CoreGraphics 0x00000001bd1d26d8 CG::DisplayList::executeEntries(std::__1::__wrap_iter<std::__1::unique_ptr<CG::DisplayListEntry const, std::__1::default_delete<CG::DisplayListEntry const> >*>, std::__1::__wrap_iter<std::__1::uniq... + 5852 (DisplayList.cpp:1657) 6 CoreGraphics 0x00000001bd1c86a8 CGDisplayListDrawInContextDelegate + 268 (DisplayList.cpp:2151) 7 QuartzCore 0x00000001bcc797d4 CABackingStoreUpdate_ + 468 (CABackingStore.cpp:1388) 8 QuartzCore 0x00000001bccf0c34 invocation function for block in CA::Layer::display_() + 64 (CALayer.mm:9699) 9 QuartzCore 0x00000001bcc78d54 -[CALayer _display] + 1720 (CALayer.mm:9732) 10 QuartzCore 0x00000001bcc785b4 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 412 (CALayer.mm:2521) 11 QuartzCore 0x00000001bcc898d8 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 444 (CAContextInternal.mm:2714) 12 QuartzCore 0x00000001bccb8e80 CA::Transaction::commit() + 648 (CATransactionInternal.mm:432) 13 QuartzCore 0x00000001bcca2df0 CA::Transaction::flush_as_runloop_observer(bool) + 88 (CATransactionInternal.mm:940) 14 UIKitCore 0x00000001bdca34d0 _UIApplicationFlushCATransaction + 52 (UIApplication.m:3286) 15 UIKitCore 0x00000001bddf3d94 _UIUpdateSequenceRun + 84 (_UIUpdateSequence.mm:114) 16 UIKitCore 0x00000001be458894 schedulerStepScheduledMainSection + 144 (_UIUpdateScheduler.m:1015) 17 UIKitCore 0x00000001be457df0 runloopSourceCallback + 92 (_UIUpdateScheduler.m:1164) 18 CoreFoundation 0x00000001bb80a128 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957) 19 CoreFoundation 0x00000001bb8167b4 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001) 20 CoreFoundation 0x00000001bb79b5e8 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038) 21 CoreFoundation 0x00000001bb7b10d4 __CFRunLoopRun + 828 (CFRunLoop.c:2953) 22 CoreFoundation 0x00000001bb7b63ec CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418) 23 GraphicsServices 0x00000001f6ccc35c GSEventRunModal + 164 (GSEvent.c:2196) 24 UIKitCore 0x00000001bdb42f58 -[UIApplication _run] + 888 (UIApplication.m:3782) 25 UIKitCore 0x00000001bdb42bbc UIApplicationMain + 340 (UIApplication.m:5372) 26 MyApp 0x000000010468f978 main + 80 (main.m:15) 27 dyld 0x00000001dace8dec start + 2220 (dyldMain.cpp:1165) Thread 1 name: Thread 1: 0 libsystem_kernel.dylib 0x00000001fa6f6ca4 mach_msg2_trap + 8 (:-1) 1 libsystem_kernel.dylib 0x00000001fa709b74 mach_msg2_internal + 80 (mach_msg.c:201) 2 libsystem_kernel.dylib 0x00000001fa709e4c mach_msg_overwrite + 540 (mach_msg.c:0) 3 libsystem_kernel.dylib 0x00000001fa6f71e8 mach_msg + 24 (mach_msg.c:323) 4 CoreFoundation 0x00000001bb7b0024 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2622) 5 CoreFoundation 0x00000001bb7b1250 __CFRunLoopRun + 1208 (CFRunLoop.c:3005) 6 CoreFoundation 0x00000001bb7b63ec CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418) 7 Foundation 0x00000001b5a2efb4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373) 8 Foundation 0x00000001b5a2ee9c -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:420) 9 UIKitCore 0x00000001bdc75cc8 -[UIEventFetcher threadMain] + 416 (UIEventFetcher.m:1376) 10 Foundation 0x00000001b5a48524 __NSThread__start__ + 716 (NSThread.m:963) 11 libsystem_pthread.dylib 0x000000021b5766b8 _pthread_start + 148 (pthread.c:893) 12 libsystem_pthread.dylib 0x000000021b575b88 thread_start + 8 (:-1) Thread 2: 0 libsystem_kernel.dylib 0x00000001fa6f7164 __semwait_signal + 8 (:-1) 1 libsystem_c.dylib 0x00000001c2c50888 nanosleep + 220 (nanosleep.c:104) 2 libsystem_c.dylib 0x00000001c2c61b1c sleep + 52 (sleep.c:62) 3 MyApp 0x00000001075ccb14 -[UTDCacheManager synchronizeData] + 104 (UTDCacheManager.m:133) 4 Foundation 0x00000001b5a48524 __NSThread__start__ + 716 (NSThread.m:963) 5 libsystem_pthread.dylib 0x000000021b5766b8 _pthread_start + 148 (pthread.c:893) 6 libsystem_pthread.dylib 0x000000021b575b88 thread_start + 8 (:-1)
Replies
4
Boosts
0
Views
1k
Activity
1d
SwiftData in-memory ModelContainer causes DefaultStore validation errors on consecutive xcodebuild test runs
When running parallel Swift Testing tests that each create their own in-memory ModelContainer, the first xcodebuild test run succeeds but all subsequent runs fail with DefaultStore save failed validation errors — unless DerivedData is deleted between runs. Setup Each test suite creates an isolated in-memory container with a unique name: ModelConfiguration(UUID().uuidString, schema: schema, isStoredInMemoryOnly: true) The @Model class has non-optional properties (e.g. var v: String, var entityDicMoveNr: Int) that are always set in init. Symptoms on second run SwiftData.DefaultStore save failed with error: Error Domain=NSCocoaErrorDomain Code=1560 "Multiple validation errors occurred." NSValidationErrorKey=v, NSValidationErrorValue=null NSValidationErrorKey=entityDicMoveNr, NSValidationErrorValue=null NSValidationErrorKey=historyBackup, NSValidationErrorValue=null The errors appear before test code executes — during SwiftData's internal DefaultStore auto-save. Properties that are always initialized in Swift show as nil in the Core Data layer. What we verified Each run uses a fresh xctest process (different PIDs) Container creation succeeds (no errors in our ModelContainer init) The @Model init always sets all fields — confirmed with debug prints Deleting DerivedData before each run fixes it (but forces a full rebuild) What didn't help Using ModelContext(container) instead of container.mainContext Setting autosaveEnabled = false on both mainContext and custom contexts Using /dev/null URL instead of isStoredInMemoryOnly: true build-for-testing + test-without-building Clearing only Logs/Test or TestResults subdirectories Why not run via swift test? We can't fall back to swift test because our project uses RealityKit custom components, which silently fail to decode in CLI swift test. So xcodebuild test is our only option, making the DerivedData workaround especially costly. Workaround Delete DerivedData before each xcodebuild test invocation. Environment macOS 15.5, Xcode 16.4, Swift Testing with @Suite @MainActor parallel test suites. Question Is there a way to fully isolate in-memory ModelContainer instances so that no metadata leaks between xcodebuild test runs without requiring a full DerivedData clean?
Replies
4
Boosts
0
Views
156
Activity
1d
SF Symbols .replace animation is partially missing
In SF Symbols 7, I'm observing a discrepancy between the .replace animation previewed in the SF Symbols app and the result when using the code template the app provides. Expected behavior: When previewing the .replace animation in the SF Symbols app (with Magic Replace preferred), the transition looks like: Actual behavior: When I implement the animation using the exact code template generated by the SF Symbols app, the result looks like: My code: struct PlaygroundSwiftUIView: View { @State var name = "folder.circle" var body: some View { Image(systemName: name) .font(.system(size: 60)) .contentTransition(.symbolEffect(.replace)) .onTapGesture { name = "tree" } } } #Preview { PlaygroundSwiftUIView() } The animation rendered in my app does not match the preview shown in the SF Symbols app. The drawOff animation is partially missing. Is there something missing from the code template, or is there an additional configuration step required to achieve the correct Replace effect? or is this a bug?
Replies
2
Boosts
0
Views
166
Activity
1d
SF Symbols Variable Color — "Draw" symbols show no effect in Default mode
I've noticed an inconsistency between how the SF Symbols app and SwiftUI code handle variable color for symbols that use the "Draw" animation mode. Background SF Symbols that support variable color fall into two categories based on their animation preference: Symbols suited for .symbolVariableValueMode(.color) — layers are highlighted/dimmed by color opacity Symbols suited for .symbolVariableValueMode(.draw) — layers are progressively drawn/erased When .symbolVariableValueMode is not set (i.e., the default mode), I expected the system to automatically choose the appropriate mode for each symbol. What SF Symbols app shows In the SF Symbols app, selecting thermometer.high, enabling variable color, and setting the value to 0.5 with "Default" mode selected produces a correct and expected result — the symbol renders identically to the explicit "Draw" mode. What SwiftUI code does In code, when symbolVariableValueMode is not specified (default), symbols from the "Draw" category receive no visual effect — they appear static, as if variable value is ignored entirely. // This works correctly Image(systemName: "thermometer.high") .symbolVariableValue(0.5) .symbolVariableValueMode(.draw) // This shows NO effect — expected to fall back to .draw, but doesn't Image(systemName: "thermometer.high") .symbolVariableValue(0.5) // no .symbolVariableValueMode set Symbols in the "Color" category appear unaffected — they render correctly with or without an explicit mode. Question / Bug? Is this a known limitation, or is the default mode in code intentionally different from what the SF Symbols app previews? If so, is there a programmatic way to query which symbolVariableValueMode a given symbol prefers at runtime, so I can set it explicitly without hardcoding per-symbol logic?
Replies
0
Boosts
0
Views
91
Activity
2d
SwiftUI + AppKit context menu wedges window-level mouse events when the menu's anchor view is deleted by the menu's own action
I'm on macOS 26.4 (SwiftUI + SwiftData + AppKit bridging). I have a SwiftUI canvas where each child view (a card) carries a per-card AppKit context menu via an NSViewRepresentable overlay (a small NSView subclass that overrides menu(for:) and returns an NSMenu whose items invoke a Swift closure). The closure for the "Delete" item removes the underlying model object. SwiftData mutates → SwiftUI re-emits the canvas → the card containing the menu's anchor NSView unmounts → that anchor NSView is removed from the AppKit view hierarchy. After this happens, the entire window's SwiftUI gestures stop receiving mouse events: pan, zoom, taps on a separate background Color view all go silent. The window's first responder ends up at the NSWindow itself. The wedge persists across switching to a sibling SwiftUI view in the same window (different SwiftData root), so the bad state is at the window/event-routing level, not in any one SwiftUI subtree. The wedge is reliably cleared by another right-click that successfully shows + dismisses any menu — strongly suggesting AppKit's menu/event-tracking cleanup is left in a half-finished state because the anchor view went away during the cleanup window. I've already verified: Switching from explicit NSMenu.popUpContextMenu(_:with:for:) to overriding menu(for:) does not change the behavior. Deferring the model deletion via DispatchQueue.main.async, asyncAfter (30 ms), or RunLoop.main.perform(inModes: [.default]) either doesn't help or only avoids the wedge if the delay is long enough to be perceptible (seconds), implying the cleanup window is event-driven, not time-driven. Triggering the same deletion from a SwiftUI Button (no AppKit menu involved) never wedges. My current understanding is that the standard AppKit pattern (e.g., NSTableView, NSOutlineView) attaches the context menu to a stable parent view, never to the per-row view itself, precisely so the menu's anchor outlives any single row's deletion. Restructuring my code so a single canvas-level AppKitContextMenuRegion returns the appropriate menu via hit-testing in menu(for:) should avoid the issue, but I'd like to confirm: Is the assumption that an NSMenu's anchor view must outlive the menu's tracking-end cleanup documented anywhere, or is it implicit? Is there a supported way to safely use a per-row anchor view that gets deleted by the menu's own action, or is the canvas-level / parent-level menu attachment the only correct pattern? 3. Are there any post-tracking notifications or APIs that guarantee AppKit's cleanup is complete before the anchor view is allowed to be torn down (so a per-row anchor could be made safe with the right ordering)? Thanks!
Replies
0
Boosts
0
Views
271
Activity
3d
Charts performance issue
Hi, I want to recreate a chart from Apple Health and I have code like this. When I scroll - especially the week and month charts, there are performance issues. If I remove .chartScrollPosition(x: $scrollChartPosition), it runs smoothly, but I need to know which part of the chart is currently displayed. Can you help me? import Charts import SwiftUI struct MacroChartView: View { var selectedRange: ChartRange var binnedPoints: [MacroBinPoint] @State private var scrollChartPosition: Date = .now var body: some View { VStack { Text("\(selectedRange.rangeLabel(for: scrollChartPosition))") Chart(binnedPoints) { point in BarMark( x: .value("Date", point.date, unit: selectedRange.binComponent), y: .value("Calories", point.calories) ) } .frame(height: 324) .chartXVisibleDomain(length: selectedRange.visibleDomainLength()) .chartScrollableAxes(.horizontal) .chartScrollPosition(x: $scrollChartPosition) .chartScrollTargetBehavior(.valueAligned(matching: selectedRange.scrollAlignmentComponents)) .chartXAxis { switch selectedRange { case .week: AxisMarks(values: .stride(by: .day)) { date in AxisGridLine() AxisTick() AxisValueLabel(format: .dateTime.weekday(.abbreviated)) } case .month: AxisMarks(values: .stride(by: .weekOfYear)) { date in AxisGridLine() AxisTick() AxisValueLabel(format: .dateTime.day()) } case .halfYear: AxisMarks(values: .stride(by: .month)) { date in AxisGridLine() AxisTick() AxisValueLabel(format: .dateTime.month(.abbreviated)) } case .year: AxisMarks(values: .stride(by: .month)) { date in AxisGridLine() AxisTick() AxisValueLabel(format: .dateTime.month(.abbreviated)) } } } } } } enum MeasurementHistoryMode { case macros case comparisons } enum MacroKindToDisplay { case protein, fat, carbs } enum MacrosDisplayMode: Equatable { case all case single(MacroKindToDisplay) } enum ChartRange: String, CaseIterable { case week = "T" case month = "M" case halfYear = "6M" case year = "R" var binComponent: Calendar.Component { switch self { case .week, .month: return .day case .halfYear: return .weekOfYear case .year: return .month } } var scrollAlignmentComponents: DateComponents { switch self { case .week: return DateComponents(hour: 0, minute: 0, second: 0) case .month: return DateComponents(hour: 0) case .halfYear: return DateComponents(weekday: 1) case .year: return DateComponents(day: 1) } } func visibleDomainLength() -> Int { switch self { case .week: return 7 * 24 * 60 * 60 case .month: return 31 * 24 * 60 * 60 case .halfYear: return 6 * 31 * 24 * 60 * 60 case .year: return 12 * 31 * 24 * 60 * 60 } } func start(for date: Date) -> Date { let cal = Calendar.current switch self { case .week, .month: return cal.startOfDay(for: date) case .halfYear: return cal.dateInterval(of: .weekOfYear, for: date)?.start ?? cal.startOfDay(for: date) case .year: return cal.dateInterval(of: .month, for: date)?.start ?? cal.startOfDay(for: date) } } func rangeLabel(for start: Date) -> String { let end = start.addingTimeInterval(TimeInterval(visibleDomainLength())) let f = DateFormatter() f.dateFormat = Calendar.current.isDate(start, inSameDayAs: end) ? "MMM d" : "MMM d" return Calendar.current.isDate(start, inSameDayAs: end) ? f.string(from: start) : "\(f.string(from: start)) – \(f.string(from: end))" } } struct MacrosPoint: Identifiable { var id: Date { date } let date: Date let calories: Double let proteinInGrams: Double let carbsInGrams: Double let fatInGrams: Double } struct MacroBinPoint: Identifiable { var id: Date { date } let date: Date let calories: Double let proteinKcal: Double let carbsKcal: Double let fatKcal: Double } func bin(points: [MacrosPoint], for period: ChartRange) -> [MacroBinPoint] { let grouped = Dictionary(grouping: points) { point in period.start(for: point.date) } let bins = grouped.map { (start, items) -> MacroBinPoint in var calories = items.reduce(0) { $0 + $1.calories } var proteinKcal = items.reduce(0) { $0 + $1.proteinInGrams * 4 } var carbsKcal = items.reduce(0) { $0 + $1.carbsInGrams * 4 } var fatKcal = items.reduce(0) { $0 + $1.fatInGrams * 9 } calories /= Double(items.count) proteinKcal /= Double(items.count) carbsKcal /= Double(items.count) fatKcal /= Double(items.count) return MacroBinPoint(date: start, calories: calories, proteinKcal: proteinKcal, carbsKcal: carbsKcal, fatKcal: fatKcal) } .sorted { $0.date < $1.date } return bins } struct ExampleData { static let macrosPoints: [MacrosPoint] = [ MacrosPoint(date: Date(timeIntervalSince1970: 1687949774), calories: 1895, proteinInGrams: 115, carbsInGrams: 192, fatInGrams: 72),... ]
Replies
2
Boosts
1
Views
482
Activity
3d
Programatically adding to a TextField and moving the TextSelection point in SwiftUI
Hi! I am trying to create a simple SwiftUI TextField, with an external button to add text to the field at the current insertion point (the cursor in the TextField). When I add the text, the cursor (I-Beam) remains at the original insertion point, so I want it to move over to the end of what I added. The trouble is, it sometimes moves further forward or to the end (visibly) but works as if it is still at the point I moved it to. This seems to possibly be due to emojis in the TextField (because, I assume, they are composed of more bytes). Further, sometimes the addition of the text can cause an emoji to appear unexpectedly, I assume because it is combining the bytes in an odd way. So moving the cursor seems to sometimes introduce weird behaviour. This comes from a much larger project, but I have distilled this down to the smallest example project I could. And I have a video to show how it behaves. Here's the main part of the code, and I'll attach an Xcode project: import SwiftUI struct ContentView: View { @State private var text: String = "abcdef🧁🧁🧁🧁ghijkl" @State private var selectedText: TextSelection? var body: some View { VStack { TextField("", text: $text, selection: $selectedText) .font(.title) Button("Add Z at Insertion Point in TextField") { // Get indices of any selection in the text field let from: String.Index, to: String.Index if let selectedText = selectedText { let indices = selectedText.indices switch indices { case .selection(let range): from = range.lowerBound to = range.upperBound case .multiSelection(let rangeSet): from = rangeSet.ranges.first!.lowerBound to = rangeSet.ranges.first!.upperBound default: from = self.text.endIndex to = self.text.endIndex } } else { from = self.text.endIndex to = self.text.endIndex } guard from <= to && from <= self.text.endIndex else { return } // Insert and update the cursor position self.text.replaceSubrange(from..<to, with: "Z") // Move cursor after the inserted character let newIndex = self.text.index(after: from) selectedText = TextSelection(insertionPoint: newIndex) } } .padding() } } STEPS TO REPRODUCE Run the app. Also view the video as it shows the steps. Put insertion point between c and d. Press the "Add Z" button. Note that Z is placed between c and d. This is great. Put insertion point between h and i. Press the "Add Z" button. Note that Z is placed between h and i. BUT, the insertion point I-beam moves to the end of the string. Press the "Add Z" button again. Z is added where you would have expected based on where the TextSelection insertion point was put, but the flashing I-Beam is still at the end. Press the "Add Z" button again. Same issue. insertion point is being shown at end, but to the button it is between Z and i. OF NOTE, if you use the keyboard and press delete, it deletes from end (where the I-beam is). Now put insertion point between the 4 cupcakes. Press "Add Z" two times. It behaves correctly. Press "Add Z" a third time. It adds a fairy emoji. So, any idea what I am doing wrong? I thought it might be an issue requiring me to update in a background thread, but I tried that, even delaying the update in the thread, but the issue remains. Thanks in advance. Here's a video: https://curmi.name/temp/SimpleTextField%20showing%20issues.mp4 And if it helps, here is the Xcode project: https://curmi.name/temp/SimpleTextfield.zip
Replies
0
Boosts
0
Views
204
Activity
3d
error: A NavigationLink is presenting a value of type “String” but there is no matching navigationDestination
please help, i am new to SWIFTUI getting an error: A NavigationLink is presenting a value of type “String” but there is no matching navigationDestination declaration visible from the location of the link. The link cannot be activated. struct debug_navigation_3: View { @State private var path = NavigationPath() @StateObject private var debug_Client_Lead_Data_ListVM = Debug_Client_Lead_Data_List_Model() var body: some View { NavigationStack(path:$path) { VStack { List(debug_Client_Lead_Data_ListVM.Debug_Client_Lead_Data_Rows, id: \.self) { curr_clientLeadRequest in NavigationLink(curr_clientLeadRequest.Client_Message, value: curr_clientLeadRequest.Client_Message) } } .navigationDestination(for:Debug_Client_Lead_Data.self) { curr_clientLeadRequest in debug_navigation_3_DetailView(rec_id: Int64(curr_clientLeadRequest.id)) } } .onAppear() { Task { await debug_Client_Lead_Data_ListVM.search(rec_id:Int64(0)) //bring all REST API } } } } // data model import Foundation struct Debug_Client_Lead_Data_Response: Decodable { let Debug_Client_Lead_Data_Rows: [Debug_Client_Lead_Data] private enum CodingKeys: String, CodingKey { case Debug_Client_Lead_Data_Rows = "rows" // root tag: REST API } } struct Debug_Client_Lead_Data: Decodable, Hashable, Identifiable { let id:Int32 let Client_Message: String private enum CodingKeys: String, CodingKey { case id = "id" case Client_Message = "Client_Message" } } //list view model import Foundation @MainActor class Debug_Client_Lead_Data_List_Model: ObservableObject { @Published var Debug_Client_Lead_Data_Rows: [Debug_Client_Lead_Data_ListViewModel] = [] func search(rec_id:Int64) async { do { let Debug_Client_Lead_Data_Rows = try await Webservice_debug_client_lead_data().getClientLeadRequestSummary(rec_id:rec_id) // '0' optional self.Debug_Client_Lead_Data_Rows = Debug_Client_Lead_Data_Rows.map(Debug_Client_Lead_Data_ListViewModel.init) } catch { print(error) } } } struct Debug_Client_Lead_Data_ListViewModel: Identifiable, Hashable { let debug_Client_Lead_Data: Debug_Client_Lead_Data var id:Int32 { debug_Client_Lead_Data.id } var Client_Message: String { debug_Client_Lead_Data.Client_Message } } //REST API import Foundation class Webservice_debug_client_lead_data { func getClientLeadRequestSummary(rec_id:Int64) async throws -> [Debug_Client_Lead_Data] { var components = URLComponents() components.scheme = Global_REST_API_URL_HTTP components.host = Global_REST_API_URL components.port = Global_REST_API_URL_port components.path = "/GetClientLeadRequest" components.queryItems = [ URLQueryItem(name: "rec_id", value: String(rec_id)) // Optional, pass '0' for all rows ] guard let url = components.url else { throw NetworkError.badURL } let (data, response) = try await URLSession.shared.data(from: url) guard (response as? HTTPURLResponse)?.statusCode == 200 else {throw NetworkError.badID } let Debug_Client_Lead_Data_Response = try? JSONDecoder().decode(Debug_Client_Lead_Data_Response.self, from: data) return Debug_Client_Lead_Data_Response?.Debug_Client_Lead_Data_Rows ?? [] } }
Topic: UI Frameworks SubTopic: SwiftUI
Replies
0
Boosts
0
Views
174
Activity
4d
setAlternateIconName system alert ignores CFBundleLocalizations and forces English in iOS 26.1+ (Unexpectedly triggers sceneWillResignActive)
Environment: Xcode Version: Xcode 26.3 Affected iOS Versions: iOS 26.1 and later Working iOS Versions: iOS 26.0 and earlier Tested Devices: iPhone 15 Pro (iOS 26.2) - ❌ Bug presents iPhone 17 (iOS 26.1) - ❌ Bug presents iPhone Air (iOS 26.0) - ✅ Works as expected iPhone 16 Pro Max (iOS 18.0) - ✅ Works as expected Description: We have identified a severe localization regression regarding the setAlternateIconName(_:completionHandler:) API starting from iOS 26.1. Our application is strictly restricted to support only Traditional Chinese (zh-TW / zh-Hant). We have correctly configured CFBundleLocalizations, CFBundleDevelopmentRegion, and explicitly set CFBundleAllowMixedLocalizations to YES in our Info.plist. In iOS 26.0 and earlier, when changing the app icon, the system alert correctly displays in Traditional Chinese. However, in iOS 26.1 and later, the alert unexpectedly falls back to English, completely ignoring the app's localization constraints and the user's preferred device language. Crucial Observation: We noticed a significant behavioral change: in iOS 26.1+, invoking setAlternateIconName forces the app to enter the sceneWillResignActive state before the alert appears. This behavior did not exist prior to iOS 26.1. This strongly suggests that the alert has been moved to an out-of-process overlay managed by SpringBoard. It appears that the system cache is failing to properly resolve the app's CFBundleLocalizations during this out-of-process presentation. Steps to Reproduce: Create an iOS application restricted to Traditional Chinese (zh-TW). Set CFBundleDevelopmentRegion to zh-Hant in Info.plist. Set the CFBundleLocalizations array to contain only zh-TW (or zh-Hant). Set CFBundleAllowMixedLocalizations to YES. Implement setAlternateIconName to trigger the app icon change. Run the app on a device running iOS 26.1 or later (ensure the device's system language is set to Traditional Chinese). Trigger the icon change action. Expected Result: The app should NOT trigger sceneWillResignActive (maintaining iOS 26.0 behavior); OR the out-of-process system alert must correctly read the Info.plist and display the prompt in Traditional Chinese. Actual Result: The app immediately triggers sceneWillResignActive and loses focus. The system overlay alert appears but ignores all Traditional Chinese settings, displaying an English interface instead. Any insights or workarounds from the engineering team would be highly appreciated. We'd like to know if this is a known SpringBoard rendering issue in iOS 26.1+. Thank you!
Replies
2
Boosts
0
Views
424
Activity
4d
Crash in PDFView / PDFPageAnalyzerV2
Hello. Some users of my app experience crashes that mention PDFKit. I managed to find out what specific PDF file caused the crash and created a sample that demonstrates the issue and created a bug report in Feedback Assistant (FB22409977). Unfortunately I didn't get any answer for over a month, hence I'm writing it here so others can see that this is a known issue. The crash repro sample is very simple, it's just a PDFView that opens a bundled PDF file upon application lanunch. To cause the crash it is only needed to zoom-in and move around the page that has a table. The crash happens when the system tries to do some sort of OCR. The original crash report came from iPhone 11 user running iOS 26.3.1. Recently another user with iPhone 16 Pro Max running 26.5 experienced the same crash. Thread 12 Queue : PDFKWit.PDFDocument.formFillingQueue (serial) #0 0x000000018d320bd8 in PageLayout::GetBoundsForRangeWithinLine () #1 0x000000018d320c88 in PageLayout::GetBoundsForTextRange () #2 0x000000018d393028 in CGPDFTaggedNodeCreateCopyWithStringRange () #3 0x000000018d316630 in invocation function for block in TaggedParser::InsertLinkAnnotationsIntoStructureTree(CGPDFTaggedNode*, CGPDFPage*, PageLayout&) () #4 0x000000018d104f00 in CGPDFPageEnumerateAnnotations () #5 0x000000018d106968 in CGPDFPageCopyRootTaggedNode () #6 0x000000018d106710 in CGPDFPageInsertTableDescriptions () #7 0x00000001957a65b8 in +[PDFPageAnalyzerV2 addTablesFromVisionDocument:documentImage:toPage:withBox:] () #8 0x00000001957a3030 in +[PDFPageAnalyzerV2 analyzePage:withBox:requestTypes:] () #9 0x000000019584c018 in __31-[PDFView visiblePagesChanged:]_block_invoke () When CG_PDF_VERBOSE env variable is set, "New text range needs to be within the original node's text range." warning is printed to console several times before the crash happens.
Replies
0
Boosts
0
Views
103
Activity
5d
MacCatalyst, UIScene and the green zoom/fullscreen button
Please show me where I’ve gone amiss in MacCatalyst and UIScenes with regard to the macOS green zoom/fullscreen button. Originally the MacCatalyst App used a secondary AppKit bundle for its NSWindow work, but at some point in time AppStore Connect complained about this secondary bundle which prevented new App uploads. To continue receiving green button notifications I switched to UINSWindow. That worked. Now that I’m forced to use UIScenes I’m in a pickle: a click on the green button forces an automatic jump to fullscreen, nothing I can do about it AFAIK. A poor, poor compromise would be to disable the green button but I have no idea how even to do that. I’d like my App to exist in two states, any suggestions? Thanks.
Replies
1
Boosts
0
Views
122
Activity
5d
Why doesn't .glassEffect tint render on a Menu in an iOS 26 toolbar?
This is what I am trying to achieve (from the Phone app, similar one is also in Photos) I have a standard SwiftUI Menu in a toolbar with a glass tint applied to indicate the filter is active: Menu { // …filter options } label: { Label("Filter", systemImage: "line.3.horizontal.decrease") } .glassEffect(.regular.tint(.accentColor).interactive()) The glass effect doesn't render at all, no tint. The button looks completely unstyled. If I switch the label from Label to Image, the glass renders, but as a stretched oblong pill. I have tried several other combinations too: Also in the Apple's version during hover (iPad) the highlight aligns with the tint itself (see second image above) rather than outside it like in example 3 from the list above: Is there a way to get a Menu's trigger inset tint to look as in the Phone app example?
Replies
0
Boosts
0
Views
46
Activity
5d
"any View cannot conform to View"
Hello, What is the solution to this problem, assuming that you are not supposed to use AnyView, which I hear over and over again? Given this protocol: protocol MyProtocol { associatedtype V: View var content: () -> V { get } } if I want to store a heterogenous collection of MyProtocol, let collection: [any MyProtocol], then the underlying V type of each is erased to any View, which (supposedly) does not conform to View. Is there no way to "unbox" the existential any View to get the underlying View back? That unboxing idea is something I heard in a few WWDC videos but it seems like it does not apply to View.
Topic: UI Frameworks SubTopic: SwiftUI
Replies
0
Boosts
0
Views
42
Activity
5d
Navigation Title and UIAlertViewController actions truncated/cut on iPhone 13/14/15 Pro Max with iOS 26.4/5 using Cyrillic localisation
Since iOS 26.4, we are observing an issue on iPhone 13 Pro Max, iPhone 14 Pro Max, and iPhone 15 Pro Max where text is truncated on first presentation when using Bulgarian (Cyrillic) localization. The issue affects: UINavigationBar title (both inline and large titles) UIAlertController action titles Behavior: On first presentation, the text is truncated/cut off. On subsequent presentations, the layout appears correct. Adding a zero-width space (\u{200B}) before the last character of the string prevents truncation. This appears to slightly increase the layout width calculation and avoids the issue. Has anyone else encountered this behavior or found a more appropriate workaround?
Replies
1
Boosts
0
Views
106
Activity
5d