Is there any way to add a toolbar title menu in macCatalyst? I've found 'toolbarTitleMenu(content:)' but that's SwiftUI.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have created a widget and added a button in its body like this: Button("Tap me: ", intent: TaskIntent()).
If I compile the TaskIntent in both the app and the widget, when tapping the button, it open the app and that's all, 'perform' is not called at all.
If I compile the TaskIntent only in the widget, when tapping the button, it does nothing, 'perform' is not called either.
Is there any special sauce needed to run the 'perform' of the AppIntent attach to the button?
I'm trying to upload an app to AppStoreConnect but Xcode (15.0 release not beta) crashes while creating the IPA - I think it's at this step, as it happens very fast. The agreements are all accepted, I don't know what else should I do ??
Here's the log:
-------------------------------------
Process: Xcode [2147]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 15.0 (22265)
Build Info: IDEApplication-22265000000000000~3 (15A240d)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2023-09-24 11:08:28.8476 +0300
OS Version: macOS 13.5.2 (22G91)
Report Version: 12
Anonymous UUID: AC134C1E-4270-BC50-46BA-0FC5F300594C
Time Awake Since Boot: 590 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: archive info plist lock
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process: Xcode [2147]
Application Specific Information:
abort() called
com.apple.main-thread
Application Specific Signatures:
NSInvalidArgumentException
Application Specific Backtrace 0:
0 CoreFoundation 0x00000001a3543154 __exceptionPreprocess + 176
1 DVTFoundation 0x0000000102713e30 DVTFailureHintExceptionPreprocessor + 388
2 libobjc.A.dylib 0x00000001a30624d4 objc_exception_throw + 60
3 CoreFoundation 0x00000001a362d9b8 -[__NSCFString characterAtIndex:].cold.1 + 0
4 CoreFoundation 0x00000001a363ac10 -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0
5 CoreFoundation 0x00000001a3456ae0 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 320
6 CoreFoundation 0x00000001a3456974 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 52
7 IDEFoundation 0x0000000108a55ac8 -[IDEArchiveDistributionRecord dictionaryRepresentation] + 296
8 IDEFoundation 0x0000000108a37180 __31-[IDEArchive setDistributions:]_block_invoke + 16
9 DVTFoundation 0x000000010270bb2c -[NSArray(DVTFoundationClassAdditions) dvt_arrayByApplyingBlock:] + 224
10 IDEFoundation 0x0000000108a37110 -[IDEArchive setDistributions:] + 84
11 Foundation 0x00000001a440ad94 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 604
12 Foundation 0x00000001a4434f00 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 64
13 Foundation 0x00000001a444e42c _NSSetObjectValueAndNotify + 284
14 IDEFoundation 0x0000000108a36f08 __36-[IDEArchive addDistribution:error:]_block_invoke + 156
15 libdispatch.dylib 0x00000001a323c400 _dispatch_client_callout + 20
16 libdispatch.dylib 0x00000001a324b97c _dispatch_lane_barrier_sync_invoke_and_complete + 56
17 DVTFoundation 0x0000000102758014 DVTDispatchBarrierSync + 148
18 DVTFoundation 0x00000001027342b4 -[DVTDispatchLock performLockedBlock:] + 60
19 IDEFoundation 0x0000000108a36d30 -[IDEArchive addDistribution:error:] + 200
20 IDEFoundation 0x00000001086dc2f0 __35-[IDEDistributionUploadStep upload]_block_invoke.115 + 116
21 DVTFoundation 0x0000000102757330 __DVT_CALLING_CLIENT_BLOCK__ + 16
22 DVTFoundation 0x0000000102757b08 __DVTSyncPerformBlock_block_invoke + 68
23 CoreFoundation 0x00000001a34ca1d4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 28
24 CoreFoundation 0x00000001a34ca0e8 __CFRunLoopDoBlocks + 364
25 CoreFoundation 0x00000001a34c958c __CFRunLoopRun + 2432
26 CoreFoundation 0x00000001a34c84b8 CFRunLoopRunSpecific + 612
27 HIToolbox 0x00000001acd1adf0 RunCurrentEventLoopInMode + 292
28 HIToolbox 0x00000001acd1ac2c ReceiveNextEventCommon + 648
29 HIToolbox 0x00000001acd1a984 _BlockUntilNextEventMatchingListInModeWithFilter + 76
30 AppKit 0x00000001a66ef97c _DPSNextEvent + 636
31 AppKit 0x00000001a66eeb18 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716
32 DVTKit 0x0000000102fd8a9c -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 300
33 AppKit 0x00000001a66e2f7c -[NSApplication run] + 464
34 DVTKit 0x0000000102fd7cbc -[DVTApplication run] + 60
35 AppKit 0x00000001a66ba3cc NSApplicationMain + 880
36 dyld 0x00000001a3093f28 start + 2236
Application Specific Backtrace 1:
0 CoreFoundation 0x00000001a3543154 __exceptionPreprocess + 176
1 DVTFoundation 0x0000000102713e30 DVTFailureHintExceptionPreprocessor + 388
2 libobjc.A.dylib 0x00000001a30624d4 objc_exception_throw + 60
3 CoreFoundation 0x00000001a362d9b8 -[__NSCFString characterAtIndex:].cold.1 + 0
4 CoreFoundation 0x00000001a363ac10 -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0
5 CoreFoundation 0x00000001a3456ae0 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 320
6 CoreFoundation 0x00000001a3456974 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 52
7 IDEFoundation 0x0000000108a55ac8 -[IDEArchiveDistributionRecord dictionaryRepresentation] + 296
8 IDEFoundation 0x0000000108a37180 __31-[IDEArchive setDistributions:]_block_invoke + 16
9 DVTFoundation 0x000000010270bb2c -[NSArray(DVTFoundationClassAdditions) dvt_arrayByApplyingBlock:] + 224
10 IDEFoundation 0x0000000108a37110 -[IDEArchive setDistributions:] + 84
11 Foundation 0x00000001a440ad94 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 604
12 Foundation 0x00000001a4434f00 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 64
13 Foundation 0x00000001a444e42c _NSSetObjectValueAndNotify + 284
14 IDEFoundation 0x0000000108a36f08 __36-[IDEArchive
All is fine in Xcode15, no LLDB errors whatsoever, but in Xcode16 I can't get any variable displayed in the console because of the following error:
error: type for self cannot be reconstructed: type for typename "$......." was not found (cached)
error: Couldn't realize Swift AST type of self. Hint: using `v` to directly inspect variables and fields may still work.
I've checked the output of swift-healthcheck and there are several messages like this:
SwiftASTContextForExpressions(module: "ROA", cu: "ROA+ViewLayer.swift")::LoadOneModule() -- Missing Swift module or Clang module found for "UIKit", "imported" via SwiftDWARFImporterDelegate. Hint: Register Swift modules with the linker using -add_ast_path.
I added -add_ast_path to the OTHER_LDFLAGS in the faulty module's build settings but no luck.
How can I debug my project in Xcode16?
How can I insert a UISearchBar in the middle of the shortcuts bar displayed above the keyboard on iPad?
You insert custom shortcuts in the shortcuts bar using 'someTextField.inputAssistantItem' with 'leadingBarButtonGroups' or 'trailingBarButtonGroups' properties, but it has no 'middleBarButtonGroups'.
If I add the search bar as 'inputAccessoryView', like 'someTextField.inputAccessoryView = UISearchBar()' it is added above the shortcuts bar.
I have a simple task, to measure the height of the overlapping area occupied by the keyboard in the current view. In the attached images, I use it to position a UITextView (red) above the keyboard, as a test.
The keyboard displays an inputAccessoryView (yellow) when editing a text view, but it’s also summoned by a UIFindInteraction, which shows a search bar above the keyboard. When measuring the keyboard, I need to account for either the accessory view or the search bar, basically, the total keyboard height including any extra views above it.
I use the usual algorithm: the keyboard frame from UIResponder.keyboardWillShowNotification (documented as being in screen coordinates) is converted to my view’s coordinates and intersected with the view’s bounds to get the overlapping height.
The first issue: in windowed mode, the keyboard frame reports a negative origin.x (e.g. -247), even though in screen coordinates it should start at 0. I display the raw frame in the navbar, as shown in the first screenshot.
I then suspected the frame might be in window coordinates on iOS 26, but repositioning the window a few times, and switching between find interaction keyboard and text editing keyboard, sometimes yields a positive origin.x instead, as if the keyboard starts from the middle of the screen!? (see the second screenshot).
And in some cases, the raw keyboard height is even 0, despite the keyboard clearly being visible and taking space (third screenshot).
Interestingly, the reported frame for the search keyboard is always consistent and in screen coordinates, but the default keyboard frame just doesn’t make sense.
Hi, I'm storing a string on a named UIPasteboard, and when reading it back, it comes as nil.
It works fine on iOS, but on MacCatalyst it always returns nil.
I store it like that:
let p = UIPasteboard(name: UIPasteboard.Name(rawValue: "aaa"), create: true)!
p.string = "some text"
print("hasStrings: \(p.hasStrings)")
// hasStrings: true
and I read it like that:
let p = UIPasteboard(name: UIPasteboard.Name(rawValue: "aaa"), create: false)!
print("hasStrings: \(p.hasStrings)")
// hasStrings: false
I'm running the two pieces of code from two different methods of a UIViewController. Say I store the string in 'viewWillAppear', and read it back in 'viewDidAppear'.
I get this error in Xcode 13.4. I set the deployment target to macOS 12.3 (latest available) but I still get this error.
Which version of macOS should I set as deployment target, to get rid of this error. I dont want to use 'if #available' because I have no alternative code path.
Which macOS version corresponds to Mac Catalyst 14.0?
I want to create an Welcome window for my app to show it at the first launch. While this window is visible, no other window/scene should be created.
The user should click a "Continue" button to be able to use the app, and create new scenes.
I defined two scenes, "Default Configuration" and "Welcome", and at the end of "application(_ :willFinishLaunchingWithOptions:)" I display the Welcome scene.
It works ok, but a default scene is also created at startup while the Welcome window/scene is visible.
I also tried using a macOS plugin. I defined the Welcome window in a xib in the plugin, and launched it from there. I did set "Visible at Launch", but that did not prevent a second scene to be created at startup, with the "Default Configuration".
How can I temporarily prevent new scenes to be created?
I'm working on an app displaying a few hundred custom labels. The custom label is modelled after UILabel. When I implement the custom label using TextKit, the app is using about 0.5 GB of memory. When I implement it using TextKit2, it takes about 1.2 GB.
Did anyone notice such a big difference in memory usage between TextKit and TextKit2?
For how long will TextKit be around before being deprecated?
I can't wrap my head around how to make two buttons the same width, without resorting to ugly hacks like GeometryReader. What is otherwise easy to implement using UIStackView or AutoLayout, becomes a nightmare in SwiftUI.
I tried the following, plus some other variations, but nothing works. What is the "official way" to make two vertically aligned buttons of the same width?
1)
VStack(alignment: .leading) {
Button("Short", action: {})
.frame(maxWidth: .infinity)
Button("Long title", action: {})
.frame(maxWidth: .infinity)
}
.frame(maxWidth: .infinity)
2)
VStack(alignment: .leading) {
Button(action: {}) {
Text("Short")
.frame(maxWidth: .infinity)
}
Button(action: {}) {
Text("Long title")
.frame(maxWidth: .infinity)
}
}
.frame(maxWidth: .infinity)
3)
VStack(alignment: .leading) {
Button(action: {}) {
Text("Short")
}.frame(maxWidth: .infinity)
Button(action: {}) {
Text("Long title")
}.frame(maxWidth: .infinity)
}
.frame(maxWidth: .infinity)
A method in my app now requires the override keyword when compiling with Xcode 26 beta / iOS 26 SDK, but if I add it, the current official Xcode 16.4 (iOS 18 SDK) throws a compile error. It's about 'toggleSidebar(_:)' in UIViewController.
The problem is:
Apple expects our apps to be ready for iOS 26 launch this fall, so I need to be actively developing and testing in the Xcode 26 beta now.
At the same time, I still need to submit updates to the App Store using the current official Xcode 16.4 until iOS 26 officially launches.
I'm using a single .xcodeproj file and can't keep manually adding/removing -DIOS_SDK_26_OR_LATER in Build Settings multiple times a day.
How to fix it and why isn't there a straightforward #if sdk(>=26.0) type of check for compile-time in Swift?
It's really frustrating to manage this override conflict.
I have several UIBarButtonItems in a navigation bar, and they get the default glass treatment in iOS26. All look ok excepting one, which is a UIBarButtonItem with a custom view, a plain UIButton. This one does not change the tint of the inner button's image to white/black like all the others, but it stays blue, like the regular tinted bar buttons pre iOS26.
I then built the inner UIButton starting from glass configuration, UIButton.Configuration.glass(), and it looks fine, see the 2nd pic. But if I send the app to background and bring it back, the inner button gets a border, such that the bar button now has 2 borders, and look out of place compared to the other bar buttons, see 3rd pic.
Is this a bug or a feature? How can I make custom-view bar buttons look like regular ones, without double border.
I read this thread https://developer.apple.com/forums/thread/788979 thoroughly, but I’m still confused regarding indexing files content.
I'm building a notes app where the notes are stored in files. A file can contain several notes (think paragraphs). Each note and the file document itself have a unique ID, all embedded in the file. So far so good, when the user opens a file in the app, I index all the notes in it using several CSSearchableItem, one for each note. Each CSSearchableItem gets a unique ID based on the note and file IDs.
The notes are then visible in Spotlight search and when the user taps one of them, the app is called with a Spotlight activity and I present the note.
I learned that I should create a CSImportExtension to allow the system to index files when app is not running. But the only method is update(_:forFileAt:), which allows to provide back to the system a single attributes set. How can I index the notes in a file as separate items?
What happens if an iCloud document file is edited remotely and the app is not running, or is editing another file? Does the system detect it and run CSImportExtension on the file?
All the notes and documents IDs are unique, and when the user duplicates the document file from within the app, new unique IDs are set in the duplicate file. But the user can also duplicate files outside the app, in which case the IDs remain the same in the duplicate file. How does Spotlight react to indexing two distinct items, with the same ID, but different 'contentURL'?
What if I index a note from a file, and set the current contentURL of the file, and then the user moves the file. Next time when I index a note from this file, Spotlight will get an item with the same uniqueIdentifier but with a different contentURL. Won't this confuse the system?
How to handle the case of deleted files: Unless a file is pending editing, the app doesn’t know it has been deleted, so it won’t remove the corresponding items from Spotlight.
I should mention that I use a Core Data database, which stores the mapping from file document IDs to file URLs, actually to bookmarks, so I can track the files even if the user renames or moves them.
I have a document based app, and if the user tries to open a document in the active/foreground scene, and that document is already open in another existing scene, I would like to activate that existing scene, and destroy the current foreground one.
I do it like that:
UIApplication.shared.requestSceneSessionActivation(existingSession, userActivity: activity, options: nil)
UIApplication.shared.requestSceneSessionDestruction(foregroundSession, options: nil)
When I run this code, the foreground scene is destroyed, but the activated one is not brought to foreground, it simply takes me to home screen.
On iOS14, it kinda works, the existing one is brought to foreground and splits the screen with the current foreground one for a split second, then the current one is destroyed, and the existing scene now takes all the screen. The intermediate split state is not visually nice but it does it's job. How can I achieve the same behaviour on iOS15?