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
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
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
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
Hi,
Overview
I have a Mac app with a settings window. When I add a button it is added to the center.
I want it on the trailing edge, I even tried adding it as confirmationAction but doesn’t work.
Screenshot
Feedback
FB21374186
Steps to reproduce
Run the project on mac
Open the app's settings by pressing ⌘ ,
Notice that the Save button is in the center instead of the trailing edge
Code
App
import SwiftUI
@main
struct SettingsToolbarButtonBugApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
Settings {
SettingsView()
.frame(width: 300, height: 400)
}
}
}
SettingsView
import SwiftUI
struct SettingsView: View {
var body: some View {
NavigationStack {
Form {
Text("Settings window")
}
.toolbar {
ToolbarItem(placement: .confirmationAction) {
// Save button is the center instead of trailing edge
Button("Save") {}
}
}
.navigationTitle("Settings")
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
SwiftUI's colorScheme modifier is said to be deprecated in favour of preferredColorScheme but the two work differently. See the below sample app, colorScheme changes the underlying view colour while preferredColorScheme doesn't. Is that a bug of preferredColorScheme?
import SwiftUI
struct ContentView: View {
let color = Color(light: .red, dark: .green)
var body: some View {
VStack {
HStack {
color.colorScheme(.light)
color.colorScheme(.dark)
}
HStack {
color.preferredColorScheme(.light)
color.preferredColorScheme(.dark)
}
}
}
}
#Preview {
ContentView()
}
@main struct TheApp: App {
var body: some Scene {
WindowGroup { ContentView() }
}
}
extension UIColor {
convenience init(light: UIColor, dark: UIColor) {
self.init { v in
switch v.userInterfaceStyle {
case .light: light
case .dark: dark
case .unspecified: fatalError()
@unknown default: fatalError()
}
}
}
}
extension Color {
init(light: Color, dark: Color) {
self.init(UIColor(light: UIColor(light), dark: UIColor(dark)))
}
}
using Version 26.2 (17C52) I often get
"Trace file had no SwiftUI data"
why so?
I'm struggling to implement required code for SB2420 compliance.
I try to learn on a very simple use case.
the app is UIKit
Build in Xcode 26.2
it displays a single Hello view with a button that will simply show a "Good day" label.
I assume the app will be rated 4+.
I tried the following code, using available information in Xcode (limited):
import UIKit
import DeclaredAgeRange
// other import needed ?
class ViewController: UIViewController {
@IBOutlet weak var welcomeLabel: UILabel! // initially hidden
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
func testAgeRange() -> Bool {
if !isEligibleForAgeFeatures { // Not found. Which import needed ?
return true // Not called from Texas
}
// Following code from Xcode doc…
do {
let response = try await AgeRangeService.shared.requestAgeRange(ageGates: 13, 15, 18) // Compiler Error: Missing argument for parameter 'in' in call
// Can I add the 4 gate ?
guard let lowerBound = response.lowerBound else {
// Allow access to under 13 features.
return false
}
var ok = false
if lowerBound >= 18 { // Not needed ?
// Allow access to 18+ features.
ok = true
} else if lowerBound >= 15 { // Not needed ?
// Allow access to 15+ features.
ok = true
} else if lowerBound >= 13 { // Not needed ?
// Require parental consent ?
// Allow access to 13+ features.
ok = true // if consent OK
} else {
// Require parental consent ?
// Show age-appropriate content
ok = true // if consent OK
}
return ok // Authorized for all 4+
} catch AgeRangeService.Error.notAvailable {
// No age range provided.
return false
}
}
func executeStart() {
welcomeLabel.isHidden = false
}
@IBAction func start(_ sender: UIButton) {
if #available(iOS 26.0, *) {
if testAgeRange() {
// Need to test for parental control here ?
} else {
// Alert and exit the app ?
}
} else {
// do nothing ? Can we run the app ?
}
executeStart()
}
}
The logic would be:
before allowing action with the start button, check
is it IOS 26+ so that we can call API
if so, is verification needed (Texas SB2420)
if not, we can proceed
if required, test age range
As app is 4+, all ranges should be OK
But need to test parental control
Now, many pending questions in code:
line 14: get an error: Cannot find 'isEligibleForAgeFeatures' in scope
line 19: I used the documentation sample for AgeRangeService, but get a Compiler Error: Missing argument for parameter 'in' in call
line 35: how to implement parental control ?
In addition, in the metadata of the app, should I declare that parental control ?
Age verification?
Mechanism for confirming that a person's age meets the age requirement for accessing content or services
As there is no restriction on age, is it required ?
Any help welcomed as well as link to a comprehensive tutorial.
How to change the image launch screen using story to show picture display in rotated view when ipad in portrait orientation ?
Current launch screen
-Image Portrait Orientation
-Image Landscape Orientation
-Info Setting
Expected launch screen as below (Not Working)
-Expected Launch Screen
I have uploaded the entire sample source here
The latest iPhone model is unable to retrieve the Wi-Fi information it has connected to. The phone's operating system is iOS 26.1, and location permission has also been granted.
"Access Wi-Fi Information" is also configured in the same way
The following is the code I used to obtain Wi-Fi information:
func getCurrentWiFiInfo() -> String? {
guard let interfaces = CNCopySupportedInterfaces() as? [String] else {
return nil
}
for interface in interfaces {
guard let info = CNCopyCurrentNetworkInfo(interface as CFString) as? [String: Any] else {
continue
}
if let ssid = info[kCNNetworkInfoKeySSID as String] as? String,
!ssid.isEmpty {
return ssid
}
}
return nil
}
Hi
I have a NSTextView set as the document of a NSScrollView
scrollView.documentView = textView
I want to programatically scroll to a specific offset in the scrollView. I use the following function and it jumps to the right location:
scrollView.documentOffset = offset
However I would like to animate the scrolling. Any suggestions?
Also to mention, I have not flipped the coordinates of the NSTextView
Thanks
Reza
Topic:
UI Frameworks
SubTopic:
AppKit
I'm adapting for iOS 26, and I found that when pressing and slowly swiping the screen, the section header near the bottom of the navigation bar in the tableview flickers frequently. How can I fix this issue?
Please view the video in the github project: issue.mp4
I need the user to input an emoji but not other characters. I'd like to be able to use an emoji keyboard similar to the one in the Reminders app. How can I do this?
The issue can be reproduced using the simplest code. In Xcode 26 + iOS 26, when a UIBarButtonItem is created using a UIImage, it consistently prints numerous constraint conflict warnings to the console. Below is my test code and the console warnings:
let btn = UIBarButtonItem(systemItem: .trash)
self.toolbarItems = [btn]
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x1083b4550 _TtC5UIKitP33_DDE14AA6B49FCAFC5A54255A118E1D8713ButtonWrapper:0x108374e00.width == _UIButtonBarButton:0x1083e8000.width (active)>",
"<NSLayoutConstraint:0x1083b4aa0 'IB_Leading_Leading' H:|-(2)-[_UIModernBarButton:0x103ac62e0] (active, names: '|':_UIButtonBarButton:0x1083e8000 )>",
"<NSLayoutConstraint:0x1083b4af0 'IB_Trailing_Trailing' H:[_UIModernBarButton:0x103ac62e0]-(2)-| (active, names: '|':_UIButtonBarButton:0x1083e8000 )>",
"<NSLayoutConstraint:0x1083b4fa0 'UIView-Encapsulated-Layout-Width' _TtC5UIKitP33_DDE14AA6B49FCAFC5A54255A118E1D8713ButtonWrapper:0x108374e00.width == 0 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1083b4af0 'IB_Trailing_Trailing' H:[_UIModernBarButton:0x103ac62e0]-(2)-| (active, names: '|':_UIButtonBarButton:0x1083e8000 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
Do you guys know how to fix the render of the text in the accessory view ? If I force the color of text to be .black it work but it will break dark mode, but forcing it .black : .white on color scheme changes makes white to still adapt to what is behind it I have noticed that Apple Music doesn’t have that artifact and it seems to break when images are behind the accessory view
// MARK: - Next Routine Accessory
@available(iOS 26.0, *)
struct NetxRoutinesAccessory: View {
@ObservedObject private var viewModel = RoutineProgressViewModel.shared
@EnvironmentObject var colorSchemeManager: ColorSchemeManager
@EnvironmentObject var routineStore: RoutineStore
@EnvironmentObject var freemiumKit: FreemiumKit
@ObservedObject var petsStore = PetsStore.shared
@Environment(\.colorScheme) private var colorScheme
// Tab accessory placement environment
@Environment(\.tabViewBottomAccessoryPlacement) private var accessoryPlacement
// Navigation callback
var onTap: (() -> Void)?
@State private var isButtonPressed = false
/// Explicit black for light mode, white for dark mode
private var textColor: Color {
colorScheme == .dark ? .trueWhite : .trueBlack
}
/// Returns true when the accessory is in inline/minimized mode
private var isInline: Bool {
accessoryPlacement == .inline
}
var body: some View {
accessoryContent()
.onTapGesture {
onTap?()
}
}
private func accessoryContent() -> some View {
HStack(spacing: 12) {
// Content with smooth transitions
VStack(alignment: .leading, spacing: 2) {
if viewModel.totalTasks == 0 {
Text(NSLocalizedString("Set up routines", comment: "Routines empty state"))
.font(.subheadline.weight(.medium))
.foregroundColor(textColor)
} else if let next = viewModel.nextRoutineTask() {
HStack(spacing: 4) {
Text(NSLocalizedString("Next", comment: "Next routine prefix"))
.font(.caption)
.foregroundColor(textColor)
Text("•")
.font(.caption)
.foregroundColor(textColor)
Text(next.routine.name)
.font(.subheadline.weight(.medium))
.foregroundColor(textColor)
.lineLimit(1)
}
.id("routine-\(next.routine.id)-\(next.time)")
.transition(.opacity.combined(with: .move(edge: .leading)))
HStack(spacing: 4) {
Text(viewModel.petNames(for: next.routine.petIDs))
.font(.caption)
.foregroundColor(textColor)
Text("•")
.font(.caption)
.foregroundColor(textColor)
Text(Routine.displayTimeFormatter.string(from: next.time))
.font(.caption.weight(.medium))
.foregroundColor(colorSchemeManager.accentColor ?? .blue)
}
.id("time-\(next.routine.id)-\(next.time)")
.transition(.opacity.combined(with: .move(edge: .leading)))
} else {
// All tasks completed
Text(NSLocalizedString("All done for today!", comment: "All routines completed"))
.font(.subheadline.weight(.medium))
.foregroundColor(textColor)
.transition(.opacity.combined(with: .scale))
Text("\(viewModel.completedTasks)/\(viewModel.totalTasks) " + NSLocalizedString("tasks", comment: "Tasks count suffix"))
.font(.caption)
.foregroundColor(textColor)
}
}
.animation(colorSchemeManager.reduceMotion ? nil : .snappy(duration: 0.3), value: viewModel.completedTasks)
.animation(colorSchemeManager.reduceMotion ? nil : .snappy(duration: 0.3), value: viewModel.progress)
}
.padding()
.contentShape(.rect)
.animation(colorSchemeManager.reduceMotion ? nil : .snappy(duration: 0.35), value: viewModel.completedTasks)
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
We're using XCode 26.1.1
We do not have resource to adopt Liquid Glass design. Hence, we are using the following workaround
<key>UIDesignRequiresCompatibility</key>
<true/>
This is our Storyboard.
Pre XCode 26
Before XCode 26.1.1, the bottom toolbar looks great.
In XCode 26
However, in XCode 26.1.1, the bottom toolbar buttons seems to "Squish together".
Do anyone have any idea, how I can make UIToolbar works by enabling UIDesignRequiresCompatibility?
Thanks.
Issue: The search functionality in FamilyActivityPicker has disappeared on iPadOS 26.0+. This feature was working in previous versions but is now missing.
Framework: FamilyControls
Expected: Search bar should be available in FamilyActivityPicker to help users find apps quickly.
Actual: Search functionality is completely missing.
Impact: Makes app selection difficult for users with many installed apps.
Is this a known issue? If it's a bug, please address it in an upcoming update. If intentional, guidance on alternatives would be appreciated.
Thank you.