I have an app that records a 32 x 32 rect under the cursor as the user moves it around and it sends it to Flutter.
It suffers from major lag.
Instead of getting 30 fps, I get about 7 fps. That is, there are significant lags between screen grabs.
This on an Intel Mac mini x64 with 15.7.3 and one display.
flutter: NATIVE: ExplodedView framesIn=2 timeSinceStart=1115.7ms gapSinceLastFrame=838.8ms
flutter: NATIVE: ExplodedView framesIn=4 timeSinceStart=1382.6ms gapSinceLastFrame=149.9ms
flutter: NATIVE: ExplodedView framesIn=5 timeSinceStart=1511.0ms gapSinceLastFrame=128.4ms
flutter: NATIVE: ExplodedView framesIn=7 timeSinceStart=1698.3ms gapSinceLastFrame=102.9ms
flutter: NATIVE: ExplodedView STOP polling totalTime=4482.6ms framesIn=28 framesSent=28 acks=28
Here's a testable excerpt:
import ScreenCaptureKit
import CoreMedia
import CoreVideo
import QuartzCore
final class Test: NSObject, SCStreamOutput, SCStreamDelegate {
private let q = DispatchQueue(label: "cap.q")
private var stream: SCStream?
private var lastFrameAt: CFTimeInterval = 0
private var frames = 0
func start() {
SCShareableContent.getExcludingDesktopWindows(false, onScreenWindowsOnly: true) { content, err in
guard err == nil, let display = content?.displays.first else {
print("shareableContent error: \(String(describing: err))"); return
}
let filter = SCContentFilter(display: display, excludingWindows: [])
let config = SCStreamConfiguration()
config.showsCursor = false
config.queueDepth = 1
config.minimumFrameInterval = CMTime(value: 1, timescale: 30)
config.pixelFormat = kCVPixelFormatType_32BGRA
config.width = 32
config.height = 32
config.sourceRect = CGRect(x: 100, y: 100, width: 32, height: 32)
let s = SCStream(filter: filter, configuration: config, delegate: self)
try! s.addStreamOutput(self, type: .screen, sampleHandlerQueue: self.q)
self.stream = s
s.startCapture { startErr in
print("startCapture err=\(String(describing: startErr))")
}
// Optional: move sourceRect at 30Hz (cursor-follow simulation)
Timer.scheduledTimer(withTimeInterval: 1.0/30.0, repeats: true) { _ in
let c2 = SCStreamConfiguration()
c2.showsCursor = false
c2.queueDepth = 1
c2.minimumFrameInterval = CMTime(value: 1, timescale: 30)
c2.pixelFormat = kCVPixelFormatType_32BGRA
c2.width = 32
c2.height = 32
let t = CACurrentMediaTime()
c2.sourceRect = CGRect(x: 100 + (sin(t) * 50), y: 100, width: 32, height: 32)
s.updateConfiguration(c2) { _ in }
}
}
}
func stream(_ stream: SCStream, didOutputSampleBuffer sb: CMSampleBuffer, of type: SCStreamOutputType) {
guard type == .screen else { return }
let now = CACurrentMediaTime()
let gapMs = (lastFrameAt == 0) ? 0 : (now - lastFrameAt) * 1000
lastFrameAt = now
frames += 1
if frames <= 10 || frames % 60 == 0 {
print("frames=\(frames) gapMs=\(String(format: "%.1f", gapMs))")
}
}
}
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
Created
I started to use the Accessibility features of UIKit but cannot get the numbers or labels to show up on UICollectionCells. The image here shows a 3x3 matrix with no numbers, but the numbers on the menu commands show up.
Actually these are just iOS accessibility features, not my app.
I've tried reducing the size of my images or no images, but nothing shows up (in any of my UICollection code). I can get them to work on UITableView cells. I've tried the Accessibility selection in the storyboard or code, but nothing helps.
Problem
When a List / Form is added inside a TabView and navigationTitle is set, then switching between tabs causes the navigation title to flicker.
Feedback:
FB21436493
Environment
Xcode: 26.2 (17C52)
iOS: 26.2 (23C55)
Reproducible on: Both simulator and device
Root cause
When List / Form is commented out, issue doesn't occur
Steps to Reproduce
Run app on iOS
Switch between tabs
Notice that the navigation title flickers
Code
ContentView
import SwiftUI
struct ContentView: View {
@State private var selectedTab = TabItem.red
var body: some View {
NavigationStack {
TabView(selection: $selectedTab) {
ForEach(TabItem.allCases, id: \.self) { tab in
Tab(tab.rawValue, systemImage: tab.systemImageName , value: tab) {
// Problem occurs with a List / Form
// Commenting out list works without flickering title
List {
Text(tab.rawValue)
}
}
}
}
.navigationTitle(selectedTab.rawValue)
}
}
}
TabItem
enum TabItem: String, CaseIterable {
case red
case green
case blue
var systemImageName: String {
switch self {
case .red:
"car"
case .green:
"leaf"
case .blue:
"bus"
}
}
}
Screen recording:
Topic:
UI Frameworks
SubTopic:
SwiftUI
I am trying to set an image as the background in the window of a DMG. The image is: PNG file; 144x144 resolution; 1138x574 size.
In macOS Tahoe, the image is added by: selecting the DMG window; opening the "Show View Options" dialog; clicking on "Picture"; dragging the image file to the small square box labelled "Drag image here"; closing "Show View Options" dialog. The DMG is then ejected. In Disk Utility, the image file is converted to "Read Only image (UDRO)".
The converted image file is opened and the background image is visible. The image file is then copied to a MacBook running macOS 12 Monterey and opened. The background image is NOT shown. The image file is copied to a Mac mini running macOS 14 Sequoia and opened. The background image is NOT shown.
Have read past online discussions in which it was explained that an image file called "background" should be inside a hidden folder called ".background". The above procedure did not do that. Is that old advice still correct for macOS Tahoe ?
Has Tahoe somehow broken the method used for setting the background of a Window ?
Is the method used in Tahoe different to past versions of macOS ? If so, is there a way of maintaining compatibility with old versions of macOS ?
Is there any documentation on how to set the background image of a DMG window which might explain this behaviour ??
Thanks.
Environment
Device: iPad Air (5th generation, M1)
OS Version: iPadOS 26.1
Device Orientation Lock: OFF
Stage Manager / Multitasking: Disabled
App Mode: Full screen (UIRequiresFullScreen = true)
Supported Orientations:
iPhone: Portrait + Landscape
iPad: Landscape only
Description
On iPadOS 26.x, when device orientation lock is OFF, iPad apps that support only landscape orientation can be displayed in portrait orientation, even though portrait is explicitly not supported for iPad.
This issue:
Occurs not only at app launch
Can also happen during runtime, such as:
Returning to the app from background
Unlocking the device
Rotating the device while the app is running
Switching focus (Control Center, Notification Center, multitasking gestures)
When orientation lock is ON, the system consistently respects the app’s supported interface orientations and the issue does not occur.
This behavior is a regression in iPadOS 26.x.
Expected Behavior
Regardless of device orientation lock state:
The system should never display an app in an unsupported orientation
supportedInterfaceOrientations must always be enforced
Physical device orientation should only be applied within supported orientations
Actual Behavior
With orientation lock OFF:
The system can force the app into portrait orientation
This happens even though portrait is not listed in UISupportedInterfaceOrientations~ipad
The app UI becomes incorrectly laid out or broken
With orientation lock ON:
Orientation behavior is correct and stable
This suggests iPadOS 26.x is allowing device orientation to override supportedInterfaceOrientations during runtime.
Info.plist Configuration
UIRequiresFullScreen
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UISupportedInterfaceOrientations~ipad
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
Topic:
UI Frameworks
SubTopic:
General
Problem
For a mac app, when the Settings view that uses @Environment(\.dismiss) it causes the subview's models to be created multiple times.
Environment
macOS: 26.2 (25C56)
Feedback
FB21424864
Code
App
@main
struct DismissBugApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
Settings {
SettingsView()
}
}
}
ContentView
struct ContentView: View {
var body: some View {
Text("Content")
}
}
SettingsView
struct SettingsView: View {
@Environment(\.dismiss) private var dismiss
var body: some View {
VStack {
Text("Settings")
SectionAView()
}
}
}
SectionAView
struct SectionAView: View {
@State private var model = SectionAViewModel()
var body: some View {
Text("A")
.padding(40)
}
}
SectionAViewModel
@Observable
class SectionAViewModel {
init() {
print("SectionAViewModel - init")
}
deinit {
print("SectionAViewModel - deinit")
}
}
Steps to reproduce (refer to the attached video)
1 - Run the app on the mac
2 - Open app's Settings
3 - Notice the following logs being printed in the console:
SectionAViewModel - init
SectionAViewModel - init
4 - Tap on some other app, so that the app loses focus
5 - Notice the following logs being printed in the console:
SectionAViewModel - init
SectionAViewModel - deinit
6 - Bring the app back to focus
7 - Notice the following logs being printed in the console:
SectionAViewModel - init
SectionAViewModel - deinit
Refer to screen recording
Topic:
UI Frameworks
SubTopic:
SwiftUI
NSApplicationDelegate.application(_:open:) gets the files it needs to read from the file URLs given. There are similar older functions that use a String to identify the file. What format are those strings expecting? A path name? An URL?
I have the following code (compile as a standalone file):
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (strong) NSWindow *window;
@end
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
// Create main window
self.window = [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 800, 600)
styleMask:(NSWindowStyleMaskTitled |
NSWindowStyleMaskClosable |
NSWindowStyleMaskResizable |
NSWindowStyleMaskMiniaturizable)
backing:NSBackingStoreBuffered
defer:NO];
[self.window setTitle:@"Nested ScrollView Demo"];
[self.window makeKeyAndOrderFront:nil];
// Split view controller
NSSplitViewController *splitVC = [[NSSplitViewController alloc] init];
// Sidebar
NSViewController *sidebarVC = [[NSViewController alloc] init];
sidebarVC.view = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 200, 600)];
sidebarVC.view.wantsLayer = YES;
NSSplitViewItem *sidebarItem = [NSSplitViewItem sidebarWithViewController:sidebarVC];
sidebarItem.minimumThickness = 150;
sidebarItem.maximumThickness = 400;
[splitVC addSplitViewItem:sidebarItem];
// Content view controller
NSViewController *contentVC = [[NSViewController alloc] init];
// Vertical scroll view (outer)
NSScrollView *verticalScrollView = [[NSScrollView alloc] initWithFrame:NSMakeRect(0, 0, 600, 600)];
verticalScrollView.automaticallyAdjustsContentInsets = YES;
verticalScrollView.hasVerticalScroller = YES;
verticalScrollView.hasHorizontalScroller = NO;
verticalScrollView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
NSView *verticalContent = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 600, 1200)];
verticalContent.wantsLayer = YES;
verticalContent.layer.backgroundColor = [[NSColor blueColor] CGColor];
[verticalScrollView setDocumentView:verticalContent];
// Add several horizontal scroll sections
CGFloat sectionHeight = 150;
for (int i = 0; i < 5; i++) {
// Horizontal scroll view inside section
NSScrollView *horizontalScroll = [[NSScrollView alloc] initWithFrame:NSMakeRect(0, verticalContent.frame.size.height - (i+1)*sectionHeight - i*20, 600, sectionHeight)];
horizontalScroll.hasHorizontalScroller = YES;
horizontalScroll.hasVerticalScroller = NO;
horizontalScroll.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
NSView *horizontalContent = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 1200, sectionHeight)];
horizontalContent.wantsLayer = YES;
// Add labels horizontally
for (int j = 0; j < 6; j++) {
NSTextField *label = [NSTextField labelWithString:[NSString stringWithFormat:@"Item %d-%d", i+1, j+1]];
label.frame = NSMakeRect(20 + j*200, sectionHeight/2 - 15, 180, 30);
[horizontalContent addSubview:label];
}
horizontalScroll.documentView = horizontalContent;
[verticalContent addSubview:horizontalScroll];
}
contentVC.view = verticalScrollView;
NSSplitViewItem *contentItem = [NSSplitViewItem splitViewItemWithViewController:contentVC];
contentItem.automaticallyAdjustsSafeAreaInsets = YES;
contentItem.minimumThickness = 300;
[splitVC addSplitViewItem:contentItem];
self.window.contentViewController = splitVC;
// Sidebar label
NSTextField *label = [NSTextField labelWithString:@"Sidebar"];
label.translatesAutoresizingMaskIntoConstraints = NO;
[sidebarVC.view addSubview:label];
[NSLayoutConstraint activateConstraints:@[
[label.centerXAnchor constraintEqualToAnchor:sidebarVC.view.centerXAnchor],
[label.centerYAnchor constraintEqualToAnchor:sidebarVC.view.centerYAnchor]
]];
}
@end
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSApplication *app = [NSApplication sharedApplication];
AppDelegate *delegate = [[AppDelegate alloc] init];
[app setDelegate:delegate];
[app run];
}
return 0;
}
Obviously, since the contents of the right part (the content of the sidebar) has its content inset, the horizontal scrolling views cannot extend to the left beneath the sidebar. I can change line 39 to say verticalScrollView.automaticallyAdjustsContentInsets = NO; which will make the inner horizontal scroll views able to extend below the sidebar, but then I'd lose out on the automatic inset management to not have other content overlap beneath the sidebar. So what can I do here? I've tried manually changing the frame of the inner scroll views to start on a negative x, but that does not allow me to scroll all the way to the leftmost content. I'm hoping I won't have to adjust for safe areas manually for the outer scroll view.
I'd also appreciate tips on how to fix the fact that veritical scrolling doesn't work when your mouse is in a horizontal scroll view.
Thanks!
P.S. same thing also exists on UIKit.
Issue Description
I'm experiencing a bizarre SwiftUI state update issue that only occurs in Xcode development environment (both Canvas preview and device debugging), but does not occur in production builds downloaded from App Store.
Symptom:
User taps a button that modifies a @State variable inside a .sheet
Console logs confirm the state HAS changed
But the UI does not update to reflect the new state
Switching to another file in Xcode and back to ContentView instantly fixes the issue
The production build (same code) works perfectly fine
Environment
Xcode: 16F6 (17C52)
iOS: 26.2 (testing on iPhone 13)
macOS: 25.1.0 (Sequoia)
SwiftUI Target: iOS 15.6+
Issue: Present in both Xcode Canvas and on-device debugging
Production: Same code works correctly in App Store build (version 1.3.2)
Code Structure
Parent View (ContentView.swift)
struct ContentView: View { @State private var selectedSound: SoundTheme = .none @State private var showSoundSheet = false var body: some View { VStack { // Display button shows current selection SettingButton( title: "Background Sound", value: getLocalizedSoundName(selectedSound) // ← Not updating ) { showSoundSheet = true } } .sheet(isPresented: $showSoundSheet) { soundSelectionView } } private var soundSelectionView: some View { ForEach(SoundTheme.allCases) { sound in Button { selectedSound = sound // ← State DOES change (confirmed in console) // Audio starts playing correctly audioManager.startAmbientSound(sound) } label: { Text(sound.name) } } } private func getLocalizedSoundName(_ sound: SoundTheme) -> String { // Returns localized name return sound.localizedName }}
What I've Tried
Attempt 1: Adding .id() modifier
SettingButton(...) .id(selectedSound) // Force re-render when state changes
Result: No effect
Attempt 2: Moving state modification outside withAnimation
// Before (had animation wrapper):withAnimation { selectedSound = sound}// After (removed animation):selectedSound = sound
Result: No effect
Attempt 3: Adding debug print() statements
selectedSound = soundprint("State changed: (selectedSound)") // ← Adding this line FIXES the issue!
Result: Mysteriously fixes the issue! But removing print() breaks it again.
This suggests a timing/synchronization issue in Xcode's preview system.
Observations
What works:
✅ Console logs confirm state changes correctly
✅ Switching files in Xcode triggers view reconstruction → everything works
✅ Production build from App Store works perfectly
✅ Adding print() statements "fixes" it (likely changes execution timing)
What doesn't work:
❌ Initial file load in Xcode
❌ Hot reload / incremental updates
❌ Both Canvas preview and on-device debugging
Workaround that works:
Click another file in Xcode
Click back to ContentView.swift
Everything works normally
Key Question
Is this a known issue with Xcode 16's SwiftUI preview/hot reload system?
The fact that:
Same exact code works in production
Adding print() "fixes" it
File switching triggers reconstruction that fixes it
...all suggest this is an Xcode tooling issue, not a code bug.
However, it makes development extremely difficult as I can't reliably test changes without constantly switching files or killing the app.
What I'm Looking For
Confirmation: Is this a known Xcode 16 issue?
Workaround: Any better solution than constantly switching files?
Root cause: What's causing this state update timing issue?
Any insights would be greatly appreciated!
Topic:
UI Frameworks
SubTopic:
SwiftUI
Code example:
//
// ListSafeAreaBarKeyboardTextField.swift
// Exploration
import SwiftUI
import Foundation
struct ListSafeAreaBarKeyboardTextField: View {
@State private var typedText: String = ""
@FocusState private var focusingTextField: Bool
private let items = Array(1...16)
var body: some View {
ScrollViewReader { proxy in
List(items, id: \.self) { number in
Text("Item \(number)")
.id(number)
}
.onAppear {
if let lastItem = items.last {
proxy.scrollTo(lastItem, anchor: .bottom)
}
}
.onChange(of: focusingTextField) { oldValue, newValue in
// This simply won't work
// ~ 12th - 16th item will still get covered by keyboard
if newValue == true {
// Delay to allow keyboard animation to complete
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
if let lastItem = items.last {
withAnimation {
proxy.scrollTo(lastItem, anchor: .top)
}
}
}
}
}
}
.scrollDismissesKeyboard(.interactively)
.safeAreaBar(edge: .bottom) {
TextField("Type here", text: $typedText, axis: .vertical)
.focused($focusingTextField)
// Design
.padding(.horizontal, 16)
.padding(.vertical, 10)
.glassEffect()
// Paddings
.padding(.horizontal, 24)
.padding(.vertical, 12)
}
}
}
I have a Mac application that uses the NSEvent.addLocalMonitorForEvents API to receive all mouse movement events. It receives all the mouse movement events and calculate the event reporting rate.
The code used as following:
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!")
}
.frame(width: 400, height: 400)
.padding()
.onAppear() {
// here
NSEvent.addLocalMonitorForEvents(matching: [.mouseMoved]) { event in
print(event.timestamp)
return event
}
}
}
}
With the exact same code, before I upgraded my macOS to the latest version 26.2, I could receive approximately 460+ mouse events per second, this matched the hardware reporting frequency of my mouse device perfectly.
However, after upgrading to version 26.2, I noticed that the number of mouse events received per second is limited to match the screen refresh rate: when I set the screen refresh rate to 60Hz, I only receive 60 mouse events per second; when set to 120Hz, I receive 120 events per second.
It is clear that some changes has be delivered in macOS 26.2, which by default downsamples the frequency of mouse events reported to applications to align with the screen refresh rate.
The question is how can I reteive all the original mouse events in macOS 26.2? I tried to search and dig, bug no any related APIs found.
Topic:
UI Frameworks
SubTopic:
AppKit
Description:
When following Apple's WWDC guidance to hide the default Liquid Glass background on a ToolbarItem using .sharedBackgroundVisibility(.hidden) and draw a custom circular progress ring, a rectangular rendering artifact appears during navigation bar transition animations (e.g., when the navigation bar dims/fades during a push/pop transition).
Steps to Reproduce:
Create a ToolbarItem with a custom circular view (e.g., a progress ring using Circle().trim().stroke()).
Apply .sharedBackgroundVisibility(.hidden) to hide the default Liquid Glass background.
Navigate to a detail view (triggering a navigation bar transition animation).
Observe the ToolbarItem during the transition.
Expected Result:
The custom circular view should transition smoothly without any visual artifacts.
Actual Result:
A rectangular bounding box artifact briefly appears around the custom view during the navigation bar's dimming/transition animation. The artifact disappears after the transition completes.
Attempts to Resolve (All Failed):
Using .frame(width: 44, height: 44) with .aspectRatio(1, contentMode: .fit)
Using .fixedSize() instead of explicit frame
Using Circle().fill() as a base view with .overlay for content
Using Button with .buttonStyle(.plain) and Color.clear placeholder
Various combinations of .clipShape(Circle()), .contentShape(Circle()), .mask(Circle())
Workaround Found (Trade-off):
Removing .sharedBackgroundVisibility(.hidden) eliminates the rectangular artifact, but this prevents customizing the Liquid Glass appearance as intended by the API.
Code Sample:
swift
if #available(iOS 26.0, *) {
ToolbarItem {
Button {
// action
} label: {
Color.clear
.frame(width: 32, height: 32)
.overlay {
ZStack {
// Background arc (3/4 circle)
Circle()
.trim(from: 0, to: 0.75)
.stroke(Color.blue.opacity(0.3), style: StrokeStyle(lineWidth: 4, lineCap: .round))
.rotationEffect(.degrees(135))
.frame(width: 28, height: 28)
// Progress arc
Circle()
.trim(from: 0, to: 0.5) // Example: 50% progress
.stroke(Color.blue, style: StrokeStyle(lineWidth: 4, lineCap: .round))
.rotationEffect(.degrees(135))
.frame(width: 28, height: 28)
Text("50")
.font(.system(size: 12, weight: .bold))
.foregroundStyle(Color.blue)
Text("100")
.font(.system(size: 8, weight: .bold))
.foregroundStyle(.primary)
.offset(y: 12)
}
.background {
Circle()
.fill(.clear)
.glassEffect(.clear.interactive(), in: Circle())
}
}
}
.buttonStyle(.plain)
}
.sharedBackgroundVisibility(.hidden) // ⚠️ This modifier causes the rectangular artifact during transitions
}
Environment:
iOS 26 Beta
Topic:
UI Frameworks
SubTopic:
SwiftUI
We are facing a UI layout issue while using VisionKit (VNDocumentCameraViewController) for document scanning.
After capturing a document, an unexpected extra blank space appears above the “Retake” and “Keep” action bar also in Bottom. This extra space is not part of our custom UI and seems to be introduced by VisionKit itself.
This issue impacts the final scan preview layout and reduces usable screen space, especially noticeable on devices all the device iPhone or
iPad
Hello — I’m integrating DeclaredAgeRange to check >=18 at app registration, but the API keeps returning AgeRangeService.Error.notAvailable. I’ve tried family sharing and sandbox age settings without success. Below is a minimal environment, the exact code I call, my concise questions, and the expected behaviour. I can attach Console logs and screenshots if helpful.
Environment
Xcode: 26.2
Device OS: iOS 26.2 on real device
Capabilities: Declared Age Range capability enabled in Xcode entitlements
Framework integration: DeclaredAgeRange framework imported/linked in the project
App compiled and installed from Xcode using development provisioning profile
Device main Apple ID: I attempted both (a) Family‑Sharing child account logged in as device main Apple ID and (b) sandbox App Store account age settings via Settings → App Store → Sandbox Account → Manage → Age Verification
Minimal code I
if #available(iOS 26.2, *) { #if canImport(DeclaredAgeRange) do { let response = try await AgeRangeService.shared.requestAgeRange(ageGates: 18, in: self) switch response { case let .sharing(range): // handle range case .declinedSharing: // handle declined @unknown default: // handle unknown } } catch let err as AgeRangeService.Error { if case .notAvailable = err { print("AgeRange notAvailable") } else { print("AgeRange other error: \(err)") } } catch { print("AgeRange generic error: \(error)") } #endif }
Key questions (please answer briefly)
Must the device main Apple ID be a Family‑Sharing child account (created/managed by a parent) for DeclaredAgeRange to ever return .sharing? Or can the App Store “Sandbox Account → Age Verification” produce a shareable result for this API?
If the device main Apple ID must be a family child account, is there any Apple-side flag/setting (server-side) that Apple support must enable for that Apple ID to be eligible for age sharing?
Does App Store Connect / app metadata / age rating or entitlements require any special setting for DeclaredAgeRange to work in the sandbox/dev environment?
Are there known region/locale constraints (e.g., device region must be US) that commonly cause .notAvailable?
What Console/system logs should I capture and attach to help determine whether the request reaches Apple backend vs. is blocked locally? (exact log names/filters welcome)
Is there a canonical sandbox test flow doc for family/parent flows DeclaredAgeRange that guarantees a working test sequence?
Topic:
UI Frameworks
SubTopic:
UIKit
Hello,
I am developing a macOS app using AudioToolbox's MusicSequence and MusicPlayer APIs to play Standard MIDI Files.
The MIDI playback works correctly and I can hear sound from the external MIDI device. However, the user callback registered via MusicSequenceSetUserCallback is never invoked during playback.
Details:
Callback registration returns no error.
MusicPlayer is properly started and prerolled.
The callback is defined as a global function with the correct @convention(c) signature.
I have tried commenting out MusicTrackSetDestMIDIEndpoint to avoid known callback suppression issues.
The clientData pointer is passed and correctly unwrapped in the callback.
Minimal reproducible example shows the same behavior.
Environment:
macOS version: [Tahoe 26.2]
Xcode version: [26.2]
Is it expected that MusicSequenceSetUserCallback callbacks may not be called in some cases?
Are there additional steps or configurations required to ensure the callback is triggered during MIDI playback?
Thank you for any advice or pointers.
Execute playTest() in the viewDidLoad() method of the ViewController.
extension ViewController {
private func playTest() {
NewMusicSequence(&sequence)
if let midiFileURL = Bundle.main.url(forResource: "etude", withExtension: "mid") {
MusicSequenceFileLoad(sequence!, midiFileURL as CFURL, .midiType,MusicSequenceLoadFlags())
NewMusicPlayer(&player)
MusicPlayerSetSequence(player!, sequence!)
MusicPlayerPreroll(player!)
let status = MusicSequenceSetUserCallback(sequence!, musicSequenceUserCallback, Unmanaged.passUnretained(self).toOpaque())
if status == noErr {
print("Callback registered successfully")
} else {
print("Callback registration failed: \(status)")
}
MusicPlayerStart(player!)
} else {
print("MIDI File Not Found")
}
}
}
The callback function was generated by Xcode and defined outside the ViewController.
func musicSequenceUserCallback(
clientData: UnsafeMutableRawPointer?,
sequence: MusicSequence,
track: MusicTrack,
eventTime: MusicTimeStamp,
eventData: UnsafePointer<MusicEventUserData>,
startSliceBeat: MusicTimeStamp,
endSliceBeat: MusicTimeStamp
) {
print("User callback fired at eventTime: \(eventTime)")
if let clientData = clientData {
let controller = Unmanaged<ViewController>.fromOpaque(clientData).takeUnretainedValue()
// Example usage to prove round-trip works (avoid strong side effects in callback)
_ = controller.view // touch to silence unused warning if needed
print("Callback has access to ViewController: \(controller)")
} else {
print("clientData was nil")
}
}
Hi everyone 👋
I’m fairly new to iOS development and I’ve been stuck on a SwiftUI issue for a while now, so I’m hoping someone here can spot what I’m doing wrong.
I’m using navigationTransition(.zoom) together with matchedTransitionSource to animate navigation between views. The UI consists of a grid of items (currently a LazyVGrid, though the issue seems unrelated to laziness). Tapping an item zooms it into its detail view, which is structurally the same view type and can contain further items.
All good expect that interactive swipe-back sometimes causes the item to disappear from the grid once the parent view is revealed. This only happens when dismissing via the drag gesture; it does not occur when using the back button.
I’ve attached a short demo showing the issue and the Swift file containing the relevant view code.
Is there something obvious I’m doing wrong with navigationTransition / matchedTransitionSource, or is this a known limitation or bug with interactive swipe-back?
Thanks in advance.
import SwiftUI
struct TestFileView: View {
@Namespace private var ns: Namespace.ID
let nodeName: String
let children: [String]
let pathPrefix: String
private func transitionID(for childName: String) -> String {
"Zoom-\(pathPrefix)->\(childName)"
}
private let columns = Array(repeating: GridItem(.flexible(), spacing: 12), count: 3)
var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: 12) {
Text(nodeName)
.font(.title.bold())
.padding(.bottom, 6)
LazyVGrid(columns: columns, spacing: 12) {
ForEach(children, id: \.self) { childName in
let id = transitionID(for: childName)
NavigationLink {
TestFileView(
nodeName: childName,
children: childrenFor(childName),
pathPrefix: "\(pathPrefix)/\(childName)"
)
.navigationTransition(.zoom(sourceID: id, in: ns))
} label: {
TestFileCard(title: childName)
.matchedTransitionSource(id: id, in: ns)
}
.buttonStyle(.plain)
}
}
}
.padding()
}
}
private func childrenFor(_ name: String) -> [String] {
switch name {
case "Lorem": return ["Ipsum", "Dolor", "Sit"]
case "Ipsum": return ["Amet", "Consectetur"]
case "Dolor": return ["Adipiscing", "Elit", "Sed"]
case "Sit": return ["Do", "Eiusmod"]
case "Amet": return ["Tempor", "Incididunt", "Labore"]
case "Adipiscing": return ["Magna", "Aliqua"]
case "Elit": return ["Ut", "Enim", "Minim"]
case "Tempor": return ["Veniam", "Quis"]
case "Magna": return ["Nostrud", "Exercitation"]
default: return []
}
}
}
struct TestFileCard: View {
let title: String
var body: some View {
VStack(alignment: .leading, spacing: 8) {
Image(systemName: "square.stack.3d.up")
.symbolRenderingMode(.hierarchical)
.font(.headline)
Text(title)
.font(.subheadline.weight(.semibold))
.lineLimit(2)
.minimumScaleFactor(0.85)
Spacer(minLength: 0)
}
.padding(12)
.frame(maxWidth: .infinity, minHeight: 90, alignment: .topLeading)
.background(.thinMaterial, in: RoundedRectangle(cornerRadius: 14, style: .continuous))
}
}
private struct TestRoot: View {
var body: some View {
NavigationStack {
TestFileView(
nodeName: "Lorem",
children: ["Ipsum", "Dolor", "Sit"],
pathPrefix: "Lorem"
)
}
}
}
#Preview {
TestRoot()
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Dear Apple Customer Support,
I’m developing a new Swift iPadOS app and I want the app to run in landscape only (portrait disabled).
In Xcode, under Target > General > Deployment Info > Device Orientation, if I select only Landscape Left and Landscape Right, the app builds successfully, but during upload/validation I receive this message and the upload is blocked:
“Update the Info.plist: Support for all orientations will soon be required.”
Could you please advise what the correct/recommended way is to keep an iPad app locked to landscape only while complying with the current App Store upload requirements?
Is there a specific Info.plist configuration (e.g., UISupportedInterfaceOrientations~ipad) or another setting that should be used?
Thank you,
Hello,
I am experiencing a layout glitch when using the new .navigationTransition(.zoom) in SwiftUI on iOS 18+. While the primary content transitions smoothly, the Navigation Bar elements (Title and ToolbarItems) of the source view exhibit an unwanted horizontal sliding animation during the transition.
The Problem: As the zoom transition begins, the large inline title and the trailing toolbar buttons do not simply fade out or stay pinned. Instead, they slide to the left of the screen and when destination view is closed they slide back to their place. This creates a "janky" visual effect where the navigation bar appears to collapse or shift its coordinate space while the destination view is expanding.
Problem video link:-
Problem
On the macOS when Settings view is closed, the @State model is not deallocated
Feedback
FB21393010
Environment
macOS: 26.2 (25C56)
Xcode: 26.2 (17C52)
Steps to reproduce
Run the project
Open app's 'Settings
Look at the console logs
When model is created SettingsModel - init gets printed
When Settings window is closed SettingsModel - deinit is not printed, meaning it is not deallocated
Code
SettingsModel
import SwiftUI
@Observable
class SettingsModel {
init() {
print("SettingsModel - init")
}
deinit {
print("SettingsModel - deinit")
}
}
SettingsView
import SwiftUI
struct SettingsView: View {
@State var model = SettingsModel()
var body: some View {
Text("Settings")
.font(.largeTitle)
.padding(200)
}
}
App
import SwiftUI
@main
struct SettingsBugApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
Settings {
SettingsView()
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
I have a bunch of Buttons with a .help(Text("Help text")) modifier, inside of a VStack which has its own .help() modifier describing the entire section.
The VStack help shows up only when I hover over the buttons, and the Button help never shows at all.
If I comment out the VStack help, the individual button helps show.
How do I get both to show up properly? I want the VStack to show if I am in the roundedBorder, unless I am over a Button with its own .help modifier.
import SwiftUI
struct BugReport: View {
@State private var testp1 = false
@State private var testp2 = false
var body: some View {
VStack {
Text("Hello, World!")
Button("Test1") {
testp1.toggle()
}
.help("Change the test1")
Button("Test2") {
testp2.toggle()
}
.help("Change the test2")
}
.help("Testing stuff")
.roundedBorder(color: .black)
}
}
#Preview {
BugReport()
}
Topic:
UI Frameworks
SubTopic:
SwiftUI