In a SwiftUI lab, I was asking about setting the focus state down a view hierarchy. The answer I got was to pass the focus state down the views as a binding. Conceptually, that made sense, so I moved on to other questions. But now that I am trying to implement it, I am having problems.
In the parent view, I have something like this:
@FocusState private var focusElement: UUID?
Then I am setting a property like this in the child view:
@Binding var focusedId: UUID?
When I try to create the detail view, I'm trying this:
DetailView(focusedId: $focusElement)
But this doesn't work. The error I get is:
Cannot convert value of type 'FocusState<UUID?>.Binding' to expected argument type 'Binding<UUID?>'
What is the right way to pass down the focus state to a child view so that it can update back up to the parent view?
I am trying to update from one child view, and have a TextField in a sibling view get focus.
                    
                  
                
  
    
    Selecting any option will automatically load the page
  
  
  
  
    
  
  
          Post
Replies
Boosts
Views
Activity
                    
                      My use case is the following:
Every user of my app can create as an owner a set of items. 
These items are private until the owner invites other users to share all of them as participant.
The participants can modify the shared items and/or add other items.
So, sharing is not done related to individual items, but to all items of an owner.
I want to use CoreData & CloudKit to have local copies of private and shared items.
To my understanding, CoreData & CloudKit puts all mirrored items in a special zone „com.apple.coredata.cloudkit.zone“.
So, this zone should be shared, i.e. all items in it.
In the video it is said that NSPersistentCloudKitContainer uses Record Zone Sharing optionally in contrast to hierarchically record sharing using a root record.
But how is this done?
Maybe I can declare zone „com.apple.coredata.cloudkit.zone“ as a shared zone?
                    
                  
                
              
                
              
              
                
                Topic:
                  
	
		App & System Services
  	
                
                
                SubTopic:
                  
                    
	
		iCloud & Data
		
  	
                  
                
              
              
                Tags:
              
              
  
  
    
      
      
      
        
          
            Cloud and Local Storage
          
        
        
      
      
    
      
      
      
        
          
            UI Frameworks
          
        
        
      
      
    
      
      
      
        
          
            wwdc21-10015
          
        
        
      
      
    
  
  
              
                
                
              
            
          
                    
                      If I put the phone flat on a table, the left and right swipe gestures is not working but up and down gestures works.
Only when I put the iPhone to some vertical degree, the left and right swipe works.
Tested on 2 iPhone 7 Plus and 2 iPhone 13.
Anyone has similar experience? If yes, why?
                    
                  
                
                    
                      Hello everyone,
I’m experiencing an issue with the Android Emulator in Android Studio (version Ladybug) on my Mac running macOS Monterey (12.7). The emulator frequently displays the message “System UI isn’t responding” and then crashes.
I've tried a few troubleshooting steps, including:
Restarting Android Studio and the emulator.
wipe data on AVD.
tried to change the emulator performance from automatic to hardware but this option isn't available to me.
Despite these efforts, the problem persists. Has anyone else encountered this issue? Any suggestions or solutions would be greatly appreciated!
                    
                  
                
                    
                      Hi, my I know what is wrong with my code, I have a unintended border around my game although there is no padding, can someone help me thanks!
