Post

Replies

Boosts

Views

Activity

UIToolbar size in iOS26
In my UIKit app, in my view controller, I have a toolbar at the bottom of the screen and a UITextView, and I need to get the size of the toolbar to calculate the correct keyboard intersection, and change my text view layout so that the text doesn't get obscured when the keyboard is shown on screen. It's been working fine till now, but with iOS26, I am running into an issue, because the toolbar size is completely different. For this code: NSInteger offset = (self.navigationController.isToolbarHidden == NO)? (self.navigationController.toolbar.frame.size.height): 0; iOS18 returns '49' iOS26 returns ''812'. This obviously throws off the calculations for keyboard avoidance. Is there a way to overcome this, other than ignoring or hard-coding toolbar height?
Topic: UI Frameworks SubTopic: UIKit
1
0
192
3d
iPadOS: remove system actions from Menu Bar
Hi, I am setting up the iPadOS26 Menu Bar, and it comes with some existing menu items that don't make sense for my app. For example, under "File" menu, there are options for New Window, Duplicate, Move, Rename and Export that I would like to remove (which keeping the Close Window option). What's the best way to do this?
Topic: UI Frameworks SubTopic: UIKit
3
0
124
6d
iPadOS keyboard formatting options
Hi, When I have a UITextView displayed on screen and in focus, the iPad keyboard shows buttons to Bold, Italics and Underline text (since it supports attributed text), and also a 'formatting' button that allows the user to change the font, color and size of the text, as well as justify text and add numbered lists and bullet points. Is there any way to disable or remove this 'formatting' button? My app doesn't support saving these options (other than bold, italics and underline), so it confuses users to see this option. Thanks.
Topic: UI Frameworks SubTopic: UIKit
0
0
105
6d
Issue with iOS26 and hiding UITabBar
I have a strange issue for iOS26. I have a UITabBarController at the root view of the app, but on certain actions, I want to hide it temporarily, and then have some options where the user can press a button which display some options using UIAlertController. It used to work fine before, but with iOS26, when the UIAlertController is presented, the tab bar (which is hidden by setting the ‘frame’) suddenly pops back into view automatically, when I don't want it to. Here's an example that reproduces the issue: class TestTableViewController: UITableViewController { private var isEditMode: Bool = false override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Change", style: .plain, target: self, action: #selector(changeMode)) } @objc func changeMode() { print("change mode called") if isEditMode == false { isEditMode = true // hide tab bar setEditingBarVisible(true, animated: true) self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Action", style: .plain, target: self, action: #selector(showActionsList)) } else { isEditMode = false // show tab bar setEditingBarVisible(false, animated: true) self.navigationItem.rightBarButtonItem = nil } } @objc func showActionsList() { let alert = UIAlertController(title: "Action", message: "showing message", preferredStyle: .actionSheet) alert.addAction(UIAlertAction.init(title: "Cancel", style: .cancel, handler: nil)) self.present(alert, animated: true, completion: nil) } @objc func setEditingBarVisible(_ visible: Bool, animated: Bool) { guard let tabBar = tabBarController?.tabBar else { return } let performChanges = { // Slide the tab bar off/on screen by adjusting its frame’s y. // This is safe because UITabBar is frame-managed, not Auto Layout constrained. var frame = tabBar.frame let height = frame.size.height if visible { // push it down if not already if frame.origin.y < self.view.bounds.height { frame.origin.y = self.view.bounds.height + self.view.safeAreaInsets.bottom } // Give our content its full height back (remove bottom safe-area padding that tab bar created) self.additionalSafeAreaInsets.bottom = 0 } else { // bring it back to its normal spot frame.origin.y = self.view.bounds.height - height // Re-apply bottom safe-area so content clears the tab bar again self.additionalSafeAreaInsets.bottom = height } tabBar.frame = frame // Ensure layout updates during animation self.tabBarController?.view.layoutIfNeeded() self.view.layoutIfNeeded() } if animated { UIView.animate(withDuration: 0.28, delay: 0, options: [.curveEaseInOut]) { performChanges() } } else { performChanges() } } } I have a bar button called 'Change', and selecting it should hide/show the UITabBar at the bottom, and show/hide a different bar button called 'Action'. Selecting the 'Action' button shows an alert. With iOS26, with the tab bar moved out of view, when the 'Action' button is called, the alert shows but the tab bar automatically moves into view as well. Is this a known issue? Any workaround for it? I filed FB19954757 just in case.
Topic: UI Frameworks SubTopic: UIKit
0
0
129
1w
UITabBarController not allowing scroll content behind it
I am trying out iOS26 with my existing app. I have a UITabBarController which is set to the main window's rootViewController, and I setup my UITabBar viewControllers programmatically. The first tab's root view has a UITableView with 100s of rows. When I build and run with the new Xcode, the app has the iOS26 look, but the table view doesn't seem to scroll behind the tab bar. The tab bar seems to have a hard edge and the content doesn't show through behind that. I have tried setting up the UITabBarController with the UITab items from iOS18 as well, but that doesn't help either. If I build a new project using the Xcode template, with storyboards, it works as expected and table view content shows through the UITabBar. What could be causing this? Is there something I need to configure to get the correct effect in iOS26? -- Figure it out: I needed to pin the bottomAnchor of the view controller to view's bottomAnchor (not safeAreaLayoutGuide.bottomAnchor)
Topic: UI Frameworks SubTopic: UIKit
0
0
163
1w
UIMainMenuSystem - disable elements
Hi, I am trying to implement the UIMainMenuSystem for showing the menu bar in my iPad app in iOS26. I would like to be able to disable some elements when a particular UIViewController is displayed on the screen, and I can't figure out the best way to do this. I tried overriding the 'validateCommand' method in my view controller, but it doesn't seem to invoke the validation for menu items that are in the main menu. Any tips on how to do this?
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
50
3w
Swift Playground crashes
I'm trying to use the new #Playground feature in Xcode, but it keeps crashing in the canvas. I am testing on Xcode 26.0 beta 4, on both macOS 15 and macOS26 beta 4. How do I figure out what's going on? I also have a few SwiftUI previews in my project, which also crashes if I try to preview them. They're not in any active tab right now in Xcode. But the #Playground feature still doesn't work. I also don't get a crash when working on a #Playground in a different project. I've tried cleaning out Derived Data and restarting the Mac / Xcode, all with no avail. How do I track down what's causing this? Do previews and playground run on the same engine? System Integrity Protection: enabled Triggered by Thread: 0 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: Namespace OBJC, Code 1, Thread 0 Crashed: 0 libsystem_kernel.dylib 0x100634ad0 __abort_with_payload + 8 1 libsystem_kernel.dylib 0x100659dc0 abort_with_payload_wrapper_internal + 100 2 libsystem_kernel.dylib 0x100659d5c abort_with_reason + 28 3 libobjc.A.dylib 0x18009bd08 _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 112 4 libobjc.A.dylib 0x18009bc98 _objc_fatal(char const*, ...) + 28 5 libobjc.A.dylib 0x18008be14 lookUpImpOrForward + 580 6 libobjc.A.dylib 0x180072f00 _objc_msgSend_uncached + 64 7 ??? 0x340a44048 ??? 8 CJournal 0x1001c54c4 __debug_blank_executor_run_user_entry_point + 152 9 PreviewsInjection 0x241623bf4 0x2415ff000 + 150516 10 PreviewsInjection 0x24162481c 0x2415ff000 + 153628 11 PreviewsInjection 0x241624740 __previews_injection_run_user_entrypoint + 12 12 XOJITExecutor 0x25543ad48 __xojit_executor_run_program_wrapper + 1460 13 XOJITExecutor 0x25543725c 0x255435000 + 8796 14 PreviewsInjection 0x24162468c 0x2415ff000 + 153228 15 CJournal 0x1001c4c7c __debug_blank_executor_main + 996 16 ??? 0x1003e13d0 ??? 17 dyld 0x100218924 start + 6400
2
1
109
Jul ’25
Core Data stack in #Playground
I'm using the #Playground macro in Xcode 26.0, running on macOS 26.0. I can get the basics working, but I don't understand how it hooks into the rest of the app, like the App Delete or the Core Data stack. Do we have to create a new Core Data stack, like for SwiftUI Previews, or can it hook into the stack from the main app (if so, how)?
1
0
113
Jul ’25
CloudKit: shared records creatorUserRecordID and lastModifiedUserRecordID
Hi, I am testing a situation with shared CKRecords where the data in the CKRecord syncs fine, but the creatorUserRecordID.recordName and lastModifiedUserRecordID.recordName shows "defaultOwner" (which maps to the CKCurrentUserDefaultName constant) even though I made sure I edit the CKRecord value from a different iCloud account. In fact, on the CloudKit dashboard, it shows the correct user recordIDs in the metadata for the 'Created' and 'Modified' fields, but not in the CKRecord. I am mostly testing this on the iPhone simulator with the debugger attached. Is that a possible reason for this, or is there some other reason the lastModifiedUserRecordID is showing the value for 'CKCurrentUserDefaultName'? It would be pretty difficult to build in functionality to look up changes by a different userID if this is the case.
1
0
142
Jul ’25
Exceptions thrown with NSTextView and spell checker
I use NSTextView in my app, and I am getting a LOT of crashes when I’m running the app with the debugger attached, and it all points to this spell checker in NSTextView. The crash happens as soon as the textview shows the ‘word completion’ option. If I turn off the “Continuous Spell Checking” option, it works fine, and it doesn’t crash. The exception reason given is: __NSCFString * "NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds" This is what the stack trace looks like in Xcode: Thread 1 Queue : com.apple.main-thread (serial) #0 0x000000018335eb38 in objc_exception_throw () #1 0x0000000184e01910 in -[NSRLEArray objectAtIndex:effectiveRange:] () #2 0x0000000184e519a8 in -[NSMutableAttributedString addAttribute:value:range:] () #3 0x000000018818086c in -[NSText(NSTextAccessibilityPrivate) accessibilityAXAttributedStringForCharacterRange:parent:] () #4 0x0000000187f576b0 in -[NSAccessibilityAttributeAccessorInfo getParameterizedAttributeValue:forObject:withParameter:] () #5 0x0000000187f591a8 in ___NSAccessibilityEntryPointValueForAttributeWithParameter_block_invoke.799 () #6 0x0000000187f5458c in NSAccessibilityPerformEntryPointObject () #7 0x0000000187f56190 in NSAccessibilityEntryPointValueForAttributeWithParameter () #8 0x0000000187cb6a3c in CopyParameterizedAttributeValue () #9 0x00000002327057ac in ___lldb_unnamed_symbol4511 () #10 0x0000000232705854 in ___lldb_unnamed_symbol4512 () #11 0x000000018a5b3670 in _AXXMIGCopyParameterizedAttributeValue () #12 0x000000018a5d4894 in _XCopyParameterizedAttributeValue () #13 0x000000018a592ff8 in mshMIGPerform () #14 0x000000018382a250 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ () #15 0x000000018382a178 in __CFRunLoopDoSource1 () #16 0x0000000183828b78 in __CFRunLoopRun () #17 0x0000000183827c58 in CFRunLoopRunSpecific () #18 0x000000018f2bc27c in RunCurrentEventLoopInMode () #19 0x000000018f2bf4e8 in ReceiveNextEventCommon () #20 0x000000018f44a484 in _BlockUntilNextEventMatchingListInModeWithFilter () #21 0x000000018774fab4 in _DPSNextEvent () #22 0x00000001880ee5b0 in -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] () #23 0x00000001884b836c in -[NSCorrectionPanel _interceptEvents] () #24 0x00000001884b8f30 in -[NSCorrectionPanel showPanelAtRect:inView:primaryString:alternativeStrings:forType:completionHandler:] () #25 0x00000001880c91ec in -[NSSpellChecker showCorrectionIndicatorOfType:range:primaryString:alternativeStrings:forStringInRect:view:completionHandler:] () #26 0x00000001880ca0c0 in -[NSSpellChecker _showInlinePredictionForReplacingRange:markedRange:string:withString:view:client:lastReplacementRange:completeWordIndexes:resultDictionary:completionHandler:] () #27 0x00000001880cb26c in -[NSSpellChecker showCompletionForCandidate:selectedRange:offset:inString:rect:view:client:completionHandler:] () #28 0x0000000188303a94 in -[NSTextCheckingController handleCompletionFromCandidates:forSelectedRange:offset:inAnnotatedString:rect:view:] () #29 0x00000001882f9054 in -[NSTextCheckingController viewForRange:completionHandler:] () #30 0x00000001883041c8 in __60-[NSTextCheckingController handleCandidates:sequenceNumber:]_block_invoke () #31 0x000000018789105c in -[NSTextCheckingController annotatedSubstringForProposedRange:wrap:completionHandler:failureHandler:] () #32 0x0000000187890da4 in -[NSTextCheckingController annotatedSubstringForProposedRange:completionHandler:] () #33 0x00000001878927d4 in -[NSTextCheckingController annotatedSubstringForSelectedRangeWithCompletionHandler:] () #34 0x0000000188304134 in -[NSTextCheckingController handleCandidates:sequenceNumber:] () #35 0x00000001883067e0 in ___NSRunLoopTimerCreateWithHandler_block_invoke () #36 0x0000000183842e14 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ () #37 0x0000000183842ad4 in __CFRunLoopDoTimer () #38 0x0000000183842610 in __CFRunLoopDoTimers () #39 0x0000000183828a18 in __CFRunLoopRun () #40 0x0000000183827c58 in CFRunLoopRunSpecific () #41 0x000000018f2bc27c in RunCurrentEventLoopInMode () #42 0x000000018f2bf4e8 in ReceiveNextEventCommon () #43 0x000000018f44a484 in _BlockUntilNextEventMatchingListInModeWithFilter () #44 0x000000018774fab4 in _DPSNextEvent () #45 0x00000001880ee5b0 in -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] () #46 0x0000000187742c64 in -[NSApplication run] () #47 0x000000018771935c in NSApplicationMain () If I run the debug version of the app without the debugger, it works fine as well. In fact, if I run the app without "All Objective-C Exceptions" breakpoint, it also works fine. So it seems like some framework issue, which is making it hard to run and test my app. What’s the reason for this, and is this an issue I should be worried about for when the app is available to my users?
Topic: UI Frameworks SubTopic: AppKit Tags:
3
0
48
Jun ’25
Crash with NSAttributedString in Core Data
I am trying out the new AttributedString binding with SwiftUI’s TextEditor in iOS26. I need to save this to a Core Data database. Core Data has no AttributedString type, so I set the type of the field to “Transformable”, give it a custom class of NSAttributedString, and set the transformer to NSSecureUnarchiveFromData When I try to save, I first convert the Swift AttributedString to NSAttributedString, and then save the context. Unfortunately I get this error when saving the context, and the save isn't persisted: CoreData: error: SQLCore dispatchRequest: exception handling request: <NSSQLSaveChangesRequestContext: 0x600003721140> , <shared NSSecureUnarchiveFromData transformer> threw while encoding a value. with userInfo of (null) Here's the code that tries to save the attributed string: struct AttributedDetailView: View { @ObservedObject var item: Item @State private var notesText = AttributedString() var body: some View { VStack { TextEditor(text: $notesText) .padding() .onChange(of: notesText) { item.attributedString = NSAttributedString(notesText) } } .onAppear { if let nsattributed = item.attributedString { notesText = AttributedString(nsattributed) } else { notesText = "" } } .task { item.attributedString = NSAttributedString(notesText) do { try item.managedObjectContext?.save() } catch { print("core data save error = \(error)") } } } }
2
0
77
Jun ’25
Core Spotlight searching only for title
I just adding a way to donate my app's data to Core Spotlight using CSSearchableIndex, but I'm finding that spotlight is only searching for the title of the CSSearchableItem I create. I know the index is working, because it always finds the item through the title property, but nothing else. This is how I'm creating the CSSearchableItem: - (CSSearchableItem *) createSearchableItem { CSSearchableItemAttributeSet* attributeSet = [[CSSearchableItemAttributeSet alloc] initWithContentType: UTTypeText]; attributeSet.title = [self titleForIndex]; attributeSet.displayName = [self titleForIndex]; attributeSet.contentDescription = [self contentDescriptionForIndex]; attributeSet.thumbnailData = [self thumbnailDataForIndex]; attributeSet.textContent = [self contentDescriptionForIndex]; CSSearchableItem *item = [[CSSearchableItem alloc] initWithUniqueIdentifier: [self referenceURLString] domainIdentifier:@"com.cjournal.cjournal-Logs" attributeSet:attributeSet]; item.expirationDate = [NSDate distantFuture]; return item; } There's a lot of confusing tips around which say specifying the 'textContent' should work, and/or setting the displayName is essential, but none of these are working. Is there something I'm missing with my setup? Thanks.
0
0
75
Jun ’25
Crash with NSAttributedString in Core Data
I am trying out the new AttributedString binding with SwiftUI’s TextEditor in iOS26. I need to save this to a Core Data database. Core Data has no AttributedString type, so I set the type of the field to “Transformable”, give it a custom class of NSAttributedString, and set the transformer to NSSecureUnarchiveFromData When I try to save, I first convert the Swift AttributedString to NSAttributedString, and then save the context. Unfortunately I get this error when saving the context, and the save isn't persisted: CoreData: error: SQLCore dispatchRequest: exception handling request: <NSSQLSaveChangesRequestContext: 0x600003721140> , <shared NSSecureUnarchiveFromData transformer> threw while encoding a value. with userInfo of (null) Here's the code that tries to save the attributed string: struct AttributedDetailView: View { @ObservedObject var item: Item @State private var notesText = AttributedString() var body: some View { VStack { TextEditor(text: $notesText) .padding() .onChange(of: notesText) { item.attributedString = NSAttributedString(notesText) } } .onAppear { if let nsattributed = item.attributedString { notesText = AttributedString(nsattributed) } else { notesText = "" } } .task { item.attributedString = NSAttributedString(notesText) do { try item.managedObjectContext?.save() } catch { print("core data save error = \(error)") } } } } This is the attribute setup in the Core Data model editor: Is there a workaround for this? I filed FB17943846 if someone can take a look. Thanks.
2
0
166
Jun ’25
FoundationModels and Core Data
Hi, I have an app that uses Core Data to store user information and display it in various views. I want to know if it's possible to easily integrate this setup with FoundationModels to make it easier for the user to query and manipulate the information, and if so, how would I go about it? Can the model be pointed to the database schema file and the SQLite file sitting in the user's app group container to parse out the information needed? And/or should the NSManagedObjects be made @Generable for better output? Any guidance about this would be useful.
1
0
164
Jun ’25