Search results for

swiftui

16,623 results found

Post

Replies

Boosts

Views

Activity

Unable to apply liquid glass effect on popover that is opened from a liquid glass container
When a popover is presented from a view that uses glassEffect(.regular.interactive()), I’m seeing mutually exclusive behavior: either the popover’s chrome (its navigation bar / toolbar) uses Liquid Glass or the originating control keeps its Liquid Glass “morph” behavior — but not both at the same time. There are two ways that I can enable Liquid Glass on the container: Option 1 (background capsule with .glassEffect) → The popover’s toolbar shows Liquid Glass, but the menu button loses its morph effect. Option 2 (.glassEffect applied to the HStack) → The menu button keeps the morph effect, but the popover’s toolbar does not have Liquid Glass. I'm using XCode 26.0.1, with latest iOS 26.0 stable simulator installed. Here's an example code to reproduce the issue: import PlaygroundSupport import SwiftUI // MARK: - TestView struct TestView: View { @State private var isPresented = false var body: some View { VStack { Spacer() HStack { Button(, systemImage: plus) { isPresented = true } .popover(isPresented:
1
0
154
Oct ’25
Issues working with Stepper in watchOS
In the watchOS Fitness app, when you change your goals using the Digital Crown, a focus ring appears around the stepper. Something I can't understand is how the green focus ring is not centered around the stepper buttons (which is the default behavior). Furthermore, I don't understand how the goal text and captions inside the stepper label are also not centered within the stepper. A final behavior I don't understand is when the goal number transitions from 999 to 1000, the stepper changes height, but doesn't affect the height of any parent views. import SwiftUI struct ContentView: View { @State private var value = 999.0 var body: some View { VStack { Text(MOVE GOAL) .font(.subheadline) .foregroundStyle(.red) .padding(.top) Stepper { VStack { Text((Int(value))) .allowsTightening(true) .minimumScaleFactor(value > 999 ? 0.70 : 1.0) .lineLimit(1) Text(CALORIES) .font(.subheadline) .foregroundStyle(.red) } } onIncrement: { value += 1 } onDecrement: { value -= 1 } .tint(.red) .digitalCrownRotation( $val
1
0
110
Oct ’25
Is it still possible to change the color of unselected icons in a TabView?
Hi. I‘m making an app with SwiftUI for iOS 26, and found that the old ways of changing unselected icons color seem not working as they did in old versions of iOS. I tried these methods: TabView() { Tab { // some view here } label: { Label(title: { Text(something) }, icon: { Image(systemName: checkmark.seal.fill) .foregroundStyle(.blue) } } } I wrapped Image with an if-else, but itisn't able to change any color even without if; struct ParentView: View { init() { UITabBar.appearance() .unselectedItemTintColor = UIColor.red } var body: some View { TabView() { // some tabs here } } } and an extension of above struct ParentView: View { init() { let tabBarAppearance = UITabBarAppearance() tabBarAppearance.configureWithOpaqueBackground() tabBarAppearance.backgroundColor = UIColor.green tabBarAppearance.stackedLayoutAppearance .selected.titleTextAttributes = [.foregroundColor: UIColor.red] tabBarAppearance.stackedLayoutAppearance.normal .titleTextAttributes = [.foregroundColor: UIColor.black] tabBarAppearanc
1
0
135
Oct ’25
Getting the world position of a QR code
Hi, would love for your help in that matter. I try to get the position in space of two QR codes to make an alignment to their positions in space. The detection shows that the QR codes position is always 0,0,0 and I don't understand why. Here's my code: import SwiftUI import RealityKit import RealityKitContent struct AnchorView: View { @ObservedObject var qrCoordinator: QRCoordinator @ObservedObject var coordinator: ImmersiveCoordinator let qrName: String @Binding var startQRDetection: Bool @State private var anchor: AnchorEntity? = nil @State private var detectionTask: Task? = nil var body: some View { RealityView { content in // Add the QR anchor once (must exist before detection starts) if anchor == nil { let imageAnchor = AnchorEntity(.image(group: QRs, name: qrName)) content.add(imageAnchor) anchor = imageAnchor print(📌 Created anchor for (qrName)) } } .onChange(of: startQRDetection) { enabled in if enabled { startDetection() } else { stopDetection() } } .onDisappear { stopDetection() } } privat
2
0
483
Oct ’25
Table container, when scrolling content, the content will appear underneath and to the top of the column headings.
When the Table container is scrolled up the data rows just keep moving up and become unreadable with the column headings superimposed over the top. Prior to scrolling upwards, the display will look like this. However, if you start to scroll up This behaviour does not seem to be the expected behaviour without any modifiers etc. The following is the code I have been using. import SwiftUI struct Customer: Identifiable { let id = UUID() let name: String let email: String let creationDate: Date } struct SwiftyPlaceTable: View { @State var customers = [Customer(name: John Smith, email: john.smith@example.com, creationDate: Date() + 100), Customer(name: Jane Doe, email: jane.doe@example.com, creationDate: Date() - 3000), Customer(name: Bob Johnson, email: bob.johnson@example.com, creationDate: Date())] var body: some View { Table(customers) { TableColumn(name, value: .name) TableColumn(email, value: .email) TableColumn(joined at) { customer in Text(customer.creationDate, style: .date) } } } } #Preview { Swi
Topic: UI Frameworks SubTopic: SwiftUI
2
0
148
Oct ’25
Reply to MapPolyline and MapPolygon not visible on simulator
Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project, or share the SwiftUI view code here, along with screenshots for what you see. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project. — Ed Ford,  DTS Engineer
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’25
Reply to App in sviluppo
Sto sviluppando in SwiftUI un’app che integra feed RSS di notizie medico-scientifiche e un calendario di eventi dedicati alla pneumologia. Mi chiedevo se, in base alle App Store Review Guidelines, un’app con contenuti di sola informazione medica (senza diagnosi o consigli clinici personalizzati) può essere pubblicata nella categoria ‘Medicina’ o ‘Notizie’. Qualcuno ha esperienza con app simili approvate o respinte?
Oct ’25
Reply to App in sviluppo
Sto sviluppando in SwiftUI un’app che integra feed RSS di notizie medico-scientifiche e un calendario di eventi dedicati alla pneumologia. Mi chiedevo se, in base alle App Store Review Guidelines, un’app con contenuti di sola informazione medica (senza diagnosi o consigli clinici personalizzati) può essere pubblicata nella categoria ‘Medicina’ o ‘Notizie’. Qualcuno ha esperienza con app simili approvate o respinte? grazie Francesco Allevi
Oct ’25
How to maintain navigation title scroll behavior when using Text with custom color in watchOS?
I'm encountering an issue with navigation title behavior in watchOS SwiftUI. When using a String for the navigation title, long titles automatically scroll as expected. However, when switching to Text with custom foreground color, the scrolling behavior is lost. Important Observation: The system Settings app on watchOS successfully displays navigation titles with blue color while maintaining scroll behavior. This suggests it should be technically possible - am I missing some implementation approach? struct ContentView: View { var body: some View { NavigationStack { NavigationLink(Go Next) { LinkView() } } } } struct LinkView: View { enum NavigationTitleMode: String { case string case text } @State private var titleMode: NavigationTitleMode = .string let title: String = Watch UI Test Navigation Title var body: some View { switch titleMode { case .string: content .navigationTitle(title) case .text: content .navigationTitle { Text(title) .foregroundStyle(.blue) } } } var content: some View { VStack { Te
1
0
165
Oct ’25
Reply to Menu presentation in UIHostingController issues
This same error message occurs in a pure SwiftUI view/project in iOS 26 for a Menu when the view is complex: Adding '_UIReparentingView' as a subview of UIHostingController.view is not supported and may result in a broken view hierarchy. Add your view above UIHostingController.view in a common superview or insert it into your SwiftUI content in a UIViewRepresentable instead. Visual redraw glitch of the menu button is also evident when the menu options are dismissed.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’25
WKWebView Crashes on iOS During YouTube Playlist Playback
I’m encountering a consistent crash in WebKit when using WKWebView to play a YouTube playlist in my iOS app. Playback starts successfully, but the web process terminates during the second video in the playlist. This only occurs on physical devices, not in the simulator. Here’s a simplified Swift example of my setup: import SwiftUI import WebKit struct ContentView: View { private let playlistID = PLig2mjpwQBZnghraUKGhCqc9eAy0UbpDN var body: some View { YouTubeWebView(playlistID: playlistID) .edgesIgnoringSafeArea(.all) } } struct YouTubeWebView: UIViewRepresentable { let playlistID: String func makeUIView(context: Context) -> WKWebView { let config = WKWebViewConfiguration() config.allowsInlineMediaPlayback = true let webView = WKWebView(frame: .zero, configuration: config) webView.scrollView.isScrollEnabled = true let html = webView.loadHTMLString(html, baseURL: nil) return webView } func updateUIView(_ uiView: WKWebView, context: Context) {} } #Preview { ContentView() } Observed behav
3
0
389
Oct ’25
Reply to Using Menu in tabViewBottomAccessory
Hi @robevans, I'm unable to reproduce the issue, as reported, in my own Xcode project. Because the provided example above will not build successfully due to missing types, I replaced your implementation with the following: import SwiftUI struct ContentView: View { @State private var selection = 0 var body: some View { TabView(selection: $selection) { Tab(Home, systemImage: circle.hexagonpath.fill, value: 0) { Color.red } } .tabViewBottomAccessory { Menu(Post Review) { Button { print(Other submitted.) } label: { Label(Submit Other, systemImage: building.2.fill) } Button { print(Bed submitted.) } label: { Label(Submit Bed, systemImage: bed.double.fill) } } } } } #Preview { ContentView() } However, if the above still does not resolve your issue, please consider adding the following view modifier to your button's content: Button { print(Button tapped!) } label: { SomeCustomView() } .contentShape(.rect) To learn more, read the following documentation: contentshape(_:eofill:) https://developer.apple.com/do
Topic: UI Frameworks SubTopic: SwiftUI
Oct ’25
How can I optimize multilingual string translations in SwiftUI for App Store apps using Localization APIs?
Hi team, I’m developing an iOS app that helps manage and translate multilingual content . The app uses SwiftUI with Localizable.strings and Bundle.localizedString(forKey:). I’m trying to optimize for dynamic language switching inside the app without restarting. I’ve tested various methods like: Text(NSLocalizedString(welcome_text, comment: )) and some approaches using @Environment(.locale), but the system doesn’t always update views instantly when language changes. Question: What’s the recommended approach (or WWDC reference) for real-time language change handling in SwiftUI apps targeting iOS 18+?
1
0
161
Oct ’25
How to display SegmentControl in tabViewBottomAccessory inline mode like iOS 26 Photos app?
Question I'm trying to replicate the iOS 26 Photos app behavior where a segmented control appears in the tab bar area when scrolling. Specifically, when the tab bar minimizes to inline mode, I want to show a Picker with .segmented style between the minimized tab button and search button. Expected Behavior (iOS 26 Photos App) When scrolling up in the Photos app: Tab bar minimizes to inline mode A segmented control (Years/Months/All) appears in the center Layout: [Tab Button] [Segmented Control] [Search Button] Current Implementation I'm using tabViewBottomAccessory with tabBarMinimizeBehavior: struct PhotosMainView: View { @Environment(ModelData.self) private var modelData @State private var searchText: String = var body: some View { @Bindable var modelData = modelData TabView { Tab(Library, systemImage: photo.on.rectangle) { NavigationStack { PhotosGridView() .navigationTitle(Library) } } Tab(Albums, systemImage: square.grid.2x2) { NavigationStack { AlbumsGridView() .navigationTitle(Albums) } } Tab(Search, s
1
0
197
Oct ’25
Reply to How to display SegmentControl in tabViewBottomAccessory inline mode like iOS 26 Photos app?
Hi @377632523@qq.com, I'm unable to reproduce the issue, as reported, in my own Xcode project. Because the provided example above will not build successfully due to missing types, I replaced your implementation with the following: import SwiftUI struct PhotosMainView: View { @State private var searchText: String = var body: some View { TabView { Tab(Library, systemImage: photo.on.rectangle) { NavigationStack { scrollView(colors: [.red, .orange, .yellow]) .navigationTitle(Library) } } Tab(Albums, systemImage: square.grid.2x2) { NavigationStack { scrollView(colors: [.yellow, .green, .teal]) .navigationTitle(Albums) } } Tab(Search, systemImage: magnifyingglass, role: .search) { NavigationStack { scrollView(colors: [.blue, .purple, .pink]) .navigationTitle(Search) .searchable(text: $searchText) } } } .tabBarMinimizeBehavior(.onScrollUp) .tabViewStyle(.sidebarAdaptable) .tabViewBottomAccessory { TimelineAccessoryView() } } // Trivial helper view to visualize scrolling. @ViewBuilder func scrollView(colors
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’25