Post

Replies

Boosts

Views

Activity

Apply custom fonts and colors to context menus
I am looking for a way to apply custom fonts and colors to context menus. I was able to change UIAction text color with the appearance manager:[[[UILabel class] appearanceWhenContainedInInstancesOfClasses:@[NSClassFromString(@"_UIContextMenuActionView")]] setTextColor:[UIColor greenColor]];But doing the same with the font does not work for me:[[[UILabel class] appearanceWhenContainedInInstancesOfClasses:@[NSClassFromString(@"_UIContextMenuActionView")]] setFont:[UIFont systemFontOfSize:30]];Similarly I cannot find a way to apply custom colors to the separator lines between UIActions or inline UIMenus.Is there a way to do this?Thanks.John
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
2.8k
Jan ’22
Apps rejected by App Store Connect if they contain Objective-C dictionaries defined with @{ @"key": @"value" } notation
I have been having trouble submitting my app to App Store Connect after building it with Xcode 13. I figured out that if a project contains this Objective-C code, App Store Connect will reject the app claiming it to use NSConstantDictionary as a private API: NSDictionary *myDictionary = @{@"a":@"b", @"c":@"d" }; NSLog(@"myDictionary: %@", myDictionary); I suspect the same issue exists for NSArray, at least when written with @[@"a", @"b"] notation. I filed FB9188387 regarding this. It seems like a pretty big problem. The FB includes a very simple sample project that gets rejected with the error above. The same project archived and submitted by Xcode 12.5 is accepted. The FB also contains a copy of this sample project with the two lines above commented out. That is accepted and processed by App Store Connect. John
0
0
1.2k
Jun ’21
Adding a Quick Note via Keyboard Shortcut
In earlier iPadOS betas I used the globe-Q keyboard shortcut to create a Quick Note. This no longer works for me, and I am not sure why. I do not see the keyboard shortcut listed if I hold down the globe key. Was the keyboard shortcut removed? Could the problem be that I have a Magic Keyboard (not designed specifically for an iPad) and have the function key mapped to the globe key? John
0
0
873
Sep ’21
Sign in with Apple questions
I am experimenting with Sign in with Apple and I have a few questions: First, regarding initial login: An ASAuthorizationAppleIDCredential includes both an authorizationCode so that the server can perform validation, and an identityToken with a signed JWT. If my server uses the authorizationCode to get credential information from appleid.apple.com, can I safely ignore the identityToken returned to the ASAuthorizationControllerDelegate? Or is there a reason I should verify that as well. If I do not verify the identityToken should I still set a nonce on the ASAuthorizationAppleIDRequest? Second, regarding notifications of Apple ID changes: It seems like getCredentialState, server-side token requests based on refresh tokens, and Server to Server notifications all serve the purpose of letting an app find out about changes to an Apple ID. Do I need to implement all three of these, or should any one be sufficient? Finally, I am not sure I need to know about Apple ID changes at all. Can I ignore all of these, and not worry about Apple ID status changes for users already logged into a device? I do not use the account name or email address at all, just the user identifier. Thanks. John
0
0
846
Apr ’22
iCloud Backup and SQLite Databases
Is there anything to watch out for or any steps one should take with regard to iCloud Backup and data in SQLite files? I am nervous about the fact that my sqlite databases each have a .sqlite file, a .sqlite-shm file, and a .sqlite-wal file – and wondering whether iCloud backup could end up restoring different versions of these files.
0
0
836
Apr ’22
Detecting Two-Finger Taps on iPad Inside Action Extension
I need to detect right-clicks / two-finger clicks with a trackpad or mouse on an iPad inside an action extension. I am finding that if I put a UITapGestureRecognizer in a view controller inside an action extension and set its allowedTouchTypes to UITouch.TouchType.indirectPointer, the gesture recognizer does not fire and none of the UIGestureRecognizerDelegate methods are ever called. The same code inside a standalone app works, just not in an action extension. This happens on both iPadOS 15.5 and iPadOS 16. I can filed FB10296917 regarding this, but it seems odd enough that I wanted to ask here whether I might be missing something.
0
0
807
Jun ’22
Invalid 'com.apple.application-identifier' entitlement value
I am trying to resolve this issue when uploading a Mac app with a share menu extension to App Store Connect: Invalid Provisioning Profile. The provisioning profile included in the bundle com.goldenhillsoftware.Unread2.SubscribeInUnreadExtension [com.goldenhillsoftware.Unread2.pkg/Payload/submitmac.app/Contents/PlugIns/ShareExtension.appex] is invalid. [Invalid 'com.apple.application-identifier' entitlement value.] For more information, visit the macOS Developer Portal. (ID: 01a4a823-62e9-4278-b3b5-46266b168a65) I understand that it wants a com.apple.application-identifier entitlement, but I do not understand how to provide that entitlement. I have tried putting it in the .entitlements file, but that has not worked. Is there a place where I can specify the com.apple.application-identifier entitlement associated with the App ID or when manually generating an entitlements file from the Developer Portal? I don't see it in the list of App Services associated with an App ID in the developer portal. I have seen other threads where folks seem to get past this by deleting currently downloaded provisioning profiles and using Automatically manage signing, but I have not had success with that either. Am I right that the value should be (TeamId).com.company.(AppName)? Should the entitlement include the extension itself ((TeamId).com.company.(AppName).(ExtensionName))? Thanks. John
2
0
2k
Feb ’23
Share Sheet with UIActivityItemsConfiguration
I am trying to address an issue with my app’s share sheet where, when the user sends a URL to either Apple Reminders or OmniFocus, the receiving app does not get a title. So I am updating my share sheet code to use UIActivityItemsConfiguration. I have this code: let title = "Golden Hill Software" let url = URL(string: "https://www.goldenhillsoftware.com/")! let itemProvider = NSItemProvider() itemProvider.registerObject(ofClass: URL.self, visibility: .all) { (handler) in handler(url, nil) return nil } let config = UIActivityItemsConfiguration(itemProviders: [itemProvider]) config.metadataProvider = { (key) in if key == .title || key == .messageBody { return title } else { return nil } } let viewController = UIActivityViewController(activityItemsConfiguration: config) self.present(viewController, animated: true) This works with some share sheet extensions. But when I choose the Ivory share extension, Ivory creates a post with a URL that starts with bplist…. When I choose the Open in Chrome action extension, Chrome says “Chrome cannot handle this link”. Can someone help me understand what I am doing wrong here? (edited)
Topic: UI Frameworks SubTopic: UIKit
0
0
19
3d
UIBarButtonItem and Liquid Glass
I am looking for a way to change the liquid glass background colors on UIBarButtonItems. Setting tintColor does what I want for a bar button item when it is both the default button and it is enabled. But it does not seem to do anything for disabled buttons or non-prominent buttons. Also, is there a way to apply such a change using a UINavigationBarAppearance or a UIBarButtonItemAppearance? If I cannot change this liquid glass color, I might need to disable liquid glass on these by setting hidesSharedBackground to true. Is there a way to do this globally within the app (without using UIDesignRequiresCompatibility), or with something like UINavigationBarAppearance or UIBarButtonItemAppearance? Thank you. John
Topic: UI Frameworks SubTopic: UIKit
2
0
129
2d
Dragging window on iPad from near the top
By default, a window on iPadOS 26 can be dragged by touching and dragging the top ~30 points of that window. If the window's root view controller is a UINavigationController with a navigation bar, the window can be dragged by touching and dragging anywhere in that navigation bar. In Apple Calendar, I can drag a window anywhere above the grid of weeks and days. I have an app with a custom navigation controller. My navigation controller is not a subclass of UINavigationController. How can I define what portion of the window should let the user drag that window across the screen on iPad?
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
123
Aug ’25
Trying to use UIScrollEdgeElementContainerInteraction
I have a UIKit app with a custom navigation controller. I want my view title to go up into the navigation bar when the user scrolls down the screen. It looks like UIScrollEdgeElementContainerInteraction should do what I want, but I am having trouble using it. Below is a sample, where a header view represents a title. I added the interaction to the header view, but it seems to have no effect. Am I missing a step? Perhaps I misunderstand what this is supposed to do, or perhaps I do not understand the preconditions to make this work. I am hoping someone can tell me what I am doing wrong, or point me to some working sample code. Thank you. John class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { var headerView: UIVisualEffectView! var tableView: UITableView! var interaction: UIScrollEdgeElementContainerInteraction! override func viewDidLoad() { super.viewDidLoad() self.tableView = UITableView() self.tableView.translatesAutoresizingMaskIntoConstraints = false self.tableView.topEdgeEffect.style = .soft self.tableView.delegate = self self.tableView.dataSource = self self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") self.view.addSubview(self.tableView) self.view.addConstraints([ self.tableView.topAnchor.constraint(equalTo: self.view.topAnchor), self.tableView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), self.tableView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), self.tableView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor), ]) self.headerView = UIVisualEffectView(effect: UIGlassEffect(style: .regular)) self.headerView.translatesAutoresizingMaskIntoConstraints = false self.headerView.backgroundColor = .green self.view.addSubview(self.headerView) self.view.addConstraints([ self.headerView.topAnchor.constraint(equalTo: self.view.topAnchor), self.headerView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), self.headerView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), self.headerView.heightAnchor.constraint(equalToConstant: 100.0), ]) let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false label.text = "my text" self.headerView.contentView.addSubview(label) self.headerView.contentView.addConstraints([ label.centerXAnchor.constraint(equalTo: self.headerView.contentView.centerXAnchor), label.centerYAnchor.constraint(equalTo: self.headerView.contentView.centerYAnchor), ]) self.interaction = UIScrollEdgeElementContainerInteraction() self.interaction.scrollView = self.tableView self.interaction.edge = .top self.headerView.addInteraction(self.interaction) } func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 100 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = self.tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) cell.textLabel?.text = "row \(indexPath.row + 1)" return cell } }
Topic: UI Frameworks SubTopic: UIKit Tags:
8
0
257
Oct ’25
Problems compiling xcframeworks using Carthage with the latest Xcode beta
I use Carthage to build a set of dependencies. I generate .xcframework files with code for both macOS and iOS. This works through Xcode 26 beta 4. With Xcode 26 beta 5, the resulting .xcframework files seem to have code only for iOS, not macOS. Each framework has a ios-arm64 directory and a ios-arm64_x86_64-simulator directory, but no macos-arm64_x86_64 directory. This is affecting 3 of my 7 cross-platform dependencies that I compile with Carthage. What those 3 seem to have in common is that each has one target and scheme for the shared library – instead of one for iOS and another for macOS. I may have to create a second scheme and target in each of these dependencies, or move to SPM. But I am wondering if anyone has another suggestion. Thank you. John
5
0
123
Aug ’25
Registering custom fonts from a framework in a widget extension
I want a widget to use the same custom fonts that the containing app uses. I do not want multiple copies of the font files in the app bundle. I put the font files into a framework shared by the app and the widget extension. I have code to register the fonts from the framework bundle using CTFontManagerRegisterGraphicsFont. That works from the app, but it does not work from the widget extension because it requires UIKit. (At least I think that's why it doesn't seem to work from my widget extension.) Widgets cannot run UIKit code. Is there a way to programmatically register the fonts in a widget? If not is there a way I can make a UIAppFonts Info.plist entry point to a framework?
6
1
6.4k
May ’23
Typing tab to navigate to a TextField in a List
I have a List that can contain TextField views on macOS. I want tabbing between the TextField views inside the List to work the way it does with TextField views that are not inside a List. But pressing the tab key to navigate to a TextField inside a List just does not seem to work. I tried attaching a focusable(false) modifier to the List and a focusable(true) modifier to the TextField views. Is there a trick to this? var body: some View { TextField("Title:", text: $title, prompt: Text("Title")) List { TextField("Title 2:", text: $title2, prompt: Text("Title 2")) TextField("Title 3:", text: $title3, prompt: Text("Title 3")) } }
0
1
781
Feb ’23