Because .searchable does not allow for customizing buttons in the search bar, I've manually had to recreate the search bar as shown below. However, when removing one of the items in the search bar, the TextField does not resize correctly and effectively inserts padding on the leading edge. When the TextField is focused, it resizes and fills the entire space. If the "Compose" button was already hidden when the search bar is presented, it lays out correctly. How do I resize the TextField after removing the "Compose" button automatically?
Thanks, jjp
struct ContentView: View {
@State var isSearchBarVisible = false
@State var isComposingMessage = false
@State var searchText = ""
let items: [String] = ["hey", "there", "how", "are", "you"]
var searchItems: [String] {
items.filter { item in
item.lowercased().contains(searchText.lowercased())
}
}
var body: some View {
NavigationStack {
VStack {
List {
if !searchText.isEmpty {
ForEach(searchItems, id: \.self) { item in
Text(item)
}
} else {
ForEach(items, id: \.self) { item in
Text(item)
}
}
}
}
.toolbar {
if isSearchBarVisible {
ToolbarItem(placement: .principal) {
TextField("Search", text: $searchText)
.padding(8)
.background(Color.gray.opacity(0.2))
}
ToolbarItem(placement: .topBarTrailing) {
Button(action: {
isSearchBarVisible = false
},[![enter image description here][1]][1]
label: {
Text("Cancel")
})
}
if !isComposingMessage {
ToolbarItem(placement: .topBarTrailing) {
Button(action: {
isComposingMessage.toggle()
},
label: {
Text("Compose")
})
}
}
}
else {
ToolbarItem(placement: .topBarLeading) {
Button(action: {
isSearchBarVisible = true
},
label: {
Text("Search")
})
}
ToolbarItem(placement: .principal) {
Text("Title")
}
ToolbarItem(placement: .topBarTrailing) {
Button(action: {
isComposingMessage.toggle()
},
label: {
Text("Compose")
})
}
}
}
}
}
}
SwiftUI
RSS for tagProvide views, controls, and layout structures for declaring your app's user interface using SwiftUI.
Posts under SwiftUI tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Summary
When a SwiftUI widget uses a Link containing an Image modified with .widgetAccentedRenderingMode (using any mode except .fullColor), tapping the image on the widget launches the app but does not pass the expected deep link URL to the SceneDelegate.
Steps to Reproduce
Create a SwiftUI Widget View with a Link:
struct ImageView: View {
var image: UIImage
var body: some View {
Link(URL(string: "myapp://image")!) {
Image(uiImage: image)
.resizable()
.widgetAccentedRenderingMode(.accentedDesaturated) // or any mode other than .fullColor
.scaledToFill()
.clipped()
}
}
}
Add Custom URL Scheme in Info.plist:
<dict>
<key>CFBundleURLName</key>
<string>com.company.myapp</string>
<key>CFBundleURLSchemes</key>
<array>
<string>myapp</string>
</array>
</dict>
Implement Deep Link Handling in SceneDelegate:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if let url = connectionOptions.urlContexts.first?.url {
handle(url)
}
}
func scene(_ scene: UIScene, openURLContexts urlContexts: Set<UIOpenURLContext>) {
if let url = urlContexts.first?.url {
handle(url)
}
}
private func handle(_ url: URL) {
// Process URL here
}
Run the application on a device or simulator.
Add the widget to the Home Screen.
Tap the image inside the widget.
Expected Result
The application launches and receives the URL in SceneDelegate, as expected.
Actual Result
The application launches, but the URL is not passed to SceneDelegate.
Both connectionOptions.urlContexts and openURLContexts are empty.
I'm trying to remove the extra top padding from the first section of a SwiftUI List using .plain style. I applied:
.contentMargins(.top, 0, for: .scrollContent)
But it seems to have no effect on iOS 17 and iOS 18.5 when section headers are present. However, it does work correctly on iOS 26 (tested with the latest Xcode beta).
Has anyone else run into this?
Is this a known issue or regression in iOS 17/18?
Is there any reliable workaround to remove or reduce the top padding in .plain list style when using section headers?
I have screenshots comparing iOS 18.5 and iOS 26 if needed.
Thanks in advance!
In my code I use a binding that use 2 methods to get and get a value. There is no problem with swift 5 but when I swift to swift 6 the compiler fails :
Here a sample example of code to reproduce the problem :
`import SwiftUI
struct ContentView: View {
@State private var isOn = false
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
Toggle("change it", isOn: Binding(get: getValue, set: setValue(_:)))
}
.padding()
}
private func getValue() -> Bool {
isOn
}
private func setValue(_ value: Bool) {
isOn = value
}
}`
Xcode compiler log error :
1. Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5) 2. Compiling with the current language version 3. While evaluating request IRGenRequest(IR Generation for file "/Users/xavierrouet/Developer/TestCompilBindingSwift6/TestCompilBindingSwift6/ContentView.swift") 4. While emitting IR SIL function "@$sSbScA_pSgIeAghyg_SbIeAghn_TR". for <<debugloc at "<compiler-generated>":0:0>>Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x000000010910ae24 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000109108c5c llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x000000010910b460 SignalHandler(int) + 360
3 libsystem_platform.dylib 0x0000000188e60624 _sigtramp + 56
4 libsystem_pthread.dylib 0x0000000188e2688c pthread_kill + 296
5 libsystem_c.dylib 0x0000000188d2fc60 abort + 124
6 swift-frontend 0x00000001032ff9a8 swift::DiagnosticHelper::~DiagnosticHelper() + 0
7 swift-frontend 0x000000010907a878 llvm::report_fatal_error(llvm::Twine const&, bool) + 280
8 swift-frontend 0x00000001090aef6c report_at_maximum_capacity(unsigned long) + 0
9 swift-frontend 0x00000001090aec7c llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long) + 384
10 swift-frontend 0x000000010339c418 (anonymous namespace)::SyncCallEmission::setArgs(swift::irgen::Explosion&, bool, swift::irgen::WitnessMetadata*) + 892
11 swift-frontend 0x00000001035f8104 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 4792
12 swift-frontend 0x00000001035c876c (anonymous namespace)::IRGenSILFunction::visitSILBasicBlock(swift::SILBasicBlock*) + 2636
13 swift-frontend 0x00000001035c6614 (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 15860
14 swift-frontend 0x00000001035c2368 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 2788
15 swift-frontend 0x00000001033e7c1c swift::irgen::IRGenerator::emitLazyDefinitions() + 5288
16 swift-frontend 0x0000000103573d6c swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 4528
17 swift-frontend 0x00000001035c15c4 swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)17>::evaluateRequest(swift::IRGenRequest const&, swift::Evaluator&) + 180
18 swift-frontend 0x000000010357d1b0 swift::IRGenRequest::OutputType swift::Evaluator::getResultUncached<swift::IRGenRequest, swift::IRGenRequest::OutputType swift::evaluateOrFatalswift::IRGenRequest(swift::Evaluator&, swift::IRGenRequest)::'lambda'()>(swift::IRGenRequest const&, swift::IRGenRequest::OutputType swift::evaluateOrFatalswift::IRGenRequest(swift::Evaluator&, swift::IRGenRequest)::'lambda'()) + 812
19 swift-frontend 0x0000000103576910 swift::performIRGeneration(swift::FileUnit*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_deleteswift::SILModule>, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**) + 176
20 swift-frontend 0x0000000102f61af0 generateIR(swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_deleteswift::SILModule>, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, llvm::GlobalVariable*&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>>) + 156
21 swift-frontend 0x0000000102f5d07c performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_deleteswift::SILModule>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 2108
22 swift-frontend 0x0000000102f5c0a8 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1036
23 swift-frontend 0x0000000102f5f654 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1764
24 swift-frontend 0x0000000102f5dfd8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3716
25 swift-frontend 0x0000000102ee20bc swift::mainEntry(int, char const**) + 5428
26 dyld 0x0000000188a86b98 start + 6076
Using Xcode 16.4 / Mac OS 16.4
Hi ,
I'm struggling with visionOS window management and need help with closing child windows programmatically.
App Structure
My app has a Main-Sub window hierarchy:
AWindow (Home/Main)
BWindow (Main feature window)
CWindow (Tool window - child of BWindow)
Navigation flow:
AWindow → BWindow (switch, 1 window on screen)
BWindow → CWindow (opens child, 2 windows on screen)
I want BWindow and CWindow to be separate movable windows (not sheet/popover) so users can position them independently in space.
The Problem
CWindow doesn't close when BWindow closes by tapping the X button below the app (next to the window bar)
User clicks X on BWindow → BWindow closes but CWindow remains
CWindow becomes orphaned on screen
Can close CWindow programmatically when switching BWindow back to AWindow
App launch issue
After closing both windows, CWindow is remembered as last window
Reopening app shows only CWindow instead of BWindow
User gets stuck in CWindow with no way back to BWindow
I've Tried Environment dismissWindow in cleanup but its not working.
// In BWindow.swift
.onDisappear {
if windowManager.isWindowOpen("cWindow") {
dismissWindow(id: "cWindow")
}
}
My App Structure Code Now
// in MyNameApp.swift
@main
struct MyNameApp: App {
var body: some Scene {
WindowGroup(id: "aWindow") {
AWindow()
}
WindowGroup(id: "bWindow") {
BWindow()
}
WindowGroup(id: "cWindow") {
CWindow()
}
}
}
// WindowStateManager.swift
class WindowStateManager: ObservableObject {
static let shared = WindowStateManager()
@Published private var openWindows: Set<String> = []
@Published private var windowDependencies: [String: String] = [:]
private init() {}
func markWindowAsOpen(_ id: String) {
markWindowAsOpen(id, parent: nil)
}
func markWindowAsClosed(_ id: String) {
openWindows.remove(id)
windowDependencies[id] = nil
}
func isWindowOpen(_ id: String) -> Bool {
let isOpen = openWindows.contains(id)
return isOpen
}
func markWindowAsOpen(_ id: String, parent: String? = nil) {
openWindows.insert(id)
if let parentId = parent {
windowDependencies[id] = parentId
}
}
func getParentWindow(of childId: String) -> String? {
let parent = windowDependencies[childId]
return parent
}
func getChildWindows(of parentId: String) -> [String] {
let children = windowDependencies.compactMap { key, value in
value == parentId ? key : nil
}
return children
}
func setNextWindowParent(_ parentId: String) {
UserDefaults.standard.set(parentId, forKey: "nextWindowParent")
}
func getAndClearNextWindowParent() -> String? {
let parent = UserDefaults.standard.string(forKey: "nextWindowParent")
UserDefaults.standard.removeObject(forKey: "nextWindowParent")
return parent
}
func forceCloseChildWindows(of parentId: String) {
let children = getChildWindows(of: parentId)
for child in children {
markWindowAsClosed(child)
NotificationCenter.default.post(
name: Notification.Name("ForceCloseWindow"),
object: nil,
userInfo: ["windowId": child]
)
forceCloseChildWindows(of: child)
}
}
func hasMainWindowOpen() -> Bool {
let mainWindows = ["main", "bWindow"]
return mainWindows.contains { isWindowOpen($0) }
}
func cleanupOrphanWindows() {
for (child, parent) in windowDependencies {
if isWindowOpen(child) && !isWindowOpen(parent) {
NotificationCenter.default.post(
name: Notification.Name("ForceCloseWindow"),
object: nil,
userInfo: ["windowId": child]
)
markWindowAsClosed(child)
}
}
}
}
// BWindow.swift
struct BWindow: View {
@Environment(\.dismissWindow) private var dismissWindow
@ObservedObject private var windowManager = WindowStateManager.shared
var body: some View {
VStack {
Button("Open C Window") {
windowManager.setNextWindowParent("bWindow")
openWindow(id: "cWindow")
}
}
.onAppear {
windowManager.markWindowAsOpen("bWindow")
}
.onDisappear {
windowManager.markWindowAsClosed("bWindow")
windowManager.forceCloseChildWindows(of: "bWindow")
}
.onChange(of: scenePhase) { oldValue, newValue in
if newValue == .background || newValue == .inactive {
windowManager.forceCloseChildWindows(of: "bWindow")
}
}
}
}
// CWindow.swift
import SwiftUI
struct cWindow: View {
@ObservedObject private var windowManager = WindowStateManager.shared
@State private var shouldClose = false
var body: some View {
// Content
}
.onDisappear {
windowManager.markWindowAsClosed("cWindow")
NotificationCenter.default.removeObserver(
self,
name: Notification.Name("ForceCloseWindow"),
object: nil
)
}
.onChange(of: scenePhase) { oldValue, newValue in
if newValue == .background {
}
}
.onAppear {
let parent = windowManager.getAndClearNextWindowParent()
windowManager.markWindowAsOpen("cWindow", parent: parent)
NotificationCenter.default.addObserver(
forName: Notification.Name("ForceCloseWindow"),
object: nil, queue: .main) { notification in
if let windowId = notification.userInfo?["windowId"] as? String, windowId == "cWindow" {
shouldClose = true
}
}
}
.onChange(of: shouldClose) { _, newValue in
if newValue {
dismissWindow()
}
}
}
The logs show everything executes correctly, but CWindow remains visible on screen.
Questions
Why doesn't dismissWindow(id:) work in cleanup scenarios?
Is there a proper way to create a window relationships like parent-child relationships in visionOS?
How can I ensure main windows open on app launch instead of tool windows?
What's the recommended pattern for dependent windows in visionOS?
Environment: Xcode 16.2, visionOS 2.0, SwiftUI
We've been trying to track down a non-reproducible issue for the past few months, and I'm wondering if anybody has encountered the same one.
Screenshots of the issue attached here. As you can see, the toolbar isn't respecting the safe area; there are many more issues that occur when this bug happens as well, such as the app being extremely laggy and sheets not opening.
Anecdotally, this seems to happen if the app is opened after not having been opened in a while (say, a day or so). It tends to happen first thing in the morning when I open the app, but as I mentioned, it's been very hard to reproduce.
I'm also wondering if it's a known SwiftUI navigation issue or if anyone has encountered this.
I'm building a visionOS app where users can place canvases into the 3D environment. These canvases are RealityKit entities that render web content using a WKWebView. The web view is regularly snapshotted, and its image is applied as a texture on the canvas surface.
When the user taps on a canvas, a WindowGroup is opened that displays the same shared WKWebView instance. This works great: both the canvas in 3D and the WindowGroup reflect the same live web content.
The canvas owns the WKWebView and keeps a strong reference to it.
Problem:
Once the user closes the WindowGroup, the 3D canvas stops receiving snapshot updates. The snapshot loop task is still running (verified via logs), but WKWebView.takeSnapshot(...) never returns — the continuation hangs forever. No error is thrown, no image is returned.
If the user taps the canvas again (reopening the window), snapshots resume and everything works again.
@MainActor
private func getSnapshot() async -> UIImage? {
guard !webView.isLoading else { return nil }
let config = WKSnapshotConfiguration()
config.rect = webView.bounds
config.afterScreenUpdates = true
return await withCheckedContinuation { continuation in
webView.takeSnapshot(with: config) { image, _ in
continuation.resume(returning: image)
}
}
}
What I’ve already verified:
The WKWebView is still in memory.
The snapshot loop (Task) is still running; it just gets stuck inside takeSnapshot(...).
I tried keeping the WKWebView inside a hidden UIWindow (with .alpha = 0.01, .windowLevel = .alert + 1, and isHidden = false).
Suspicion
It seems that once a WKWebView is passed into SwiftUI and rendered (e.g., via UIViewRepresentable), SwiftUI takes full control over its lifecycle. SwiftUI tells WebKit "This view got closed" and WebKit reacts by stopping the WKWebView. Even though it still exists in memory and is being hold by a strong reference to it in the Canvas-Entity.
Right now, this feels like a one-way path:
Starting from the canvas, tapping it to open the WindowGroup works fine.
But once the WindowGroup is closed, the WebView freezes, and snapshots stop until the view is reopened.
Questions
Is there any way under visionOS to:
Keep a WKWebView rendering after its SwiftUI view (WindowGroup) is dismissed?
Prevent WebKit from suspending or freezing the view?
Embed the view in a persistent system-rendered context to keep snapshotting functional?
For context, here's the relevant SwiftUI setup
struct MyWebView: View {
var body: some View {
if let webView = WebViewManager.shared.getWebView() {
WebViewContainer(webView: webView)
}
}
}
struct WebViewContainer: UIViewRepresentable {
let webView: WKWebView
func makeUIView(context: Context) -> UIView {
return webView
}
func updateUIView(_ uiView: UIView, context: Context) {}
}
SwiftUI.List allows for customization using .listItemTint, .tint, or .foregroundStyle. This can be used to color individual items in the list, other than the app's specified accent color.
Is there an equivalent feature to customize individual Tab's icon or label, when using TabView's SidebarAdaptableTabViewStyle, and its in the sidebar style.
From what I understand, there needs to be a modifier applied directly to Tab unlike List, and not just the label.
Since there isn't any color/tint modifiers, is it not possible?
Hi,
I've wrapped AVRoutePickerView in SwiftUI using pretty much the code given here, with a few changes:
func makeUIView(context: Context) -> UIView {
let routePickerView = AVRoutePickerView()
// Configure the button's color.
//routePickerView.delegate = context.coordinator
//routePickerView.backgroundColor = .secondarySystemBackground
routePickerView.tintColor = .accent
routePickerView.activeTintColor = .accent
// Indicate whether your app prefers video content.
routePickerView.prioritizesVideoDevices = false
return routePickerView
}
I commented out routePickerView.delegate = context.coordinator because it doesn't compile; context.coordinator is of type Void and I'm not sure how to fix that. I'm not sure if that has anything to do with the issue.
Anyway, this works fine without VoiceOver; if I tap the button, I get the AirPlay popover. But in VoiceOver, if I select the button and double-tap, nothing happens… it just reads the button's accessibilityLabel again. How can I get the AirPlay popover to show in VoiceOver?
For some controls it is desirable to not use the morphing transition when presenting a Menu. Instead, you might want to have the old behavior, where the menu is presented above or below the initiating view. This can be the case for any other control than toolbar items, but especially for bigger content cards, that should trigger a menu upon tapping it once. In those cases it looks weird and does not really help to keep context of what the action is doing.
Is there some way to do this right now?
In case it's not, I also filed a feedback.
FB18413055
So many issues with the new sheet design, I don't think I can ship these. And it's both in UIKit and SwiftUI. Honestly these net sheets seem like a failure from start to finish and I don't believe it will get better for the initial release.
Toolbar buttons in medium detent size have very low contrast and look bad with their opaque appearance
During the transition from medium to large detent the whole sheet flickers and turns transparent for a split moment, creating a very jarring transition (video here: https://mastodon.social/@nicoreese/114938826906689965).
In the large detent the background is always white in light mode making the cells bleed into the background making them indistinguishable from it. I should be able to set a background color for the large detent which smoothly transitions to it. Like: glass in medium and system grouped background in large.
Any interaction with the medium detent sheet makes it scale up. Why? It's okay for single interactions but not for when the user taps something in it rapidly. There needs to be a way to disable this behavior.
In the medium detent List/UICollectionView rows are white in light mode or gray in dark mode. Especially in dark mode it looks very bad against the glass background. Those rows should probably be translucent to better fit the glass.
This needs serious fixing and fast.
FB18919680
FB18919657
FB18919600
FB18919549
FB18919496
FB18919630
prefetching logic for UICollectionView on VisionOS does not work.
I have set up a Standalone test repo to demonstrate this issue. This repo is basically a visionOS version of Apple's guide project on implementation of prefetching logic.
in repo you will see a simple ViewController that has UICollectionView, wrapped inside UIViewControllerRepresentable.
on scroll, it should print 🕊️ prefetch start on console to demonstrate func collectionView(_ collectionView: UICollectionView, prefetchItemsAt indexPaths: [IndexPath]) is called. However it never happens on VisionOS devices.
With the same code it behaves correctly on iOS devices
Topic:
Spatial Computing
SubTopic:
General
Tags:
SwiftUI
UIKit
visionOS
iPad and iOS apps on visionOS
When using the fullScreenCover API in iOS 26, the content of the displayed view overlaps the content of the view that triggered the fullScreenCover. This issue is not present in iOS 18 and earlier versions.
Feedback ID: FB19165084
i am struggling to get my tab view to work, when i call views in the action part of my tab view, my background creates issue? does anyone know how to fix this?
struct ContentView: View {
@Environment(.colorScheme) var colorMode
let Color1: Color = .cyan
var Color2: Color {
colorMode == .dark ? .black : .white
}
var TextColor: Color{
colorMode == .dark ? .black : .black
}
let tax: Double = 0.0875
var OptionTypes: [String] = ["Breakfeast", "Lunch", "Dinner", "Dessert", "Drinks"]
var BreakfeastFoods: [Food] = [
Food(Name: "Eggs Benedict", Price: 9.50),
Food(Name: "Avocado Toast", Price: 5.75),
Food(Name: "French Toast", Price: 12.50),
Food(Name: "Waffles", Price: 7.25),
Food(Name: "Pancakes", Price: 8.60)
]
var LunchFoods: [Food] = [
Food(Name: "Tuna Salad", Price: 11.25),
Food(Name: "Pizza", Price: 22.50),
Food(Name: "Chicken Sandwitch", Price: 8.95),
Food(Name: "French Fries", Price: 5.15),
Food(Name: "Macaroni and Cheese", Price: 7.50)
]
var DinnerFoods: [Food] = [
Food(Name: "Ribeye Steak", Price: 18.99),
Food(Name: "Pork Ribs", Price: 21.75),
Food(Name: "Salmon", Price: 15.00),
Food(Name: "Burrito Bowl", Price: 13.99),
Food(Name: "Chicken Fajitas", Price: 20.50)
]
var DessertFoods: [Food] = [
Food(Name: "Ice Cream Sundae", Price: 10.00),
Food(Name: "Fudge Brownie", Price: 4.85),
Food(Name: "Chocolate Cake Slice", Price: 6.10),
Food(Name: "Pumpkin Pie", Price: 6.10),
Food(Name: "Ice Cream Float", Price: 3.50)
]
var Drinks: [Food] = [
Food(Name: "Water", Price: 0.00),
Food(Name: "Sparkling Water", Price: 2.15),
Food(Name: "Soda", Price: 3.00),
Food(Name: "Coffee", Price: 2.50),
Food(Name: "Hot Chocolate", Price: 3.50)
]
@State var MyCart: [Food] = []
var body: some View {
NavigationStack{
ZStack{
LinearGradient(colors: [Color1, Color2], startPoint: .top, endPoint: .bottom).ignoresSafeArea()
VStack(spacing: 40){
ForEach(OptionTypes, id: \.self){
OptionType in
NavigationLink(value: OptionType){
Text(OptionType)
}.frame(width: 250, height: 70).background(LinearGradient(colors: [.cyan, .white,.cyan], startPoint: .topLeading, endPoint: .bottom)).foregroundStyle(TextColor).cornerRadius(100).font(.system(size: 25, weight: .medium)).padding(.top, 16)
}
}.navigationDestination(for: String.self) {
OptionType in
switch OptionType{
case "Breakfeast":
BreakFeastView(BreakfeastList: BreakfeastFoods, Color1: Color1, Color2: Color2)
case "Lunch":
LunchView(LunchList: LunchFoods, Color1: Color1, Color2: Color2)
case "Dinner":
DinnerView(DinnerList: DinnerFoods, Color1: Color1, Color2: Color2)
case "Dessert":
DessertView(DessertList: DessertFoods, Color1: Color1, Color2: Color2)
case "Drinks":
DrinksView(DrinksList: Drinks, Color1: Color1, Color2: Color2)
// case "My Cart":
// MyCartView(MyCartList: MyCart, Color1: Color1, Color2: Color2)
default:
Text("Error")
}
}
} .navigationTitle("Choose Menu")
TabView{
Tab("Menu", systemImage: "fork.knife"){
}
Tab("My-Cart", systemImage: "cart.fill"){
}
Tab("Store Location", systemImage: "mappin"){
}
}
}
}
}
Hi everyone,
I’m currently developing a SwiftUI app that uses SwiftData with CloudKit sharing enabled. The app works fine on my own Apple ID, and local syncing with iCloud is functioning correctly — but sharing with other Apple IDs consistently fails.
Setup:
SwiftUI + SwiftData using a ModelContainer with .shared configuration
Sharing UI is handled via UICloudSharingController
iCloud container: iCloud.com.de.SkerskiDev.FoodGuard
Proper entitlements enabled (com.apple.developer.icloud-services, CloudKit, com.apple.developer.coredata.cloudkit.containers, etc.)
Automatic provisioning profiles created by Xcode
Error:<CKError 0x1143a2be0: "Bad Container" (5/1014);
"Couldn't get container configuration from the server for container iCloud.com.de.SkerskiDev.FoodGuard">
What I’ve tried:
Verified the iCloud container is correctly created and enabled in the Apple Developer portal
Checked bundle identifier and container settings
Rebuilt and reinstalled the app
Ensured correct iCloud entitlements and signing capabilities
Questions:
Why does CloudKit reject the container for sharing while local syncing works fine?
Are there known issues with SwiftData .shared containers and multi-user sharing?
Are additional steps required (App Store Connect, privacy settings) to allow sharing with other Apple IDs?
Any advice, experience, or example projects would be greatly appreciated. 🙏
Thanks!
Sebastian
Hi everyone,
I've noticed that on iOS 26 beta 1 through beta 4, when using a List with the .plain style, the section header overlaps with the cell content below it, as there is no background for the header. This creates a poor visual experience.
Additionally, when using NavigationSplitView on iPad, the second column's list always shows this issue.
Is this an intentional design change, or just a temporary issue? I haven't found a good workaround so far.
Thanks!
FB19066489
iOS 26 Beta 3 finally introduced an API for the clear variant of Liquid Glass. But is there any way to switch system controls like the NavigationController back button or UIBarButtonItems to clear? They do not accept an effect like UIEffectView, and they do not have a configuration property like UIButton.
Hello, I'm adding a CollisionComponent to an entity in RealityView. CollisionComponent requires that a Mesh must be provided as a reference for collision detection. However, in order to achieve more accurate detection, I hope that this Mesh resource is a geometric shape of a USDZ model. Is there any way to make it happen? Thank you!
We are using a TabView as the TabBarController in our app for main navigation. On one of the tabs we have a view that consists of a TabView with .tabViewStyle(.page) in order to scroll horizontally between pages inside of that specific tab.
The .tabBarMinimizeBehavior(.onScrollDown) works on all the other TabItem views, but for this one it does not recognise any vertical scrolling in any of the pages, in order to minimize the TabBar.
I believe this is a bug? If we don't wrap the views inside the TabView with .page style, we are able to get the expected behaviour using the tabBarMinimizeBehavior.
Please let us know if this is going to be fixed in a future iOS 26 beta release.
I have the following SwiftUI code for a draggable UI.
private var onTouchDownGesture: some Gesture {
DragGesture(minimumDistance: 0)
.onChanged { value in
isDragging = true
updateYTranslation(value.translation.height)
}
.onEnded { value in
isDragging = false
updateYTranslation(value.translation.height)
}
}
var body: some View {
VStack {
Image(systemName: "chevron.up")
Spacer()
.frame(height: 16)
Image(systemName: "chevron.down")
}
.padding()
.gesture(onTouchDownGesture)
.glassEffect(.regular.interactive(false))
}
}
I find that if I use glassEffect modifier, then the drag gesture will not work. However, if i change it glasseffectto other kinds of background like .background(Capsule()), then the drag gesture works as expected.
Is this a known issue of glassEffect or am I using it incorrectly?