This is my code:
`
                    
                  
                
                    
                      Hi,
There are total three errors from the app running on the device.
First one is right after the app starts running on the device:
Could not create a sandbox extension for '/var/containers/Bundle/Application/D4CBF093-EFB1-43C5-996D-7D5CB04BF643/appadmob.app'
Below second issue comes when I dismiss the Interstitial Ad
First responder issue detected: non-key window attempting reload - allowing due to manual keyboard (first responder window is <UIWindow: 0x10d11c700; frame = (0 0; 414 896); hidden = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x301749300>; backgroundColor = <UIDynamicSystemColor: 0x3002b3080; name = _windowBackgroundColor>; layer = <UIWindowLayer: 0x3019b7960>>, key window is <QUIWindow: 0x10880db00; baseClass = UIWindow; frame = (0 0; 414 896); gestureRecognizers = <NSArray: 0x3017276e0>; layer = <UIWindowLayer: 0x3019852f0>>)
And the third issue below follows right after the second one:
Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))" UserInfo={NSLocalizedFailureReason=((target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.rendering AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.networking AND target is not running or doesn't have entitlement com.apple.developer.web-browser-engine.webcontent))}>
0x118024480 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess NearSuspended Assertion' for process with PID=19180, error: (null)
Failed to terminate process: Error Domain=com.apple.extensionKit.errorDomain Code=18 "(null)" UserInfo={NSUnderlyingError=0x3019254a0 {Error Domain=RBSRequestErrorDomain Code=3 "No such process found" UserInfo={NSLocalizedFailureReason=No such process found}}}
Also when I dismissed the interstitial ad, the screen looks greyed out, but when I touch the screen, the screen comes to normal.
Could you please suggest any solution for the problems.
Thanks,
                    
                  
                
              
                
              
              
                
                Topic:
                  
	
		App & System Services
  	
                
                
                SubTopic:
                  
                    
	
		General
		
  	
                  
                
              
              
                Tags:
              
              
  
  
    
      
      
      
        
          
            Xcode
          
        
        
      
      
    
      
      
      
        
          
            UI Frameworks
          
        
        
      
      
    
      
      
      
        
          
            UIKit
          
        
        
      
      
    
      
      
      
        
          
            Xcode Sanitizers and Runtime Issues
          
        
        
      
      
    
  
  
              
                
                
              
            
          
                    
                      I’m following the example code from Apple to implement the new iPadOS 18 TabView() with the new Tab(). While the tabbing itself is working fine, I can’t get it to show up a (large) navigation title in the sidebar (like the Home or Files app).
I’ve tried placing .navigationTitle("App Name") at the TabView, but that doesn’t work. Is it possible to do this in any way or is this not recommended to show?
TabView {
    Tab("Overview", systemImage: "film") {
        Text("Put a OverviewView here")
    }
    
    TabSection("Watch") {
        Tab("Movies", systemImage: "film") {
            Text("Put a MoviesView here")
        }
        
        Tab("TV Shows", systemImage: "tv") {
            Text("Put a TVShowsView here")
        }
    }
    
    TabSection("Listen") {
        Tab("Music", systemImage: "music.note.list") {
            Text("Put a MusicView here")
        }
        
        Tab("Podcasts", systemImage: "mic") {
            Text("Put a PodcastsView here")
        }
    }
}
.tabViewStyle(.sidebarAdaptable)
.navigationTitle("App Name")
.navigationBarTitleDisplayMode(.large)
I know that there is also the .tabViewSidebarHeader() modifier, but that adds any view above the scroll view content. Neither does that easily allow to make it look like the regular navigation title, nor does it actually display in the navigation bar at the top, when scrolling down.
                    
                  
                
                    
                      More specifically, if I have 2 pinned tabs that are displayed in different order for compact and regular and switch between compact and regular, when it gets to regular mode, the images for both tabs will not be rendered. The tabs can still be pressed, just the icon is missing.
                    
                  
                
                    
                      The issue is, I cannot auto acquire bluetooth keyboard focus in PHPickerViewController after enabling 'Full Keyboard Access' in my IPhone 14 with iOS version 18.3.1. The keyboard focus in PHPickerViewController will show, however, after I tapped on the blank space of the PHPickerViewController. How to make the focus on at the first place then?
I'm using UINavigationController and calling setNavigationBarHidden(true, animated: false). Then I use this controller to present PHPickerViewController using some configuration setup below.
self.configuration = PHPickerConfiguration()
configuration.filter = .any(of: filters)
configuration.selectionLimit = selectionLimit
if #available(iOS 15.0, *), allowOrdering {
configuration.selection = .ordered
}
configuration.preferredAssetRepresentationMode = .current
Finally I set the delegate to PHPickerViewController and call UINavigationController.present(PHPickerViewController,  animated: true) to render it.
Also I notice animation showing in first video then disappear.
                    
                  
                
                    
                      This sample code exhibits two issues:
struct ContentView: View
{
	@State private var myColor = Color.red
	var body: some View {
		VStack() {
			List() {
				Text("Object")
				Text("Object")
				Text("Object")
					.listRowSeparatorTint(myColor)
				Text("Object")
			}
			Button(action:{myColor = Color.green})
			{Text("Change color")}
		}
		.foregroundColor(myColor)
	}
}
the row separator isn't redraws when the @State property change
listRowSeparatorTint apply to two lines
The first point is really disappointing. Is there anyone which know if this is a bug or there is a more correct way to use listRowSeparatorTint with changing parameter?
                    
                  
                
                    
                      To get menubar size, we can call.
let menuBarHeight = NSStatusBar.system.thickness
That is returning 24 and it is the same as my external screen. I did command + shift + 5 and use the screen capture tool to rougly measure the size of menubar. It is roughly 24px.
However, for my macbook pro 14 inches m2 pro. The menubar seem thicker because of the webcam. Is there a way to find out the size in Swift?
                    
                  
                
                    
                      Since updating my MacBook Air to macOS Tahoe 26.0 Developer Beta 2, I’ve encountered a persistent cursor misalignment issue:
When interacting with lists or contextual menus, the cursor’s visual position does not align with what it actually selects.
The system registers the cursor slightly above where it appears, causing clicks to select the wrong option or fail to register.
As a temporary workaround, I can sometimes position the cursor off-target and press Enter to select, but this is a frustrating and inefficient workaround.
The issue persists after a restart and appears across multiple areas of the OS:
Right-clicking an app in the Dock to open the contextual menu → cursor highlights an incorrect item relative to its position.
In System Settings menus.
Even on the Feedback Assistant site when selecting issue categories.
Steps to Reproduce:
1️⃣ Update to macOS Tahoe 26.0 Developer Beta 2 on MacBook Air.
2️⃣ Right-click on any open application in the Dock.
3️⃣ Attempt to select an option from the list that appears.
4️⃣ Observe that the cursor highlights or interacts with a different option than where the cursor is visibly located.
Notes:
Issue is consistent across reboots.
Affects workflow and general navigation.
Temporary workaround using keyboard navigation is insufficient for productivity.
FB Number: FB18531124
If others are seeing this as well, please confirm below so Apple can prioritize investigation.
                    
                  
                
                    
                      I’m not seeing Liquid Glass on any standard components. A month ago around July 17th I ran our app and saw Liquid Glass on our tab view and various standard components. Those components have not been changed and yet I’m no longer seeing Liquid Glass in our app at all.
Components that were previously liquid glass but now are not include TabView and back navigation buttons.
I set the UIDesignRequiresCompatibility key explicitly to false but no luck. I was seeing this in Beta 7 and Beta 8 on a real device and on a sim.
                    
                  
                
                    
                      Hi everybody,
I use a very old photo software called Snapseed v 1.2.1 on 2 MacBook, one runs with El Capitan and the second runs with Mojave. These app has no language selection during install, and no preferences language choice in menu when running.
When I execute app on El Capitan, all menus and topics are translate in French, but on Mojave no translation is done.
I looked Contents of app and found differents languages files (structured as xx.po where xx=country) located in Resources folder. I deduced translation was executed after getting language param. I checked values on both systems and there are same (LANG=fr_FR.UTF-8).
So I tried to change Info.plist file to force code langage to 'fr' in CFBundleLocalizations key. Result is same.
Does somebody has a idea of reason of issue and how to solve it ?
Snapseed release was 2012, El Capitan 2015 and Mojave 2018, it seems framework used to code app runs differently and can't get language value.
                    
                  
                
                    
                      I am using Button in my app, is push button and style is Momentary push in and bordered, added image icon on it also
bottom shows with image with white background , like below
But in Tahoe OS, it shows without white background(almost like border less)
Do I need to change button style?
                    
                  
                
                    
                      Hello!
After upgrading to Xcode 16 & Swift 6 & iOS 18 I starting receiveing strange crashes.
Happens randomly in different view and pointing to onGeometryChange action block. I added DispatchQueue.main.async { in hopes it will help but it didn't.
HStack {
...
}
            .onGeometryChange(for: CGSize.self, of: \.size) { value in
                DispatchQueue.main.async {
                    self.width = value.width
                    self.height = value.height
                }
            } 
As far as I understand, onGeometryChange is defined as nonisolated and Swift 6 enforce thread checking for the closures, SwiftUI views are always run on the main thread. Does it mean we can not use onGeometryChange safely in swiftui?
BUG IN CLIENT OF LIBDISPATCH: Assertion failed: Block was expected to execute on queue [com.apple.main-thread (0x1eacdce40)]
Crashed: com.apple.SwiftUI.AsyncRenderer
0  libdispatch.dylib              0x64d8 _dispatch_assert_queue_fail + 120
1  libdispatch.dylib              0x6460 _dispatch_assert_queue_fail + 194
2  libswift_Concurrency.dylib     0x62b58 <redacted> + 284
3  Grit                           0x3a57cc specialized implicit closure #1 in closure #1 in PurchaseModalOld.body.getter + 4377696204 (<compiler-generated>:4377696204)
4  SwiftUI                        0x5841e0 <redacted> + 60
5  SwiftUI                        0x5837f8 <redacted> + 20
6  SwiftUI                        0x586b5c <redacted> + 84
7  SwiftUICore                    0x68846c <redacted> + 48
8  SwiftUICore                    0x686dd4 <redacted> + 16
9  SwiftUICore                    0x6ecc74 <redacted> + 160
10 SwiftUICore                    0x686224 <redacted> + 872
11 SwiftUICore                    0x685e24 $s14AttributeGraph12StatefulRuleP7SwiftUIE15withObservation2doqd__qd__yKXE_tKlF + 72
12 SwiftUI                        0x95450 <redacted> + 1392
13 SwiftUI                        0x7e438 <redacted> + 32
14 AttributeGraph                 0x952c AG::Graph::UpdateStack::update() + 540
15 AttributeGraph                 0x90f0 AG::Graph::update_attribute(AG::data::ptr<AG::Node>, unsigned int) + 424
16 AttributeGraph                 0x8cc4 AG::Subgraph::update(unsigned int) + 848
17 SwiftUICore                    0x9eda58 <redacted> + 348
18 SwiftUICore                    0x9edf70 <redacted> + 36
19 AttributeGraph                 0x148c0 AGGraphWithMainThreadHandler + 60
20 SwiftUICore                    0x9e7834 $s7SwiftUI9ViewGraphC18updateOutputsAsync2atAA11DisplayListV4list_AG7VersionV7versiontSgAA4TimeV_tF + 560
21 SwiftUICore                    0x9e0fc0 $s7SwiftUI16ViewRendererHostPAAE11renderAsync8interval15targetTimestampAA4TimeVSgSd_AItF + 524
22 SwiftUI                        0xecfdfc <redacted> + 220
23 SwiftUI                        0x55c84 <redacted> + 312
24 SwiftUI                        0x55b20 <redacted> + 60
25 QuartzCore                     0xc7078 <redacted> + 48
26 QuartzCore                     0xc52b4 <redacted> + 884
27 QuartzCore                     0xc5cb4 <redacted> + 456
28 CoreFoundation                 0x555dc <redacted> + 176
29 CoreFoundation                 0x55518 <redacted> + 60
30 CoreFoundation                 0x55438 <redacted> + 524
31 CoreFoundation                 0x54284 <redacted> + 2248
32 CoreFoundation                 0x535b8 CFRunLoopRunSpecific + 572
33 Foundation                     0xb6f00 <redacted> + 212
34 Foundation                     0xb6dd4 <redacted> + 64
35 SwiftUI                        0x38bc80 <redacted> + 792
36 SwiftUI                        0x1395d0 <redacted> + 72
37 Foundation                     0xc8058 <redacted> + 724
38 libsystem_pthread.dylib        0x637c _pthread_start + 136
39 libsystem_pthread.dylib        0x1494 thread_start + 8
                    
                  
                
                    
                      Hi. If the app is in landscape only and when the SKStoreProductViewController is presented, the safeArea changes to what looks like a portrait mode safe area. When the SKStoreProductViewController is dismissed, the safeArea does NOT revert back to the original values.
Is there a way to force the safeArea to "reset"? I've submitted some bug tickets through Apple Feedback but I haven't received any response about it.
The below code will pop up the SKStoreProductViewController and if you have a UIView that is constrained to the safe area, then you can visibly notice that the safe area is changed and doesn't go back.
I have tested this on iPhone 14 Pro, iPhone 15, and iPhone 16 Pro and in the Simulators. The incorrect behavior happens on those and probably more.
Thanks.
#import "ViewController.h"
#import &lt;StoreKit/StoreKit.h&gt;
@interface ViewController ()
@property (nonatomic, strong) SKStoreProductViewController *productViewController;
@end
@implementation ViewController
- (IBAction)buttonTapped:(id)sender {
    self.productViewController = [[SKStoreProductViewController alloc] init];
    NSDictionary *parameters = @{
        @"id" : @"6443575749"
    };
    [self.productViewController loadProductWithParameters:parameters completionBlock:^(BOOL result, NSError * _Nullable error) {
        [self presentViewController:self.productViewController animated:YES completion:^{
            // presented
            // The panel that is constraint to the safe area visibly shows that the safe area is no longer correct.
        }];
    }];
}
@end
                    
                  
                
                    
                      I am trying to implement the NSTextViewDelegate function textViewDidChangeSelection(_ notification: Notification). My text view's delegate is the Coordinator of my NSViewRepresentable. I've found that this delegate function never fires, but any other delegate function that I implement, as long as it doesn't take a Notification as an argument, does fire (e.g., textView(:willChangeSelectionFromCharacterRange:toCharacterRange:), fires and is called on the delegate exactly when it should be).
For context, I've verified all of the below:
textView.isSelectable = true
textView.isEditable = true
textView.delegate === my coordinator
I can call textViewDidChangeSelection(:) directly on the delegate without issue.
I can select and edit text without issues. I.e., the selections are being set correctly. But the delegate method is never called when they are.
I am able to add the intended delegate as an observer for the selector textViewDidChangeSelection via NotificationCenter. If I do this, the function executes when it should, but fires for every text view in my view hierarchy, which can number in the hundreds. I'm using an NSLayoutManager, so I figure this should only fire once. I've added a check within my code:
func textViewDidChangeSelection(_ notification: Notification) {
        
    guard let textView = notification.object as? NSTextView,
      textView === layoutManager.firstTextView else { return }
    // Any code I want to execute...
}
But the above guard check lets through every notification, so, no matter what, my closure executes hundreds of times if I have hundreds of text views, all of them being sent by textView === layoutManager.firstTextView, but once for each and every text view managed by that layoutManager.
Does anyone know why this method isn't ever called on the delegate, while seemingly all other delegate methods are? I could go the NotificationCenter route, but I'd love to know why this won't execute as a delegate method when documentation says that it should, and I don't want to have to implement a counter to make sure my code only executes once per selection update. And for more reasons than that, implementing via delegate method is preferable to using notifications for my use case.
Thanks for any help!
                    
                  
                
                    
                      How can I achieve the result of buttons glass effect like sample videos that was show at de WWDC25? I tried a lot of approaches and I still far a way from the video.
I would like something like the pictures attached. Could send a sample code the get the same result?
Thanks
                    
                  
                
                    
                      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!