let searchTab = UISearchTab { tab in
UINavigationController(rootViewController: SearchViewController())
}
searchTab.automaticallyActivatesSearch = true
class SearchViewController: UIViewController {
private let searchController = UISearchController(searchResultsController: UIViewController())
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.searchController = searchController
}
}
With this setup when I launch the app and tap the search tab, the keyboard will not appear. Switching tabs and tapping search again works from then on. Am I doing something wrong here?
Video here: https://mastodon.social/@nicoreese/114983627125286299
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I would like my users to be able to switch to the search tab (in the sidebar) on iPad and immediately start typing. This is not possible. Calling becomeFirstResponder in viewDidLoad and viewWillAppear does not work. Only in viewDidAppear it does, but that comes with a significant delay between switching to the tab and the search field becoming active. Is there something else I can do?
FB19588765
let homeTab = UITab(
title: "Home",
image: UIImage(systemName: "house"),
identifier: "Home"
) { _ in
UINavigationController(rootViewController: ViewController())
}
let searchTab = UISearchTab { _ in
UINavigationController(rootViewController: SearchViewController())
}
let tabBarController = UITabBarController(tabs: [
homeTab, searchTab
])
tabBarController.mode = .tabSidebar
class SearchViewController: UIViewController {
let searchController = UISearchController(searchResultsController: nil)
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .systemBackground
self.title = "Search"
self.navigationItem.searchController = searchController
self.navigationItem.preferredSearchBarPlacement = .integratedCentered
searchController.becomeFirstResponder() // Does not work.
searchController.searchBar.becomeFirstResponder() // Does not work.
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
searchController.searchBar.becomeFirstResponder() // Does not work.
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
searchController.searchBar.becomeFirstResponder() // Works. But comes with a significant delay.
}
}
I want to display a grid of items in my widget similar to the systemLarge Shortcuts app widget. I use clipShape(.containerRelative) to get the widget corner radius, but items that do not touch a corner in any way do not get this treatment. This is even worse with the extra large widget. How can I apply the corner radius of the widget minus the padding across all items? It does not seem like the radius is exposed outside of that special shape.
In didFinishLaunchingWithOptions I have this setup for getting the token to send to my server for notifications. The issue is that the delegate callback didRegisterForRemoteNotificationsWithDeviceToken gets called twice when also initializing a CKSyncEngine object.
This confuses me. Is this expected behavior? Why is the delegate callback only called twice when both are called, but not at all when only using CKSyncEngine.
See code and comments below.
/// Calling just this triggers `didRegisterForRemoteNotificationsWithDeviceToken` once.
UIApplication.shared.registerForRemoteNotifications()
/// When triggering the above function plus initializing a CKSyncEngine, `didRegisterForRemoteNotificationsWithDeviceToken` gets called twice.
/// This somewhat make sense, because CloudKit likely also registers for remote notifications itself, but why is the delegate not triggered when *only* initializing CKSyncEngine and removing the `registerForRemoteNotifications` call above?
let syncManager = SyncManager()
/// Further more, if calling `registerForRemoteNotifications` with a delay instead of directly, the delegate is only called once, as expected. For some reason, the delegate is only triggered when two entities call `registerForRemoteNotifications` at the same time?
DispatchQueue.main.asyncAfter(deadline: .now() + 4) {
UIApplication.shared.registerForRemoteNotifications()
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
print("didRegisterForRemoteNotificationsWithDeviceToken")
}
I have this very simple PersistenceController setup. It's used in both the main app and widget target.
struct PersistenceController {
static let shared = PersistenceController()
@MainActor
static let preview: PersistenceController = {
let result = PersistenceController(inMemory: true)
let viewContext = result.container.viewContext
return result
}()
let container: NSPersistentContainer
/// The main context.
var context: NSManagedObjectContext {
return container.viewContext
}
init(inMemory: Bool = false) {
container = NSPersistentContainer(name: "Gamery")
if inMemory {
container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null")
} else {
do {
let storeURL = try URL.storeURL(forAppGroup: "XXXXXXXXXX", databaseName: "Gamery")
let storeDescription = NSPersistentStoreDescription(url: storeURL)
/// Enable history tracking for cloud syncing purposes.
storeDescription.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
print("### Persistent container location: \(storeURL)")
container.persistentStoreDescriptions = [storeDescription]
} catch {
print("Failed to retrieve store URL for app group: \(error)")
}
}
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
Crashlytics.crashlytics().record(error: error)
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
container.viewContext.automaticallyMergesChangesFromParent = true
container.viewContext.mergePolicy = NSMergePolicy.mergeByPropertyObjectTrump
#if !WIDGET
if !inMemory {
do {
try container.viewContext.setQueryGenerationFrom(.current)
} catch {
fatalError("###\(#function): Failed to pin viewContext to the current generation: \(error)")
}
}
PersistentHistoryToken.loadToken()
#endif
}
}
I regularly receive crash logs from the widget. I never experienced crashes myself and the widgets work fine.
GameryWidgetExtension/PersistenceController.swift:35:
Fatal error: Unresolved error Error Domain=NSCocoaErrorDomain Code=256 "The file “Gamery.sqlite” couldn’t be opened."
UserInfo={NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/B6A63FE1-ADDC-4A4C-A065-163507E991C6/Gamery.sqlite, NSSQLiteErrorDomain=23},
["NSSQLiteErrorDomain": 23, "NSFilePath": /private/var/mobile/Containers/Shared/AppGroup/B6A63FE1-ADDC-4A4C-A065-163507E991C6/Gamery.sqlite]
I have absolutely no idea what's going on here. Anyone who can help with this?
For over five years, this persistent issue has affected all platforms, and despite submitting numerous feedback reports, my concerns have remained unaddressed.
When utilizing a UIHostingController within a UINavigationController, the toolbar items and title defined in the SwiftUI view manifest with a substantial delay. This delay is particularly noticeable with the introduction of Liquid Glass, resulting in a jarring transition. Although I had nearly lost hope, the issue was resolved in iOS 26 beta 3 when the push occurs from within a UISplitViewController. However, the problem persists outside of this context.
Ultimately, this issue hinders my ability to develop high-quality applications and restricts my use of SwiftUI within my UIKit project for similar purposes. I sincerely hope that this issue can be resolved, enabling me to fully rely on SwiftUI in my project. Please prioritize this matter and make the necessary changes that were already made in UISplitViewController.
This feedback has all the details and a sample project.
FB14000542
Before the push:
During the push:
A second after the push finishes:
So many issues with the new sheet design, I don't think I can ship these. And it's both in UIKit and SwiftUI. Honestly these net sheets seem like a failure from start to finish and I don't believe it will get better for the initial release.
Toolbar buttons in medium detent size have very low contrast and look bad with their opaque appearance
During the transition from medium to large detent the whole sheet flickers and turns transparent for a split moment, creating a very jarring transition (video here: https://mastodon.social/@nicoreese/114938826906689965).
In the large detent the background is always white in light mode making the cells bleed into the background making them indistinguishable from it. I should be able to set a background color for the large detent which smoothly transitions to it. Like: glass in medium and system grouped background in large.
Any interaction with the medium detent sheet makes it scale up. Why? It's okay for single interactions but not for when the user taps something in it rapidly. There needs to be a way to disable this behavior.
In the medium detent List/UICollectionView rows are white in light mode or gray in dark mode. Especially in dark mode it looks very bad against the glass background. Those rows should probably be translucent to better fit the glass.
This needs serious fixing and fast.
FB18919680
FB18919657
FB18919600
FB18919549
FB18919496
FB18919630
At WWDC the scroll edge effect was presented as a variable blur combined with a soft gradient.
Since beta 4 the bottom scroll edge effect has no blur, the top bar sometimes has, but sometimes does not. Even in my own app I have two views with totally different results. This was not changed back in beta 5, so I assume this is not a bug but an intended change.
It's hard to design for such a moving target. Especially the missing bottom blur looks bad in a lot of places in my app and I'm debating not shipping the new design if this does not get resolved.
Is there any guidance how this effect is supposed to look now? At this point it just seems random and there's no way adjust the way it looks.
Phone: Top blur, bottom no blur
Settings: Top blur, bottom no blur
Notes: No blur at all
Music: No blur at all
My own app: No top blur
My own app: Top blur
When using UISearchController, scope buttons never appear. On iPadOS 18 this works fine. This is a showstopper bug for me and my app. Is there anything I can do about it?
Sample project is attached to feedback FB19587622.
When a UISearchController is placed inside a search tab, the scope buttons disappear when dismissing the search bar once. They never return. When using in any regular view controller container, like even another default tab, everything works fine. Is there something I can do to prevent this?
Video: https://mastodon.social/@nicoreese/115017696077771370
FB19587916
let homeTab = UITab(
title: "Home",
image: UIImage(systemName: "house"),
identifier: "Home"
) { _ in
UINavigationController(rootViewController: ViewController())
}
let searchTab = UISearchTab { _ in
UINavigationController(rootViewController: SearchViewController())
}
let tabBarController = UITabBarController(tabs: [
homeTab, searchTab
])
tabBarController.mode = .tabSidebar
class SearchViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .systemBackground
self.title = "Home"
let searchController = UISearchController(searchResultsController: nil)
searchController.searchBar.scopeButtonTitles = [
"Scope 1", "Scope 2"
]
searchController.searchBar.showsScopeBar = true
self.navigationItem.searchController = searchController
}
}
As of right now Icon Composer does not support creating app icons for visionOS and tvOS. It appears that only system apps can provide glass icons for those platforms. How should developers handle this? In extreme cases, the flat icon on those platforms will look wildly different from their glass counterparts.
From what I have seen visionOS and tvOS also do not apply any automatic treatment like on iOS where legacy icons get a glass effect.
So, third party app icons are just going to look out of place for (hopefully just) a year on those platforms? What is the recommended approach here? You could obviously fake the effect, but I feel like that would be worse.
This app icon features multiple layers with the blend mode set to Screen. iOS fails to render these despite looking perfectly fine in Icon Composer.
This is unacceptable. How can a designer build an icon if they can't rely on it being displayed like the preview on a device?
Filed as FB20052048 with the .icon file attached.
I'm running a project with these settings:
Default Actor Isolation: MainActor
Approachable Concurrency: Yes
Strict Concurrency Checking: Complete (this issue does not appear on the other two modes)
I receive a warning for this very simple use case. Can I actually fix anything about this or is this a case of Core Data not being entirely ready for this?
In reference to this, there was a workaround listed in the release notes of iOS 26 beta 5 (https://forums.swift.org/t/defaultisolation-mainactor-and-core-data-background-tasks/80569/22). Does this still apply as the only fix for this?
This is a simplified sample meant to run on a background context. The issue obviously goes away if this function would just run on the MainActor, then I can remove the perform block entirely.
class DataHandler {
func createItem() async {
let context = ...
await context.perform {
let newGame = Item(context: context)
/// Main actor-isolated property 'timestamp' can not be mutated from a Sendable closure
newGame.timestamp = Date.now
// ...
}
}
}
The complete use case would be more like this:
nonisolated
struct DataHandler {
@concurrent
func saveItem() async throws {
let context = await PersistenceController.shared.container.newBackgroundContext()
try await context.perform {
let newGame = Item(context: context)
newGame.timestamp = Date.now
try context.save()
}
}
}
In a UIKit-based project, I am attempting to integrate SwiftUI components. However, I encounter a persistent issue that hinders this integration.
This problem arises when pushing a SwiftUI view using UIHostingController and subsequently attempting to push a UIKit view controller using UIViewControllerRepresentable. Not only are the navigation items and title from the view controller disregarded, but more concerningly, my tab bar item title is set to nil. This renders it impossible for me to utilize SwiftUI within my application when I wish to present older UIKit view controllers from there.
This feedback has all the details and a sample project.
FB18956999
If you use UISceneDelegate's scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) to handle deep links (such as tapping a widget) you might run into an issue where this callback is called twice in the majority of cases.
If you push a view controller in response to this, you might end up with two pushed view controllers, if you do not mitigate this. This is exclusively an issue in iOS 26.0 and works as expected on iOS 18.
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
/// Add any widget to the home screen that uses the widgetURL modifier and tap them. Most of the time, openURLContexts() will get called twice.
/// If you run this project on iOS 18, it's *always* called once as expected.
print("openURLContexts \(URLContexts)")
}
Filed as FB20301454