[Help Wanted] How to remove TextField's intrinsic background in .glassEffect on watchOS 26? #174943
-
BodyEnglish VersionHello everyone, I'm a high school developer. With the release of the brand new watchOS 26 last week, I've updated to Xcode 26 and started adapting my app. I've immediately hit a frustrating UI problem with My Goal: The Problem: My Questions:
Any help would be greatly appreciated. Thank you! 中文版本 (Chinese Version)大家好! 我是一名高二的开发者。就在上周苹果发布了全新的 watchOS 26 系统,我第一时间更新了 Xcode 26 并开始适配我的 App,但马上就遇到了一个关于 UI 的棘手问题。 我的目标: 遇到的问题: 我的问题:
非常希望能得到大家的指点。提前感谢各位!
Code Snippet / 相关代码// MARK: - View Components
private var inputBubble: some View {
// Targeting the new watchOS 26
if #available(watchOS 26.0, *) {
AnyView(
HStack(spacing: 12) {
// The problematic TextField with its new intrinsic background
TextField("Message...", text: $viewModel.userInput)
.textFieldStyle(.plain)
Button(action: viewModel.sendMessage) {
Image(systemName: "arrow.up.circle.fill")
}
.buttonStyle(.plain)
.fixedSize()
.disabled(viewModel.userInput.isEmpty || (viewModel.allMessagesForSession.last?.isLoading ?? false))
}
.padding(10)
.glassEffect(.clear) // The glass effect is applied to the parent
.padding(.horizontal)
.padding(.vertical, 4)
)
} else {
// Fallback for older watchOS versions
AnyView(
HStack(spacing: 12) {
TextField("Message...", text: $viewModel.userInput)
.textFieldStyle(.plain)
Button(action: viewModel.sendMessage) {
Image(systemName: "arrow.up.circle.fill")
}
.buttonStyle(.plain)
.fixedSize()
.disabled(viewModel.userInput.isEmpty || (viewModel.allMessagesForSession.last?.isLoading ?? false))
}
.padding(10)
.background(viewModel.enableBackground ? AnyShapeStyle(.clear) : AnyShapeStyle(.ultraThinMaterial))
.cornerRadius(12)
.padding(.horizontal)
.padding(.vertical, 4)
)
}
}Guidelines
|
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 4 replies
-
|
I've run into a SwiftUI layout issue that I've been struggling with all night, and I would greatly appreciate your help.😭 |
Beta Was this translation helpful? Give feedback.
-
|
This is very likely an intentional decision on their end. Because Apple seems to been enforcing a system material background for readability. I doubt theres currently a public modifier to remove it so a custom wrapper is probably the only workaround for now. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Implemented at: https://github.com/Eric-Terminal/ETOS-LLM-Studio |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
Sorry, I may not have understood what you meant. What do you mean by finding the code from videos or pictures? Do you mean locating the implementation of the UI shown in the image I sent within my repository? |
Beta Was this translation helpful? Give feedback.
-
|
Hi Eric, I’ve been experimenting with watchOS 26 too, and I ran into the same issue. The gray background on TextField is intentional in watchOS 26 — Apple seems to have added an intrinsic background for consistency across apps, so it’s not a bug. The good news is you can override it to make your TextField fully transparent on a .glassEffect container. Here’s what works: TextField("Message...", text: $viewModel.userInput) The key is using both .textFieldStyle(.plain) and .background(.clear) — just one of them alone doesn’t fully remove the background in watchOS 26. Then, your parent HStack with .glassEffect(.clear) will show through cleanly, and you won’t get the double-border effect anymore. So yes, it’s by design, but with these modifiers, you can achieve the look you want. Hope that helps! |
Beta Was this translation helpful? Give feedback.


Hi Eric,
I’ve been experimenting with watchOS 26 too, and I ran into the same issue. The gray background on TextField is intentional in watchOS 26 — Apple seems to have added an intrinsic background for consistency across apps, so it’s not a bug.
The good news is you can override it to make your TextField fully transparent on a .glassEffect container. Here’s what works:
TextField("Message...", text: $viewModel.userInput)
.textFieldStyle(.plain) // removes default fancy styling
.background(.clear) // makes the TextField itself transparent
.labelsHidden() // hides any system-added labels
The key is using both .textFieldStyle(.plain) and .background(.clear) — just one of them alone doesn’t f…