Hello Apple Developer Community: I have a problem with the fullscreencover. I can see the Things, that shouldn’t be visible behind it.
I’m currently developing with iOS 26 and only there it happens.
I hope you can help me :)
Have a nice day
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
With the new multi-windowing design in iPadOS 26, the behavior of openWindow() has changed.
In iPadOS 18, if I called openWindow(), I would go from a full-screen window to two side-by-side windows. That allowed my app to meet the goal of the user; keep some information on the screen while being able to navigate through the app in the other window.
In iPadOS 26 (beta 3), this no longer works. Instead, a new Window opens ON top of the current window. I am looking for some mechanism to help the user see that two windows are now present and then easily move them on the screen (tiled, side-by-side) or whatever else they would prefer.
I'm unable to find the right combination modifiers to get drag and drop to work using the new .draggable(containerItemID:) and dragContainer(for:in:selection:_:) modifiers. The drag is initiated with the item's ID, the item is requested from the .dragContainer modifier, but the drop closure is never triggered.
Minimal repro:
struct Item: Identifiable, Codable, Transferable {
var id = UUID()
var value: String
static var transferRepresentation: some TransferRepresentation {
CodableRepresentation(contentType: .tab)
}
}
struct DragDrop: View {
@State var items: [Item] = [
Item(value: "Hello"),
Item(value: "world"),
Item(value: "something"),
Item(value: "else")
]
var body: some View {
List(items) { item in
HStack {
Text(item.value)
Spacer()
}
.contentShape(Rectangle())
.draggable(containerItemID: item.id)
.dropDestination(for: Item.self) { items, session in
print("Drop: \(items)")
}
}
.dragContainer(for: Item.self) { itemID in
print("Drag: \(itemID)")
return items.filter { itemID == $0.id }
}
}
}
#Preview("Simple") {
DragDrop()
}
My iOS app supports iOS 18, and I’m using an encrypted CoreML model secured with a key generated from Xcode.
Every few months (around every 3 months), the encrypted model fails to load for both me and my users. When I investigate, I find this error:
coreml Fetching decryption key from server failed: noEntryFound("No records found"). Make sure the encryption key was generated with correct team ID
To temporarily fix it, I delete the old key, generate a new one, re-encrypt the model, and submit an app update. This resolves the issue, but only for a while.
This is a terrible experience for users and obviously not a sustainable solution.
I want to understand:
Why is this happening?
Is there a known expiration or invalidation policy for CoreML encryption keys?
How can I prevent this issue permanently?
Any insights or official guidance would be really appreciated.
The bane of my existence has been designing interfaces where the whole view needs to scroll, but a portion is a List and the other portion is static.
I run into this problem time and again so I was hoping someone has a good solution because we all know that embedding a List view inside ScrollView is a no-go within SwiftUI. It simply doesn't work.
So what is a best practice when you need the whole screen to scroll, but a portion is a List? Use a navigation stack instead of a ScrollView? What if it's a child view of a navigation stack already?
PhaseAnimator seems a good fit to play gifs in SwiftUI:
struct ContentView: View {
let frames = [UIImage(named: "frame-1")!, UIImage(named: "frame-2")!]
var body: some View {
PhaseAnimator(frames.indices) { index in
Image(uiImage: frames[index])
}
}
}
The problem is that by default, there's an opacity transition between phases. So I tried using transition(.identity):
Image(uiImage: gif[index])
.transition(.identity)
.id(index)
It doesn't work. It stays frozen on the first frame.
It does work if I set the transition to a small offset value:
Image(uiImage: gif[index])
.transition(.offset(x: 0, y: 0.1))
.id(index)
It does feel a bit hacky, though.
Is this the expected behavior for .transition(.identity), or is it a bug?
Is there any way to change the color of default items like Back button or Search?
Even if I apply .tint() to a view these items in the .toolbar are always in primary color.
I have a More button in my nav bar that contains a Delete action, and when you tap that I want to show a confirmation dialog before performing the deletion. In order words, I have a toolbar containing a toolbar item containing a menu containing a button that when tapped needs to show a confirmation dialog.
In iOS 26, you're supposed to add the confirmationDialog on the view that presents the action sheet so that it can point to the source view or morph out of it if it's liquid glass. But when I do that, the confirmation dialog does not appear. Is that a bug or am I doing something wrong?
struct ContentView: View {
@State private var showingDeleteConfirmation = false
var body: some View {
NavigationStack {
Text("👋, 🌎!")
.toolbar {
ToolbarItem {
Menu {
Button(role: .destructive) {
showingDeleteConfirmation.toggle()
} label: {
Label("Delete", systemImage: "trash")
}
.confirmationDialog("Are you sure?", isPresented: $showingDeleteConfirmation) {
Button(role: .destructive) {
print("Delete it")
} label: {
Text("Delete")
}
Button(role: .cancel, action: {})
}
} label: {
Label("More", systemImage: "ellipsis")
}
}
}
}
}
}
The Java Swing and AWT MVC model made it easy to develop complex UIs with data interactions that were not described readily in a nested layer that SwiftUI demands. The implicit update model of SwiftUI greatly complicates development of applications that often requires nested components to have to know too much about other components and other structures than their own, because button events and other user interactions cannot readily alter state across layers. A button push on one component then has to be knowledgable about state in other components which have to have that state represented as @State or @Binding etc. and this causes all kinds of wiring to be spread all over the place rather than have a more centralized "state management function" that would be able to look at the world and synchronize the UIs state across changes.
The fact that the compiler get's lost in the weeds when types and signatures don't match in deeper component structures doesn't help because it makes it doubly hard to do refactoring to raise and lower state management within the structure readily, because the compiler just cannot simply tell you that a function or constructor signature is no longer correct.
Again and and again, I reach the point in a new application where I need to make structural changes in components and my data model, and the SwiftUI compiler fails to compile and just reports "I'm lost in the weeds", with no indication of what it was last working on, aside from a particular level in a multi-layered nested UI.
This typically happens when a sub-views construction is not coded correctly because I changed that view and am looking for what broke, by just letting the compiler tell me what is not compatible. This is how refactoring has been done for ages and it's just amazingly frustrating that Apple engineers don't seem to understand nor care about this issue enough to fix it.
Why does this problem persist through version after version of SwiftUI? Is no-one actually using it for anything?
Hello,
I was doing some tasks, and then noticed a small lag/delay when tapping on a Secure field, I tried to investigate it, and noticed this was not my app issue, so I got it into a Playground and the issue is there (Is there in Physical devices, simulator, playground, iPad playground)
So I suppose this can be SwiftUI Issue:
import SwiftUI
struct ContentView: View {
@State var field1: String = ""
@State var field2: String = ""
@State var field3: String = ""
var body: some View {
VStack {
TextField("", text: $field1, prompt: Text("User"))
SecureField("", text: $field2, prompt: Text("pass"))
SecureField("", text: $field3, prompt: Text("uvv"))
}
}
}
So When the focus is set on Field1 TextField, and then you tap the second field, there is a small delay (Even in simulator, there is a small jump trying to show the keyboard, and in an iPad with physical keyboard, the on-screen keyboard is shown).
The console only shows this message:
Cannot show Automatic Strong Passwords for app bundleID: ... due to error: Cannot save passwords for this app. Make sure you have set up Associated Domains for your app and AutoFill Passwords is enabled in Settings
If you change the order of the elements, or some types, this lag disappears. (For example, adding first the SecureField : [SecureField, TextField, SecureField] the Issue disappears.)
(Even tried to add textContentType as password, newPassword and emailAddress without helping any bit.
I've been trying out the new .safeAreaBar modifier for iOS 26, but I cannot seem to notice any difference between that and .safeAreaInset?
The documentation says:
the bar modifier configures the content to support views to automatically extend the edge effect of any scroll view’s the bar adjusts safe area of.
But I can't seem to see that in action.
Hello,
I have a simple example using StateObject and List. When I bind the List(selection:) to a property of the StateObject like this:
List(selection: $viewModel.selectedIndex) { ... }
I noticed that each time I push the view using a NavigationLink, a new instance of the StateObject is created. However, when I pop the view, the deinit of the StateObject is not called.
When is deinit actually expected to be called in this case?
Example code:
import SwiftUI
@main
struct NavigationViewDeinitSampleApp: App {
var body: some Scene {
WindowGroup {
NavigationStack {
ContentView()
}
}
}
}
struct Item: Hashable {
let text: String
}
@MainActor
fileprivate class ContentViewModel: ObservableObject {
@Published var selectedIndex: Int? = nil
init() {
NSLog("ContentViewModel.init")
}
deinit {
NSLog("ContentViewModel.deinit")
}
}
struct ContentView: View {
@StateObject private var model = ContentViewModel()
let items: [Item] = {
return (0...10).map { i in
Item(text: "\(i)")
}
}()
var body: some View {
List(selection: $model.selectedIndex) {
ForEach(items.indices, id: \.self) { idx in
let item = items[idx]
NavigationLink {
ContentView()
} label: {
Text(item.text)
}
}
}
}
}
Interestingly, if I instead use a plain @State variable inside the View:
@State private var selectedIndex: Int?
...
List(selection: $selectedIndex) { ... }
Then the deinit of the StateObject does get called when the view is popped.
Because there's no sign of deinit being triggered in the first pattern, I’m starting to suspect this might be a SwiftUI bug. Has anyone seen this behavior or have more information about it?
Thanks in advance.
Environment:
Xcode: 16.4(16F6)
iOS Simulator: iPhone SE3 iOS16.4(20E247),iPhone SE3 iOS 18.4(22E238)
My iphone 11 pro max in ios 26 is not a liquid glass like other
In this WWDC talk about liquid glass https://developer.apple.com/videos/play/wwdc2025/219/ they mention that there are two variants of liquid glass, regular and clear.
I don't see any way to try the clear variant using the .glassEffect() APIs, they only expose regular, is there some other way to try the clear variant?
I have more than five tabs in a TabView, and on some screens, I'm seeing a navigation bar with the title "More". I understand that this is the default behavior of TabView when there are more than five tabs—iOS automatically creates a "More" screen.
I've set navigationBarHidden = true throughout my app, but the navigation bar still appears on some screens within the "More" section. Is there another way to hide the moreNavigationController or completely remove the navigation bar from the "More" screen?
I'm having some difficulty with a tabview and getting the new search bar to expand from the search icon.
The tabview works so far, it looks fine, tapping on the search opens the view I will be modifying to use the search bar.
snip from my tabview:
var body: some View {
TabView(selection: $selectedTab) {
Tab("Requests", systemImage: "list.bullet", value: .requests) {
OverseerrRequestView(integrationId: integrationId)
}
Tab("Users", systemImage: "person.3", value: .users) {
OverseerrUserView(integrationId: integrationId)
}
Tab("Search", systemImage: "magnifyingglass", value: .search, role: .search) {
NavigationStack {
OverseerrView(integrationId: integrationId)
.searchable(text: $searchString)
}
}
}
.modifier(TabBarMinimizeIfAvailable())
.navigationTitle("Overseerr")
.modifier(NavigationBarInlineIfAvailable())
}
Currently in that view, I have temporarily constructed a search bar that handles the search function (we're searching externally, not just contents in the view)
snip from my view:
.safeAreaInset(edge: .bottom) {
HStack {
Image(systemName: "magnifyingglass")
.foregroundColor(.secondary)
TextField("Search movies, TV or people", text: $query)
.focused($isSearchFieldFocused)
.onSubmit {
Task { await performSearch() }
}
.submitLabel(.search)
.padding(.vertical, 8)
.padding(.horizontal, 4)
if !query.isEmpty {
Button(action: {
query = ""
searchResults = []
Task { await loadTrending() }
}) {
Image(systemName: "xmark.circle.fill")
.foregroundColor(.secondary)
}
}
}
.padding(.horizontal)
.padding(.vertical, 5)
.adaptiveGlass()
.shadow(radius: 8)
.onAppear {
isSearchFieldFocused = false
}
}
Notes: .adaptiveGlass() is a modifier I created to easily apply liquid glass or not depending on OS version, so as not to require the use of #if or #available in the views.
The end goal here:
have the tab view search "tab" open the OverseerrView.swift (Discover) view, activate the animated search bar, and search the input text to the performSearch() function.
I have similar needs on other tab views, and am trying to move away from needing to manually create a search bar, when one should work from the .search role.
Is there an example project with this search in the tab that I can reference? the landmarks sample project sadly did not include one.
I want a different color, one from my asset catalog, as the background of my first ever swift UI view (and, well, swift, the rest of the app is still obj.c)
I've tried putting the color everywhere, but it does't take. I tried with just .red, too to make sure it wasn't me. Does anyone know where I can put a color call that will actually run? Black looks very out of place in my happy app. I spent a lot of time making a custom dark palette.
TIA
KT
@State private var viewModel = ViewModel()
@State private var showAddSheet = false
var body: some View {
ZStack {
Color.myCuteBg
.ignoresSafeArea(.all)
NavigationStack {
content
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .principal) {
Image("cute.image")
.font(.system(size: 30))
.foregroundColor(.beigeTitle)
}
}
}
.background(Color.myCuteBg)
.presentationBackground(.myCuteBg)
.sheet(isPresented: $showAddSheet) {
AddView()
}
.environment(viewModel)
.onAppear {
viewModel.fetchStuff()
}
}
.tint(.cuteColor)
}
@ViewBuilder var content: some View {
if viewModel.list.isEmpty && viewModel.anotherlist.isEmpty {
ContentUnavailableView(
"No Content",
image: "stop",
description: Text("Add something here by tapping the + button.")
)
} else {
contentList
}
}
var contentList: some View {
blah blah blah
}
}
First I tried the background, then the presentation background, and finally the Zstack. I hope this is fixed because it's actually fun to build scrollable content and text with swiftUI and I'd been avoiding it for years.
How to remove the black background for both navigation bar and tab bar when scrolling.
When in light mode, it looks fine.
When navigated to another view with a NavigationStack or NavigationView, the .navigationTitle modifying a List or Form containing a Map() gets quirky when trying to show the title. The back button is displayed correctly, but the title does not follow the same color scheme as the List of Form, rather it is white with a divider underneath it. It's like it is confusing the .inline with the .large navigation display modes. This doesn't just show up in the simulator, but on actual devices too.
This is a test main view...
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationStack {
NavigationLink(destination: MapErrorView()) {
Text("Map View")
}
}
}
}
This is a test navigated view...
import SwiftUI
import MapKit
struct MapErrorView: View {
var body: some View {
NavigationStack {
Form {
Section(header: Text("Map of the US States")) {
Text("Map Error")
Map()
.frame(height: 220)
}
}
.navigationTitle("Map Error")
.navigationBarTitleDisplayMode(.large)
}
}
}
Attached is an image showing this error occurring. Does anyone know how I can get around this without using Text() to mock it? That might be the only way to get around this error.