Is there any way to remove the hightlight on top and bottom of desktop widgets on iOS 26 ?
Explore the various UI frameworks available for building app interfaces. Discuss the use cases for different frameworks, share best practices, and get help with specific framework-related questions.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I am using ".navigationTransition(ZoomNavigationTransition.zoom(sourceID: xxx, in: xxx))" to zooms the appearing view from a source view .
When the appearing view dismissed, I can only click other view after a delay .
It seems that the transition is not finished immediately when the appearing view dismissed . After a delay, the transition finished, than I can click other view.
struct ContentView: View {
@State private var path: NavigationPath = NavigationPath()
@Namespace private var namespace
var body: some View {
NavigationStack(path: $path) {
VStack(spacing: 0) {
ForEach(["aaa", "bbb"], id: \.self) { string in
Text(string)
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height / 2)
.contentShape(Rectangle())
.onTapGesture {
path.append(string)
}
.matchedTransitionSource(id: string, in: namespace)
}
}
.navigationDestination(for: String.self, destination: { route in
Text(route)
.navigationTransition(ZoomNavigationTransition.zoom(sourceID: route, in: namespace))
})
}
}
}
When using sheet on appearing view, It seems that the transition is finished immediately when the appearing view dismissed.
extension String: Identifiable {
public var id: String { return self }
}
struct ContentView: View {
@State private var path: NavigationPath = NavigationPath()
@Namespace private var namespace
@State private var stringToSheet: String?
var body: some View {
NavigationStack(path: $path) {
VStack(spacing: 0) {
ForEach(["aaa", "bbb"], id: \.self) { string in
Text(string)
.frame(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height / 2)
.contentShape(Rectangle())
.onTapGesture {
stringToSheet = string
}
.matchedTransitionSource(id: string, in: namespace)
}
}
.sheet(item: $stringToSheet) { newValue in
Text(newValue)
.navigationTransition(ZoomNavigationTransition.zoom(sourceID: newValue, in: namespace))
}
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
https://developer.apple.com/forums/thread/788293
In the above thread, I received the following response:
"When building with the SDK from the next major release after iOS 26, iPadOS 26, macOS 26 and visionOS 26, UIKit will assert that all apps have adopted UIScene life cycle. Apps that fail this assert will crash on launch."
does this mean that there will be no app crashes caused by UIKit in iOS 26, but there is a possibility of app crashes when building with the SDK provided from iOS 27 onwards?
Hello everyone,
I'm developing a SwiftUI app that includes a fullscreen video player (AVPlayerViewController or AVPlayerLayer). I'm currently testing the app on an iPhone 16 Pro running iOS 26 Beta, as well as on the corresponding simulator.
With iOS 26, during video playback, an unexpected black or white glow/halo appears around the video, depending on the system appearance (dark/light mode). However, this issue does not occur when testing on iOS 18 — neither on device nor simulator.
Has anyone encountered this issue?
Is there any known workaround or solution to remove this visual effect on iOS 26?
I've attached screenshot below to illustrate the problem.
Thank you in advance for your help!
According the video "Build an AppKit app with the new design" (https://developer.apple.com/videos/play/wwdc2025/310/), it is now possible to add a badge on a NSToolbarItem object.
However, in don't see a badge in the NSToolbar API. The code example in the video includes for example "NSItemBadge.count(4)", but the only Google result for this is the video mentioned above.
Is this still work in progress or I'm overlooking something?
Looking at the superclass of CPImmersiveScene is surprisingly is a UIWindowScene.
Is this intentional? Should I treat it as a window scene, and provide an UIWindow for it?
Or is it only an implementation detail for managing the internal CPSceneLayerEventWindow and UITextEffectsWindow?
I have a toolbar in SwiftUI where two of the buttons are Menus. When I tap on the button the menu animates out into the correct position and then it flys to the top of the screen.
When I tap on the menu button I get this.
Then within 1 second the menu flys to the top of the screen and looks like this.
My toolbar code looks like this.
.toolbar {
ToolbarItemGroup(placement: .bottomBar) {
Menu {
Button { markMyLocation() } label: { Label("Mark My Location", systemImage: "location") }
... (MORE BUTTONS)
} label: {
Image(systemName: "plus")
}
.menuOrder(.fixed)
Spacer()
Menu {
Button { shareWithWebLink() } label: { Label("Share Map", systemImage: "square.and.arrow.up") }
... (MORE BUTTONS)
} label: {
Image(systemName: "square.and.arrow.up")
}
.menuOrder(.fixed)
Button {
presentHikeView()
} label: {
Image(systemName: "figure.hiking")
}
Button {
presentMapsView()
} label: {
Image(systemName: "map")
}
Spacer()
Button {
search()
} label: {
Image(systemName: "magnifyingglass")
}
}
}
Adding .chartScrollableAxes(.horizontal) to a chart prevents chartYAxisLabel from being positioned top right, over Y axis.
We want the label at top right, over the Y-axis, but with chartScrollableAxes it is always top right relative to the initial chartXVisibleDomain, which puts it in the middle of the chart if chartXVisibleDomain < full x domain.
import SwiftUI
import Charts
struct ContentView: View {
@State private var numbers = (0..<100)
.map { _ in Double.random(in: 0...100) }
@State var visibleDomain : Int = 50
var body: some View {
Chart(Array(zip(numbers.indices, numbers)), id: \.1) { index, number in
LineMark(
x: .value("Index", index),
y: .value("Number", number)
)
}
.chartScrollableAxes(.horizontal)
.chartXVisibleDomain(length: visibleDomain)
.chartScrollPosition(initialX: 70)
.chartYAxisLabel(position: .topTrailing, alignment: .center) {
/*
We want the label at top right, over the Y-axis, but with
chartScrollableAxes it is always top right relative to the initial
chartXVisibleDomain, which puts it in the middle of the chart if
chartXVisibleDomain < full x domain
*/
Text("units")
.foregroundStyle(.red)
.fontWeight(.bold)
}
.padding()
}
}
#Preview {
ContentView()
}
I am trying to hide the titlebar for a macOS app and despite searching throughout the entire day, there's nothing that points to how I can achieve this. I did find this page in the documentation but I don't understand it.
https://developer.apple.com/documentation/uikit/uititlebar/titlevisibility
How do I remove the part where it says Xcode Previews? I have used the following on my WindowGroup that works perfectly when the app is being run but it doesn't do anything in the preview.
.windowStyle(.hiddenTitleBar)
Topic:
UI Frameworks
SubTopic:
SwiftUI
Overview
Starting with macOS 26 beta 1, a new NSGlassContainerView is added inside NSToolbarView.
This view intercepts mouse events, so any SwiftUI Button (or other interactive view) overlaid on the title‑bar / toolbar area no longer receives clicks.
(The same code works fine on macOS 15 and earlier.)
Filed as FB18201935 via Feedback Assistant.
Reproduction (minimal project)
macOS 15 or earlier → button is clickable
macOS 26 beta → button cannot be clicked (no highlight, no action call)
@main
struct Test_macOS26App: App {
init() {
// Uncomment to work around the issue (see next section)
// enableToolbarClickThrough()
}
var body: some Scene {
WindowGroup {
ContentView()
}
.windowStyle(.hiddenTitleBar) // ⭐️ hide the title bar
}
}
struct ContentView: View {
var body: some View {
NavigationSplitView {
List { Text("sidebar") }
} detail: {
HSplitView {
listWithOverlay
listWithOverlay
}
}
}
private var listWithOverlay: some View {
List(0..<30) { Text("item: \($0)") }
.overlay(alignment: .topTrailing) { // ⭐️ overlay in the toolbar area
Button("test") { print("test") }
.glassEffect()
.ignoresSafeArea()
}
}
}
Investigation
In Xcode View Hierarchy Debugger, a layer chain
NSToolbarView > NSGlassContainerView sits in front of the button.
-[NSView hitTest:] on NSGlassContainerView returns itself, so the event never reaches the SwiftUI layer.
Swizzling hitTest: to return nil when the result is the view itself makes the click go through:
func enableToolbarClickThrough() {
guard let cls = NSClassFromString("NSGlassContainerView"),
let m = class_getInstanceMethod(cls, #selector(NSView.hitTest(_:))) else { return }
typealias Fn = @convention(c)(AnyObject, Selector, NSPoint) -> Unmanaged<NSView>?
let origIMP = unsafeBitCast(method_getImplementation(m), to: Fn.self)
let block: @convention(block)(AnyObject, NSPoint) -> NSView? = { obj, pt in
guard let v = origIMP(obj, #selector(NSView.hitTest(_:)), pt)?.takeUnretainedValue()
else { return nil }
return v === (obj as AnyObject) ? nil : v // ★ make the container transparent
}
method_setImplementation(m, imp_implementationWithBlock(block))
}
Questions / Call for Feedback
Is this an intentional behavioral change?
If so, what is the recommended public API or pattern for allowing clicks to reach views overlaid behind the toolbar?
Any additional data points or confirmations are welcome—please reply if you can reproduce the issue or know of an official workaround.
Thanks in advance!
Hey!
Our team is experiencing some issue in a large SwiftUI application. When loading large views, the app crashes with a EXC_BAD_ACCESS signal. This signal can be reported by Xcode either on the @main attribute, inside a view hierarchy, or any order property that is accessed in the view hierarchy. After some investigation we found several possible workarounds:
Splitting up the view into smaller subviews
Wrapping parts of the view into an AnyView, which isn't ideal.
However, this only temporarily solved the issue. As the app becomes bigger, we run into this problem more frequently.
When trying to reproduce this issue in a clean Xcode project, I came up with the following:
struct ContentView: View {
var body: some View {
Text("Hello")
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
.task {}
}
}
When running this, the app immediately crashes on an iPhone 14 (YMMV on different (newer) devices).
Of course such a view is not very likely to occur, but in total a view hierarchy could have this many view modifiers.
Is there some limit we should we aware of? How can we circumvent this?
Thanks!
When developing an iOS app that monitors or transmits the battery percentage (using UIDevice.current.batteryLevel), often expect to get updates for every 1% change in battery. However, on iOS, the batteryLevel property only updates in steps of approximately 5%. For example, the value jumps from 1.0 (100%) to 0.95 (95%), then to 0.90 (90%), and so on. It does not report intermediate values like 0.99, 0.98, etc.
We ran into a bug with our app Bezel (https://getbezel.app). When running on macOS Tahoe, windows would get partially clipped.
This is because we have SwiftUI views that are larger than the window size, our SwiftUI views are supposed to be centered, which they are on macOS 13, 14, 15. But on macOS 26 (beta 1), the window contents are top-left aligned.
This seems to be a bug, I have submitted FB18201269.
This is my code:
WindowGroup {
ZStack {
Color.green
ZStack {
Color.yellow
Text("Hi")
}
.aspectRatio(1, contentMode: .fill)
.border(.red)
}
}
This first screenshot shows the old behavior on macOS 15:
This second screenshot shows the new behavior on macOS 26 (beta 1)
Can anyone confirm if this is indeed a bug, or if this an intended change in behavior?
Hi! I'm working on a iOS 26 SwiftUI prototype that adds an element to the content of a screen only when the tab bar is fully visible and not minimized (via .tabBarMinimizeBehavior).
Is there any way to detect when a tab bar is minimized? My hope is that I can use a ternary operator to display something only when a boolean is true.
Here's some code to illustrate my idea:
struct ContentView: View {
@State var isTabBarMinimized: Bool = false
var body: some View {
TabView {
Tab("View1", systemImage: "rainbow") {
// Only appears when tab bar is fully visible
Color.blue
.opacity(isTabBarMinimized? 0 : 1 )
}
Tab("View2", systemImage: "rainbow") {
View2()
}
Tab("View3", systemImage: "rainbow") {
View3()
}
Tab("View4", systemImage: "rainbow") {
View4()
}
}
.tabBarMinimizeBehavior(.onScrollDown)
}
}
I'm building a SwiftUI app using SwiftData. In my app I have a Customer model with an optional codable structure Contact. Below is a simplified version of my model:
@Model class Customer {
var name: String = ""
var contact: Contact?
init(name: String, contact: Contact? = nil) {
self.name = name
self.contact = contact
}
struct Contact: Codable, Equatable {
var phone: String
var email: String
var allowSMS: Bool
}
}
I'm trying to query all the Customers that have a contact with @Query. For example:
@Query(filter: #Predicate<Customer> { customer in
customer.contact != nil
}) var customers: [Customer]
However no matter how I set the predicate I always get an error:
BugDemo crashed due to an uncaught exception NSInvalidArgumentException. Reason: keypath contact not found in entity Customer.
How can I fix this so that I'm able to filter by contact not nil in my Model?
For certain contexts, I'd like to still have my .sheet() be full width even when it's at a small height. In iOS 26, the sheet is inset from the edges at small detents and expands to full width at larger detents. For example, I have a view where I have a .sheet() that has a height of about 200pts and it contains a horizontally scrolling picker that extends past the bounds of the screen. I'd like the .sheet to expand all the way to the edge when at these small detents, like it would previous to iOS 26. Is it possible to configure this? This change will break a number of existing designs :(
A new ViewModifier such as
enum PresentationWidth {
case dynamic, fixed
}
func presentationWidth(_ width: PresentationWidth) -> some View
would be very nice.
Is this not possible? I have a simple text view that shows the time, but it doesn't stay in sync with the time. I've tried to use a timer like I do inside the app, but that didn't work. I tried TimelineView with it set to every minute, and that didn't work. I tried to use the dynamic date using Text(date, style: ) and that didn't work. I looked it up and apparently it's a limitation to WidgetKit, however, I don't understand how the Apple Clock widget can have a moving second hand that updates properly.
Do I just need to add a bunch of entries in the TimelineProvider? Right now, it's just the default that gets loaded when you create a Widget extension.
func timeline(for configuration: SingleClockIntent, in context: Context) async -> Timeline<SingleClockEntry> {
var entries: [SingleClockEntry] = []
// Generate a timeline consisting of five entries an hour apart, starting from the current date.
let currentDate = Date()
for hourOffset in 0 ..< 5 {
let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)!
let entry = SingleClockEntry(date: entryDate, configuration: configuration)
entries.append(entry)
}
return Timeline(entries: entries, policy: .atEnd)
}
EDIT: This code below seems to be working. Can someone confirm if it will continue to work, or will it eventually stop updating?
func timeline(for configuration: SingleClockIntent, in context: Context) async -> Timeline<SingleClockEntry> {
var entries: [SingleClockEntry] = []
let calendar = Calendar.current
let current = Date()
// Get the next minute
let secondEntryDate = calendar.nextDate(after: current, matching: DateComponents(second: 0), matchingPolicy: .strict, direction: .forward)!
entries.append(SingleClockEntry(date: current, configuration: configuration)) // Adds current time
entries.append(SingleClockEntry(date: secondEntryDate, configuration: configuration)) // Adds next minute after current time
// Add an entry every min for the next 30 minutes
for offset in 0..<30 {
let entryDate = Calendar.current.date(byAdding: .minute, value: offset, to: secondEntryDate)!
let entry = SingleClockEntry(date: entryDate, configuration: configuration)
entries.append(entry)
}
return Timeline(entries: entries, policy: .atEnd)
}
I'm trying to apply a tinted glass effect to toolbar buttons in iOS 26, similar to what was shown in the WWDC25 videos, but none of the approaches I've tried produce the translucent tinted glass effect.
My code structure:
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
TrailingToolbarContent(
selectedTab: $selectedTab,
showingAddBeneficiary: $showingAddBeneficiary
)
}
}
private struct TrailingToolbarContent: View {
@Binding var selectedTab: Int
@Binding var showingAddBeneficiary: Bool
@EnvironmentObject private var settingsViewModel: SettingsViewModel
var body: some View {
switch selectedTab {
case 1:
if #available(iOS 26.0, *) {
Button(action: { showingAddBeneficiary = true }) {
Image(systemName: "plus")
}
// What I've tried:
// .tint(Color("accentPrimary")) // Only changes icon color
// .glassEffect(.regular.tint(Color("accentPrimary"))) // No effect
// .buttonStyle(.glass).tint(Color("accentPrimary")) // No tint, but orange background
// .buttonStyle(.borderedProminent).tint(Color("accentPrimary")) // Works but seems opaque, not glass
}
// ... other cases
}
}
}
What's the correct way to achieve tinted glass effects on toolbar buttons?
Topic:
UI Frameworks
SubTopic:
SwiftUI
Getting this in log any time I try to start typing anything into a UITextField:
First responder issue detected: non-key window attempting reload - allowing due to manual keyboard (first responder window is <UIWindow: 0x10e016880; frame = (0 0; 1133 744); gestureRecognizers = <NSArray: 0x10ba53850>; backgroundColor = <UIDynamicProviderColor: 0x108563370; provider = <NSMallocBlock: 0x11755bd50>>; layer = <UIWindowLayer: 0x10ba84190>>, key window is )
I'm suspicious of the empty "key window is" field. Everything else in the app is working fine. But I cannot figure out why this fails to show the keyboard, and no keyboard notifications are being received by the app. What could it be?
How can I create a view that is like the one in the Photos app where you can select an item and it fills the window, then you can drag / swipe between items in that view? I have a working prototype, and it works for photos. But once I get to a video, the gesture no longer works.