I am using below code to change navigationBar bg colour, but the text is hidden in large title. It works fine in previous versions. Kindly refer below code and attached images.
Code:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.largeTitleDisplayMode = .always
let appearance = UINavigationBarAppearance()
appearance.backgroundColor = UIColor(
red: 0.101961,
green: 0.439216,
blue: 0.388235,
alpha: 1.0
)
navigationController?.navigationBar.standardAppearance = appearance
navigationController?.navigationBar.scrollEdgeAppearance = appearance
navigationController?.navigationBar.compactAppearance = appearance
}
Referenced images:
Posts under iOS tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hello
We use Datadog Mobile Vitals in our app and I'm trying to run some tools in Instruments for comparison. I'm not sure what tool should I use for some of those metrics:
Slow Renders
Description: With slow renders data, you can monitor which views are taking longer than 16ms or 60Hz to render.
Instruments equivalent: Hangs including microhangs (?)
CPU ticks per second
Description: RUM tracks CPU ticks per second for each view and the CPU utilization over the course of a session. The recommended range is <40 for good and <80 for moderate.
Instruments equivalent: CPU Profiler (?)
Frozen Frames -
Description: Frames that take longer than 700ms to render appear as stuck and unresponsive in your application. These are classified as frozen frames.
Instruments equivalent: Hangs with > 500ms (?)
Memory Utilization
Description: The amount of physical memory used by your application in bytes for each view, over the course of a session. The recommended range is <200MB for good and <400MB for moderate.
Instruments equivalent: Allocation (?)
Hi everyone,
I’m testing our SwiftUI app on both Xcode simulator and a real iPhone. On the simulator, everything looks clean and aligned. But when I run it on an actual iPhone (same build, iOS 18), the layout looks broken—fonts overlap, spacing is off, and elements are misaligned.
Both screenshots are from the exact same screen and time. First is simulator, second is iPhone.
Any idea why this difference happens? Is there something I should check in terms of rendering or layout settings?
Thanks in advance!
When I ran the following code on a physical iPhone device that supports Apple Intelligence, I encountered the following error log.
What does this internal error code mean?
Image generation failed with NSError in a different domain: Error Domain=ImagePlaygroundInternal.ImageGeneration.GenerationError Code=11 “(null)”, returning a generic error instead
let imageCreator = try await ImageCreator()
let style = imageCreator.availableStyles.first ?? .animation
let stream = imageCreator.images(for: [.text("cat")], style: style, limit: 1)
for try await result in stream { // error: ImagePlayground.ImageCreator.Error.creationFailed
_ = result.cgImage
}
Hi team, in iOS latest version 26.0, we are getting searchBar at bottom of the screen. Is there any option to change the position of the search? I need to move it to top as like in previous iOS version.
Hi team, while i am using below code, i am getting two searchBar at top & bottom. Kindly refer below code & attached image
Code:
override func viewDidLoad() {
super.viewDidLoad()
title = "Test Data"
setupSearchData()
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
self.setupSearchData()
}
}
func setupSearchData() {
navigationController?.navigationBar.prefersLargeTitles = false
let searchController = UISearchController(searchResultsController: nil)
navigationItem.searchController = searchController
}
It is working fine for other iOS versions. In my real useCase, i will refresh screen after API completed, then this issue occurred in my app.
when using CNContactViewController to present a contact detail info, the system CNContactViewController appear some UI issues.
On iOS 26, the Poster avatar overlaps with the title "Edit device contact"
On iPadOS26 with device(not simulator), when click 'Add photo', the CNContactViewController will auto dismiss, and the console output some error log:
below are the sample code:
AppDelegate.swift:
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
let window: UIWindow = UIWindow()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let vc = SplitViewController(primary: TabBarViewController(), secondary: ViewController())
window.rootViewController = vc
window.makeKeyAndVisible()
return true
}
}
SplitViewController.swift:
import UIKit
class SplitViewController: UISplitViewController {
init(primary: UIViewController, secondary: UIViewController) {
super.init(nibName: nil, bundle: nil)
preferredDisplayMode = .oneBesideSecondary
presentsWithGesture = false
delegate = self
viewControllers = [primary, secondary]
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
extension SplitViewController: UISplitViewControllerDelegate {
}
TabBarViewController.swift:
import UIKit
class BaseViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
}
class HomeViewController: BaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .red
navigationItem.title = "Home"
tabBarItem = UITabBarItem(title: "Home", image: UIImage(systemName: "house"), tag: 0)
}
}
class TabBarViewController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
let homeVC = HomeViewController()
let homeNav = UINavigationController(rootViewController: homeVC)
viewControllers = [homeNav]
ContactManager.shared.getAllContactIdentifiers()
}
}
ViewController.swift:
import UIKit
import Contacts
import ContactsUI
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemPink
let button = UIButton(frame: .zero)
button.backgroundColor = .orange
button.setTitle("show contact", for: .normal)
button.addTarget(self, action: #selector(showContactInfo), for: .touchUpInside)
button.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(button)
button.widthAnchor.constraint(equalToConstant: 200).isActive = true
button.heightAnchor.constraint(equalToConstant: 60).isActive = true
button.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
button.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
}
@objc private func showContactInfo() {
print("showContactInfo")
let identifier = ContactManager.shared.identifiers[0]
let currentContact = try? CNContactStore().unifiedContact(withIdentifier: identifier, keysToFetch: [CNContactViewController.descriptorForRequiredKeys()])
guard let contact: CNMutableContact = currentContact?.mutableCopy() as? CNMutableContact else {
return
}
let vc = CNContactViewController(forNewContact: contact)
vc.delegate = self
vc.title = "Edit Device Contact"
vc.allowsActions = false
vc.contactStore = CNContactStore()
let navigationVC: UINavigationController = UINavigationController(rootViewController: vc)
let appDelegate = UIApplication.shared.delegate as? AppDelegate
appDelegate?.window.rootViewController?.present(navigationVC, animated: true, completion: nil)
}
}
extension ViewController: CNContactViewControllerDelegate {
public func contactViewController(_ viewController: CNContactViewController, didCompleteWith contact: CNContact?) {
viewController.dismiss(animated: true, completion: nil)
}
}
We have a client with an application that includes a main application, NSEs (Notification Service Extensions) as an extension, and framework1 embedded within the main application.
The NSEs also require framework1 as a dependency. When we embedded framework1 within the NSEs, the App Store Connect validation failed with the following error:
Validation failed (409)
CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'com.test.xyz-LoggerUtility' under the iOS application 'test.app'. (ID: -----------)
We've observed an issue specifically when uploading to App Store Connect. We're able to debug and distribute the application without any problems using our enterprise distribution.
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
iOS
Frameworks
Bundle ID
App Store Connect
🧠 Feature Proposal: Share & Delete Option for iOS Share Sheet
🔍 Problem:
Many users frequently share temporary content like group photos, screenshots, or memes. After sharing, these files often stay in the Photos or Files app, leading to storage clutter.
💡 Solution:
Introduce a "Share & Delete" option inside the default iOS Share Sheet.
📲 How it works:
User selects photo(s)/file(s)
Opens the Share Sheet
Sees two options:
📤 Share (Standard)
🗑️ Share & Delete (New Option)
After sharing, iOS prompts:
"Do you want to delete these items from your device?"
✅ Benefits:
Reduces storage usage
Simplifies file cleanup
Speeds up user workflow
🔐 Safety Considerations:
Confirm deletion after successful share
Show “Undo” or move to Recently Deleted
📂 Attribution:
Originally proposed by Vicky on July 20, 2025.
More Details & UI Mockup:
👉 GitHub: https://github.com/vicky2940/share-and-delete-feature
👉 Android Tracker Submission: https://issuetracker.google.com/issues/433195069
Please consider this small but impactful UX enhancement for future iOS versions.
Experiencing 100% CPU usage in SwiftUI app using UIHostingController, only on iOS 26 beta and Xcode beta. Issue involves excessive view updates in AttributeGraph propagation.
Stack trace (main thread):
thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x00000001c38b9aa4 AttributeGraph`AG::Graph::propagate_dirty(AG::AttributeID) + 416
frame #1: 0x00000001d9a743ec SwiftUICore`SwiftUI.ObservationGraphMutation.apply() -> () + 656
frame #2: 0x00000001d97c0d4c SwiftUICore`function signature specialization <Arg[2] = [Closure Propagated : closure #1 () -> () in SwiftUI.(AsyncTransaction in _F9F204BD2F8DB167A76F17F3FB1B3335).apply() -> (), Argument Types : [SwiftUI.AsyncTransaction]> of generic specialization <()> of closure #1 () throws -> τ_0_0 in SwiftUI.withTransaction<τ_0_0>(SwiftUI.Transaction, () throws -> τ_0_0) throws -> τ_0_0 + 336
frame #3: 0x00000001d9a6ac80 SwiftUICore`merged function signature specialization <Arg[3] = Owned To Guaranteed> of function signature specialization <Arg[1] = [Closure Propagated : implicit closure #2 () -> () in implicit closure #1 @Sendable (SwiftUI.(AsyncTransaction in _F9F204BD2F8DB167A76F17F3FB1B3335)) -> () -> () in SwiftUI.GraphHost.flushTransactions() -> (), Argument Types : [SwiftUI.AsyncTransaction]> of SwiftUI.GraphHost.runTransaction(_: Swift.Optional<SwiftUI.Transaction>, do: () -> (), id: Swift.Optional<Swift.UInt32>) -> () + 196
frame #4: 0x00000001d9a52ab0 SwiftUICore`SwiftUI.GraphHost.flushTransactions() -> () + 176
frame #5: 0x00000001d8461aac SwiftUI`closure #1 (SwiftUI.GraphHost) -> () in SwiftUI._UIHostingView._renderForTest(interval: Swift.Double) -> () + 20
frame #6: 0x00000001d9bf3b38 SwiftUICore`partial apply forwarder for closure #1 (SwiftUI.ViewGraph) -> τ_1_0 in SwiftUI.ViewGraphRootValueUpdater.updateGraph<τ_0_0>(body: (SwiftUI.GraphHost) -> τ_1_0) -> τ_1_0 + 20
frame #7: 0x00000001d9e16dc4 SwiftUICore`SwiftUI.ViewGraphRootValueUpdater._updateViewGraph<τ_0_0>(body: (SwiftUI.ViewGraph) -> τ_1_0) -> Swift.Optional<τ_1_0> + 200
frame #8: 0x00000001d9e1546c SwiftUICore`SwiftUI.ViewGraphRootValueUpdater.updateGraph<τ_0_0>(body: (SwiftUI.GraphHost) -> τ_1_0) -> τ_1_0 + 136
frame #9: 0x00000001d8461a7c SwiftUI`closure #1 () -> () in closure #1 () -> () in closure #1 () -> () in SwiftUI._UIHostingView.beginTransaction() -> () + 144
frame #10: 0x00000001d846aed0 SwiftUI`partial apply forwarder for closure #1 () -> () in closure #1 () -> () in closure #1 () -> () in SwiftUI._UIHostingView.beginTransaction() -> () + 20
frame #11: 0x00000001d984f814 SwiftUICore`closure #1 () throws -> τ_0_0 in static SwiftUI.Update.ensure<τ_0_0>(() throws -> τ_0_0) throws -> τ_0_0 + 48
frame #12: 0x00000001d984e114 SwiftUICore`static SwiftUI.Update.ensure<τ_0_0>(() throws -> τ_0_0) throws -> τ_0_0 + 96
frame #13: 0x00000001d846aeac SwiftUI`partial apply forwarder for closure #1 () -> () in closure #1 () -> () in SwiftUI._UIHostingView.beginTransaction() -> () + 64
frame #14: 0x00000001851eab1c UIKitCore`___lldb_unnamed_symbol311742 + 20
* frame #15: 0x00000001852b56a8 UIKitCore`___lldb_unnamed_symbol315200 + 44
frame #16: 0x0000000185175120 UIKitCore`___lldb_unnamed_symbol308851 + 20
frame #17: 0x00000001d984e920 SwiftUICore`static SwiftUI.Update.dispatchImmediately<τ_0_0>(reason: Swift.Optional<SwiftUI.CustomEventTrace.ActionEventType.Reason>, _: () -> τ_0_0) -> τ_0_0 + 300
frame #18: 0x00000001d95a7428 SwiftUICore`static SwiftUI.ViewGraphHostUpdate.dispatchImmediately<τ_0_0>(() -> τ_0_0) -> τ_0_0 + 40
frame #19: 0x00000001852b59dc UIKitCore`___lldb_unnamed_symbol315204 + 192
frame #20: 0x00000001852b54a4 UIKitCore`___lldb_unnamed_symbol315199 + 64
frame #21: 0x0000000185745dd4 UIKitCore`_UIUpdateSequenceRunNext + 120
frame #22: 0x0000000186144fac UIKitCore`schedulerStepScheduledMainSectionContinue + 56
frame #23: 0x00000002505ad150 UpdateCycle`UC::DriverCore::continueProcessing() + 36
frame #24: 0x0000000180445b20 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
frame #25: 0x0000000180445a68 CoreFoundation`__CFRunLoopDoSource0 + 168
frame #26: 0x00000001804451f4 CoreFoundation`__CFRunLoopDoSources0 + 220
frame #27: 0x00000001804443a8 CoreFoundation`__CFRunLoopRun + 756
frame #28: 0x000000018043f458 CoreFoundation`_CFRunLoopRunSpecificWithOptions + 496
frame #29: 0x00000001928d19bc GraphicsServices`GSEventRunModal + 116
frame #30: 0x0000000186224480 UIKitCore`-[UIApplication _run] + 772
frame #31: 0x0000000186228650 UIKitCore`UIApplicationMain + 124
frame #32: 0x000000010bb1b504 MyApp.debug.dylib`main at main.swift:13:1
frame #33: 0x00000001043813d0 dyld_sim`start_sim + 20
frame #34: 0x000000010468ab98 dyld`start + 6076
Used let _ = Self.printChanges() in my SwiftUI View and got infinite changes of \_UICornerProvider.<computed 0x000000018527ffd8 (Optional<UICoordinateSpace>)> changed.
Reproduces only on beta; works on stable iOS. Likely beta-specific bug in SwiftUI rendering.
Hi everyone,
I've noticed a significant change in the visual behavior of List section headers between iOS 18 and iOS 26 beta that I'd like to clarify.
Current Behavior:
iOS 18 and earlier: Section headers with .listStyle(.plain) display with a translucent material background (regular material with blur effect) when pinned to the top during scrolling
iOS 26 beta: Section headers with .listStyle(.plain) appear with a transparent/clear background even when pinned to the top
Sample Code:
struct ContentView: View {
var body: some View {
NavigationStack {
List(1 ..< 5) { headerIndex in
Section {
ForEach(1...5, id: \.self) { rowIndex in
HStack {
Text("Row \(rowIndex)")
.frame(height: 40)
.padding(.horizontal)
.background(Color.blue)
Spacer()
Image(systemName: "chevron.right")
.foregroundStyle(.secondary)
.font(.title3)
}
}
} header: {
Text("Header \(headerIndex)")
.frame(height: 44)
}
.listRowSeparator(.hidden)
}
.listStyle(.plain)
.clipped()
}
}
}
Questions:
Is this change in header background behavior for .plain list style intentional in iOS 26?
If so, what's the recommended way to maintain the previous material background appearance when headers are pinned?
Should this be filed as feedback if it's unintended behavior?
Testing Environment:
Xcode 26.0 beta 3 (17A5276g)
iOS 26 beta (23A5287g) vs iOS 18.5
Tested on simulator
The translucent header background when pinned was quite useful for maintaining readability over scrolling content, so I'm hoping to understand if this is the new expected behavior or if there's a way to preserve the previous appearance.
Any insights would be greatly appreciated!
iOS 18.5
iOS 26 Beta
We are facing a serious issues with in app purchases in our app.
We offer 3 IAP: auto-renewable subscription 1W, auto-renewable subscription 1Y, non-consumable one-time purchase (LifeTime access)
In our case 90-95% of transactions fail and we mostly get SKError code=2 .
Sometime purchase fails several times for the same user so it’s very hard to believe that user intentionally cancels transaction for the same product 4 or even 5 times in a row.
It happens regardless iOS version, device model, our app version.
We've checked multiple threads with the same issue but coudn't find any solution.
We do not offer any promotions, product identifiers are valid... Some users are able to make a purchases without any issues.
I have been trying for almost a week to get my app approved. It is like the Submission team doesn't even read my notes. The first complaint is that my app was for a specific business and shouldn't be for the general public. This is true, so I put in the notes that I had requested private distribution and I filled out the request for the app to be distributed privately. The review notes say that I need to distribute my app privately. This is very frustrating.
Also, they say the login button doesn't work. It works for everyone that uses it in the Test Flight. One nuance we have is that our servers will not respond to IP addresses that orginate outside of the US. I have this in caps in the notes. They still say that the Login button doesn't work. The app was written for iPhones, yet they keep testing it on an iPad.
There doesn't seem to be any way to communicate with the submission team other than through the test notes and they don't seem to be reading these. Can anyone direct me to where I can get some help on this?
Thanks,
Jim
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
App Store
iOS
App Review
An issue with the CallKit UI, specifically regarding the functionality of the speaker button.
When a user initiates a video call with CallKit and then, using the existing CallKit session, initiates an audio call, there are no issues with CallKit or the audio.
However, if the user terminates the video call from the CallKit UI, the active CallKit session ends. To resume the ongoing audio call, we report a new CallKit call upon the end call trigger. While there are no issues with this reporting, the CallKit UI does not provide an audio route for the built-in receiver, and the speaker button remains unresponsive.
IPA was build on SDK 18 and running on iOS beta 26.
Issue is NOT seen with SDK18 and running iOS 18.x or lower devices.
Feedback - FB18855566
I have discovered a gap in my understanding of user selected URLs in iOS, and I would be grateful if someone can put me right please.
My understanding is that a URL selected by a user can be accessed by calling url.startAccessingSecurityScopedResource() call. Subsequently a call to stopAccessingSecurityScopedResource() is made to avoid sandbox memory leaks.
Furthermore, the URL can be saved as a bookmark and reconstituted when the app is run again to avoid re-asking permission from the user.
So far so good.
However, I have discovered that a URL retrieved from a bookmark can be accessed without the call to url.startAccessingSecurityScopedResource(). This seems contrary to what the documentation says here
So my question is (assuming this is not a bug) why not save and retrieve the URL immediately in order to avoid having to make any additional calls to url.startAccessingSecurityScopedResource?
Bill Aylward
You can copy and paste the code below into a new iOS project to illustrate this. Having chosen a folder, the 'Summarise folder without permission' button fails as expected, but once the 'Retrieve URL from bookmark' has been pressed, it works fine.
import SwiftUI
import UniformTypeIdentifiers
struct ContentView: View {
@AppStorage("bookmarkData") private var bookmarkData: Data?
@State private var showFolderPicker = false
@State private var folderUrl: URL?
@State private var folderReport: String?
var body: some View {
VStack(spacing: 20) {
Text("Selected folder: \(folderUrl?.lastPathComponent ?? "None")")
Text("Contents: \(folderReport ?? "Unknown")")
Button("Select folder") {
showFolderPicker.toggle()
}
Button("Deselect folder") {
folderUrl = nil
folderReport = nil
bookmarkData = nil
}
.disabled(folderUrl == nil)
Button("Retrieve URL from bookmark") {
retrieveFolderURL()
}
.disabled(bookmarkData == nil)
Button("Summarise folder with permission") {
summariseFolderWithPermission(true)
}
.disabled(folderUrl == nil)
Button("Summarise folder without permission") {
summariseFolderWithPermission(false)
}
.disabled(folderUrl == nil)
}
.padding()
.fileImporter(
isPresented: $showFolderPicker,
allowedContentTypes: [UTType.init("public.folder")!],
allowsMultipleSelection: false
) { result in
switch result {
case .success(let urls):
if let selectedUrl = urls.first {
print("Processing folder: \(selectedUrl)")
processFolderURL(selectedUrl)
}
case .failure(let error):
print("\(error.localizedDescription)")
}
}
.onAppear() {
guard folderUrl == nil else { return }
retrieveFolderURL()
}
}
func processFolderURL(_ selectedUrl: URL?) {
guard selectedUrl != nil else { return }
// Create and save a security scoped bookmark in AppStorage
do {
guard selectedUrl!.startAccessingSecurityScopedResource() else { print("Unable to access \(selectedUrl!)"); return }
// Save bookmark
bookmarkData = try selectedUrl!.bookmarkData(options: .minimalBookmark, includingResourceValuesForKeys: nil, relativeTo: nil)
selectedUrl!.stopAccessingSecurityScopedResource()
} catch {
print("Unable to save security scoped bookmark")
}
folderUrl = selectedUrl!
}
func retrieveFolderURL() {
guard let bookmarkData = bookmarkData else {
print("No bookmark data available")
return
}
do {
var isStale = false
let url = try URL(
resolvingBookmarkData: bookmarkData,
options: .withoutUI,
relativeTo: nil,
bookmarkDataIsStale: &isStale
)
folderUrl = url
} catch {
print("Error accessing URL: \(error.localizedDescription)")
}
}
func summariseFolderWithPermission(_ permission: Bool) {
folderReport = nil
print(String(describing: folderUrl))
guard folderUrl != nil else { return }
if permission { print("Result of access requrest is \(folderUrl!.startAccessingSecurityScopedResource())") }
do {
let contents = try FileManager.default.contentsOfDirectory(atPath: folderUrl!.path)
folderReport = "\(contents.count) files, the first is: \(contents.first!)"
} catch {
print(error.localizedDescription)
}
if permission { folderUrl!.stopAccessingSecurityScopedResource() }
}
}
I'm encountering an issue with our legacy Objective-C codebase that uses UIApplicationDelegate.
Here are the steps to reproduce the issue:
Uninstall the application from the device.
Install and launch the application.
As part of the launch event, the client requests notification permission.
The permission prompt is still displayed, even though the client receives a remote notification token (which appears to be a cached one).
I followed the same steps with a sample app built with Swift (SwiftUI), and this issue did not occur. In the Swift app, I consistently received a delegate<didRegisterForRemoteNotificationsWithDeviceToken> call after the user allowed the notification permission.
Could you please provide some insights into why this might be happening with only our client?
Topic:
App & System Services
SubTopic:
Notifications
Tags:
APNS
iOS
Notification Center
User Notifications
In TabView, when I open a view in a Tab, and I switch to another Tab, but the View lifecycle of the view in the old Tab is still not over, and the threads of some functions are still in the background. I want to completely end the View lifecycle of the View in the previously opened tab when switching Tab. How can I do it? Thank you!
When attempting to open sysdiagnose logs collected from an iPhone running iOS 26 beta 3 on macOS Console, the application consistently crashes.
Crash report has been added for reference.
Apple Feedback- FB18834450
Before I file a bug report I wanted to verify that I'm not missing something.
If I setup a view controller in a navigation controller and I add a view with a constraint that lines it up with the view controller's view's layoutMarginsGuide (leadingAnchor or trailingAnchor), in several cases the view will not line up with buttons added in the navigation bar. Under iOS 18 everything lines up as expected.
To demonstrate, create a new iOS project based on Swift/Storyboard. Setup the storyboard to show a UINavigationController with one UIViewController. Then in ViewController.swift (the one embedded in the navigation controller), use the following code:
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .yellow
title = "Layout Margins"
let leftCancel = UIBarButtonItem(systemItem: .cancel)
navigationItem.leftBarButtonItem = leftCancel
let rightCancel = UIBarButtonItem(systemItem: .cancel)
navigationItem.rightBarButtonItem = rightCancel
let leftView = UIView()
leftView.backgroundColor = .blue
leftView.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(leftView)
let rightView = UIView()
rightView.backgroundColor = .red
rightView.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(rightView)
NSLayoutConstraint.activate([
leftView.widthAnchor.constraint(equalToConstant: 80),
leftView.heightAnchor.constraint(equalToConstant: 80),
leftView.leadingAnchor.constraint(equalTo: self.view.layoutMarginsGuide.leadingAnchor),
leftView.topAnchor.constraint(equalTo: self.view.layoutMarginsGuide.topAnchor),
rightView.widthAnchor.constraint(equalToConstant: 80),
rightView.heightAnchor.constraint(equalToConstant: 80),
rightView.trailingAnchor.constraint(equalTo: self.view.layoutMarginsGuide.trailingAnchor),
rightView.topAnchor.constraint(equalTo: self.view.layoutMarginsGuide.topAnchor),
])
}
}
This adds a "Cancel" button to both ends of the navigation bar and it adds two little square views lined up with the leading and trailing layout margins.
Here's the results:
iPad running iPadOS 26 beta 3 (note the misalignment). This is really jarring when trying to align another glass button below the cancel button:
iPad running iPadOS 18.5 (aligned just fine):
iPhone in portrait running iOS 26 beta (aligned just fine):
iPhone in landscape running iOS 26 beta (no alignment at all):
iPhone in portrait running iOS 18.5 (aligned just fine):
iPhone in landscape running iOS 18.5 (aligned just fine):
Under iOS 26 on an iPhone (simulator at least) in portrait, the cancel buttons line up with the colored squares. That's good. In landscape, the colored squares have much larger margins as expected (due to the larger safe areas caused by the notch), but the cancel buttons in the navigation bar are not using the same margins. This one is debatable. Under iOS 18 the cancel buttons use larger margins to match the larger safe area. But I can see why under iOS 26 they changed this since the navigation bar doesn't interfere with the notch. But it's inconsistent.
Under iOS 26 on an iPad (simulator at least), it's wrong in any orientation. Despite the lack of any notch or need for a larger safe area, the colored squares are indented just a bit more than the buttons in the navigation bar. I see no reason for this. Under iOS 18 everything lines up as expected.
My real question at this point: Is the mismatched margins on an iPad under iOS 26 between the buttons in the navigation bar and other views added to the view controller a likely bug or am I missing something?
I installed the third beta of Xcode 26 with Xcode 16.4 installed on my machine. Once Xcode 26 was installed, all of my previous simulators were wiped out, leaving only the default iOS 26 simulators. I cannot create new simulators for iOS versions below 26. Here are my failed attempts to fix the issue:
Restarted Xcode 16.4 and my machine
Reinstalled the iOS 18.5 runtime
Uninstalled Xcode 26 and iOS 26 runtime
Reinstalled Xcode 16.4
Now, I literally cannot use a simulator in Xcode 16.4. Here is what I see when I try to create a new simulator in Xcode 16.4:
According to Xcode, the iOS 18.5 runtime is installed, so I have no idea what is going on. Is this a known issue? And how do I get Xcode 16.4 working with the iOS simulator?