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.

All subtopics
Posts under UI Frameworks topic

Post

Replies

Boosts

Views

Activity

In SwiftUI, how to animate from an arbitrary corner radius to the corner radius of the display?
I am trying to implement a common UX/UI pattern: one view with rounded corners transitioning to a view that fills the screen (N.B. having the display's corner radius). I got this to work if both corner radiuses are equal to that of the display (see first GIF). However, I cannot seem to get it to work for arbitrary corner radiuses of the smaller view (i.e., the one that does not fill the screen). I expected the be able to combine ContainerRelativeShape with .containerShape (see code), but this left me with a broken transition animation (see second GIF). import SwiftUI struct ContentView: View { @Namespace private var animation @State private var selectedIndex: Int? var body: some View { ZStack { if let selectedIndex = selectedIndex { ContainerRelativeShape() .fill(Color(uiColor: .systemGray3)) .matchedGeometryEffect(id: "square-\(selectedIndex)", in: animation) .ignoresSafeArea() .onTapGesture { withAnimation() { self.selectedIndex = nil } } .zIndex(1) } ScrollView { VStack(spacing: 16) { ForEach(0..<20, id: \.self) { index in if selectedIndex != index { ContainerRelativeShape() // But what if I want some other corner radius to start with? .fill(Color(uiColor: .systemGray5)) .matchedGeometryEffect(id: "square-\(index)", in: animation) .aspectRatio(1, contentMode: .fit) .padding(.horizontal, 12) .onTapGesture { withAnimation() { selectedIndex = index } } // .containerShape(RoundedRectangle(cornerRadius: 20)) // I can add this to change the corner radius, but this breaks the transition of the corners } else { Color.clear .aspectRatio(1, contentMode: .fit) .padding(.horizontal, 12) } } } .padding(.vertical, 16) } } } } #Preview { ContentView() } What am I missing here? How can I get this to work? And where is the mistake in my reasoning?
1
0
101
2w
UISplitViewController.showDetailViewController() not working in iPhone version.
Since updating to Tahoe and Xcode 26 I have found that the UISplitViewController.showDetailViewController() is not working in the iPhone version of my app (it is a universal app). I'm just trying to show a detail view after a tap on a UITableView item. The iPad versions are all working correctly. Has anyone else experienced this or have any advice about what may have changed? Thanks in advance.
1
0
151
2w
Detecting marked range in UI/NSTextViews at the time of shouldChangeTextIn
We have submitted a feedback for this issue: FB21230723 We're building a note-taking app for iOS and macOS that uses both UITextView and NSTextView. When performing text input that involves a marked range (such as Japanese input) in a UITextView or NSTextView with a UITextViewDelegate or NSTextViewDelegate set, the text view's marked range (markedTextRange / markedRange()) has not yet been updated at the moment when shouldChangeTextIn is invoked. UITextViewDelegate.textView(_:shouldChangeTextIn:replacementText:) NSTextViewDelegate.textView(_:shouldChangeTextIn:replacementString:) The current behavior is this when entering text in Japanese: (same for NSTextView) func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { print(textView.markedTextRange != nil) // prints out false DispatchQueue.main.async { print(textView.markedTextRange != nil) // prints out true } } However, we need the value of markedTextRange right away in order to determine whether to return true or false from this method. Is there any workaround for this issue?
0
0
84
2w
Paste button on navigation bar is not shown on iOS/iPadOS 26
The Paste button (using UIPasteControll) located on UINavigationBar is not shown at application startup on iOS/iPadOS 26. This issue will disappear when device is rotated or window size is changed. And this issue does not occur on iOS / iPadOS 18 and earlier. I uploaded the sample project to github at the following URL. https://github.com/gpn-galapagos/PasteButtonApp.git Has anyone had the same issue or knows a workaround?
0
0
160
2w
WatchOS version lower than deployment target in Xcode 26
Description: I’m encountering an issue where the Apple Watch’s watchOS version is lower than the deployment target specified in my Xcode project. For example, my Watch device is running watchOS 10.6, but my app’s deployment target is set to watchOS 9.6 or 10.6, and Xcode shows an error stating: Error: “watchOS version doesn’t match the app’s deployment target.” Could someone clarify how to properly handle this version mismatch? Environment: Xcode 26 iPhone: iOS 18 Apple Watch: watchOS 10.6 Any guidance or best practices would be appreciated.
8
2
302
2w
tvOS Focus Halo Does Not Respect cornerRadius on UIImageView
The Problem When using adjustsImageWhenAncestorFocused = true on a UIImageView in tvOS, the native focus halo effect does not respect the cornerRadius property set on the image view's layer. The image itself correctly clips to the rounded corners, but the focus halo (the glowing outline that appears when the view is focused) always renders with square or nearly-square corners. Code Example let imageView = UIImageView() imageView.layer.cornerRadius = 60 imageView.clipsToBounds = true imageView.adjustsImageWhenAncestorFocused = true imageView.image = posterImage Result: The poster image displays with 60pt rounded corners as expected, but when focused, the halo effect has square corners - creating an obvious visual mismatch. Expected Behavior The focus halo should follow the same cornerRadius as the UIImageView. If I set a 60pt corner radius, both the image and its focus halo should have matching 60pt rounded corners. Actual Behavior The image respects cornerRadius and displays with rounded corners The focus halo ignores cornerRadius and renders with square corners This creates an inconsistent, unpolished appearance Environment tvOS 16.0+ (tested through tvOS 18) Affects both Apple TV Simulator and physical devices Occurs with any corner radius value above approximately 20-30pt Use Case This is a common scenario for media streaming apps. Movie and TV show poster cards typically use rounded corners (40-80pt) as part of modern UI design. Many apps like Netflix, Plex, and others use this design pattern. The current behavior forces developers to choose between: Using the beautiful native focus effect but with mismatched square halos Implementing a completely custom focus effect from scratch, losing the native parallax, shadow, and halo animations Neither option is ideal. What I've Tried Setting cornerRadius before and after adjustsImageWhenAncestorFocused Different clipsToBounds configurations Wrapping the image view in a container view with corner radius Using layer.maskedCorners to specify which corners to round Subclassing CALayer to intercept sublayers added by the focus system None of these approaches affect the focus halo's corner radius. Request I would appreciate guidance on any of the following: Is there a supported way to customize the focus halo's corner radius? The UIFocusHaloEffect class exists on iOS/iPadOS but is not available on tvOS. Is this a bug that will be addressed? The focus system clearly reads some properties from the image view (like bounds), so it seems like cornerRadius should also be respected. Is there a different API I should be using? Perhaps there's an alternative approach to achieve rounded corner poster cards with matching focus effects that I'm not aware of. Additional Context I've noticed that some third-party apps have achieved this effect, suggesting it may be possible through undocumented means. However, I would prefer to use a public, supported API to ensure compatibility with future tvOS updates. Any guidance from Apple engineers or developers who have solved this would be greatly appreciated. Thank you.
Topic: UI Frameworks SubTopic: UIKit
0
0
94
2w
Interactive ColumnTable header?
AI's would have me believe that the header of a TableColumn in Table() can be modified to be interactive simply by adding a header: closure with a Button however no provided code actually compiles or reflects any documentation I can find. Is it possible to put something besides a Text object in the header?
Topic: UI Frameworks SubTopic: SwiftUI
0
0
33
2w
Unwanted animations appear on UIButton (iOS 26)
After the iOS 26 update, unwanted animations appear on UIButton. I'm using the attributedTitle property of UIButton.Configuration to change the button's text, and an animation appears after iOS 26. (It's unclear whether it's after iOS 26.0 or iOS 26.1, but it likely started with 26.1.) The peculiar thing is that the animation only starts appearing on buttons that have been pressed once. I tried using UIView.performWithoutAnimation and CATransaction's begin(), setDisableActions(true), commit(), but it didn't work. How should I solve this? Below is the code for changing the button's text. func updateTitle() { let keys = type.keys if keys.count == 1 { guard let key = keys.first else { return } if key.count == 1 { if Character(key).isLowercase { self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 24, weight: .regular), .foregroundColor: UIColor.label])) } else if Character(key).isUppercase { self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label])) } else { self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label])) } } else { self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 18, weight: .regular), .foregroundColor: UIColor.label])) } } else { let joined = keys.joined(separator: "") self.configuration?.attributedTitle = AttributedString(joined, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label])) } }
1
0
167
2w
iOS 14.3 UITextField leak?
Why is the UIKeyboard implementation still holding a reference to this UITextField, thus keeping it from being deallocated? The memory debugger shows: UIKeyboardImpl -> UIKBAutofillController -> NSMutableDictionary -> NSMutable...(Storage) -> UITextField Any idea what's going on there?
Topic: UI Frameworks SubTopic: UIKit Tags:
5
3
2.6k
2w
CMD+ESC no longer working on macOS 26.1
Hi there! We have an application that exists for more than 10 years (Appkit, Obj-C), and since the very beginning we're using CMD+ESC as a keyboard shortcut for a very important function in our app. Until now, this worked great. Recently, when macOS 26.1 released our app started to not responding to CMD+ESC anymore for some of our customers - it seems like CMD+ESC never gets to our app at all. First, we though it's happening because Game Overlay is also using CMD+ESC by default, but when we turned that off, or switched that to something else in macOS's Keyboard preferences, the issue still persisted. The, we realized this has something to do with iCloud - so, if you turn off iCloud, do a log out and log in to your computer, and it's magically starts working again, as it always did. More strangely, this issue doesn't happen for everyone - for many of our customers, the issue seems to doesn't exist for some strange reason. Anyone have any idea what could be happening here?
Topic: UI Frameworks SubTopic: AppKit
0
0
53
2w
Cocoa - creating a text canvas for backing a terminal emulator
Dear Forum, after decades, I'm back to MacOS dev just for the need of it. Besides Mac, I'm also toying around with vintage IBM mainframe systems and therefore I'm in need for a good terminal emulation. So far, I use x3270 on my Apple Silicon M1 MacBook Air - nice. However, I can't compile it on my collection of vintage Macs (iMac G3, Cube G4) so I pondered to create it on my own using Cocoa (starting with MacOS X 10.4 Tiger up to the current level (on Sequoia) so that rules out Carbon. tn3270 X from Brown University works nice on those vintage Macs but misses some features. Having browsed some info about the Cocoa Text system, I wonder if that would be the right place to start. At the end of the day, I need to be able to intercept all keystrokes, have more or less a fixed font 80x25 (136x25 etc..) col/row layout of protected and unprotected areas where text can be entered. Cusor should be visible and movable by using cursor control keys. I'd be happy for any suggestion on where to start here. Kind regards Michael
Topic: UI Frameworks SubTopic: AppKit
0
0
54
2w
Dual .fileImporter modifier only one is called
On macOS I'm seeing that only one .fileImporter modifier is called when two are defined. Anybody seeing the same issue? The scenario I have is two different file sources share the same file extension but they need to be loaded by two slightly different processes. Select the first option. Nothing happens. Select the second option, it works. Seeing this also in another project. Because the isPresented value is a binding, it isn't straightforward to logically OR the boolean @States and conditionally extract within the import closure. @main struct Dual_File_Importer_ExpApp: App { @State private var showFirstDialog = false @State private var showSecondDialog = false var body: some Scene { DocumentGroup(newDocument: Dual_File_Importer_ExpDocument()) { file in ContentView(document: file.$document) .fileImporter(isPresented: $showFirstDialog, allowedContentTypes: [.commaSeparatedText]) { result in print("first") } .fileImporter(isPresented: $showSecondDialog, allowedContentTypes: [.commaSeparatedText]) { result in print("second") } } .commands { CommandGroup(after: .importExport) { Button("Import First") { showFirstDialog.toggle() } Button("Import Second") { showSecondDialog.toggle() } } } } }```
Topic: UI Frameworks SubTopic: SwiftUI
3
0
164
2w
Layout recursion error message
Hi all, when I launch my macOS app from Xcode 16 on ARM64, appKit logs me this error on the debug console: It's not legal to call -layoutSubtreeIfNeeded on a view which is already being laid out. If you are implementing the view's -layout method, you can call -[super layout] instead. Break on _NSDetectedLayoutRecursion(void) to debug. This will be logged only once. This may break in the future. _NSDetectedLayoutRecursion doesn't help a lot, giving me these assembly codes from a call to a subclassed window method that looks like this: -(void) setFrame:(NSRect)frameRect display:(BOOL)flag { if (!_frameLocked) [super setFrame:frameRect display:flag]; } I have no direct call to -layoutSubtreeIfNeeded from a -layout implementation in my codes. I have a few calls to this method from update methods, however even if I comment all of them, the error is still logged... Finally, apart from that log, I cannot observe any layout error when running the program. So I wonder if this error can be safely ignored? Thanks!
5
0
330
2w
UISplitViewController and setViewController:forColumn: differences between different iOS versions
It seems to be that the functionality of the method setViewController:forColumn: in the column-style layout of a UISplitViewController has changed. iOS 18: setViewController:forColumn: pushes a new view controller onto the UINavigationController if it existed before the call. iOS 26: setViewController:forColumn: sets or replaces the view controller with a new view controller as a root of a new UINavigationController. My questions: what is the intended behavior? I did not find any documentation about a change. how do I replace in iOS 18 the old view controller with the new view controller passed to setViewController:forColumn:?
0
0
147
2w
SwiftUI – How to completely remove the horizontal “ghost lines” inside List with Section and custom rows?
Hi everyone, I’m working on a screen that uses a single SwiftUI List composed of: a top block (statistics, month picker, year selector, total, Entrata/Uscita picker). a list of transactions grouped by day, each group inside its own Section. each row is a fully custom card with rounded corners (RoundedCornerShape) I’m correctly removing all separators using: .listRowSeparator(.hidden) .listSectionSeparator(.hidden) .scrollContentBackground(.hidden) .listStyle(.plain) Each row is rendered like this: TransazioneSwipeRowView(...) .listRowInsets(EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16)) .listRowBackground(Color.clear) However, I still see thin horizontal lines appearing between: the search bar and the top block the top block and the start of the list between rows inside the grouped section sometimes at the bottom of a Section These lines are NOT: Divider() system separators backgrounds row borders They seem to be “ghost lines” automatically generated by SwiftUI’s List when multiple consecutive rows or sections are present. Goal I want to remove these lines completely while keeping: native SwiftUI List native scroll behavior swipe-to-delete support grouping by Section custom card-like rows with rounded corners transparent backgrounds What I already tried .plain, .grouped, .insetGrouped list styles .listRowSeparator(.hidden) and .listSectionSeparator(.hidden) .scrollContentBackground(.hidden) clearing all backgrounds adjusting/removing all padding and insets Spacer(minLength: 0) experiments rebuilding the layout using ScrollView + LazyVStack (works perfectly — no lines — BUT loses native swipe-to-delete) There are no Divider() calls anywhere, and no background colors producing borders. Question Is this a built-in behavior of SwiftUI’s List in .plain style when using multiple custom rows, or is there an officially supported way to eliminate these lines entirely? Is there a recommended combination of modifiers to achieve: a List with grouped Sections fully custom rows with rounded backgrounds absolutely no horizontal separators, even in the empty spaces between sections? Any guidance, documented workarounds, WWDC references, or official recommendations would be greatly appreciated. Thanks in advance!
3
0
130
2w
[Issue] Animation of Menu on iOS 26.1
Hello everyone! I found a weird behavior with the animation of Menucomponent on iOS 26.1 When the menu disappear the animation is very glitchy You can find here a sample of code to reproduce it @available(iOS 26.0, *) struct MenuSample: View { var body: some View { GlassEffectContainer { HStack { Menu { Button("Action 1") {} Button("Action 2") {} Button("Delete", role: .destructive) {} } label: { Image(systemName: "ellipsis") .padding() } Button {} label: { Image(systemName: "xmark") .padding() } } .glassEffect(.clear.interactive()) } } } @available(iOS 26.0, *) #Preview { MenuSample() .preferredColorScheme(.dark) } I did two videos: iOS 26.0 iOS 26.1 Thanks for your help
0
0
175
2w
How can I show a movable webcam preview above all windows in macOS without activating the app
I'm building a macOS app using SwiftUI, and I want to create a draggable floating webcam preview window Right now, I have something like this: import SwiftUI import AVFoundation struct WebcamPreviewView: View { let captureSession: AVCaptureSession? var body: some View { ZStack { if let session = captureSession { CameraPreviewLayer(session: session) .clipShape(RoundedRectangle(cornerRadius: 50)) .overlay( RoundedRectangle(cornerRadius: 50) .strokeBorder(Color.white.opacity(0.2), lineWidth: 2) ) } else { VStack(spacing: 8) { Image(systemName: "video.slash.fill") .font(.system(size: 40)) .foregroundColor(.white.opacity(0.6)) Text("No Camera") .font(.caption) .foregroundColor(.white.opacity(0.6)) } } } .shadow(color: .black.opacity(0.3), radius: 10, x: 0, y: 5) } } struct CameraPreviewLayer: NSViewRepresentable { let session: AVCaptureSession func makeNSView(context: Context) -> NSView { let view = NSView() view.wantsLayer = true let previewLayer = AVCaptureVideoPreviewLayer(session: session) previewLayer.videoGravity = .resizeAspectFill previewLayer.frame = view.bounds view.layer = previewLayer return view } func updateNSView(_ nsView: NSView, context: Context) { if let previewLayer = nsView.layer as? AVCaptureVideoPreviewLayer { previewLayer.frame = nsView.bounds } } } This is my SwiftUI side code to show the webcam, and I am trying to create it as a floating window which appears on top of all other apps windows etc. however, even when the webcam is clicked, it should not steal the focus from other apps, the other apps should be able to function properly as they already are. import Cocoa import SwiftUI class WebcamPreviewWindow: NSPanel { private static let defaultSize = CGSize(width: 200, height: 200) private var initialClickLocation: NSPoint = .zero init() { let screenFrame = NSScreen.main?.visibleFrame ?? .zero let origin = CGPoint( x: screenFrame.maxX - Self.defaultSize.width - 20, y: screenFrame.minY + 20 ) super.init( contentRect: CGRect(origin: origin, size: Self.defaultSize), styleMask: [.borderless], backing: .buffered, defer: false ) isOpaque = false backgroundColor = .clear hasShadow = false level = .screenSaver collectionBehavior = [ .canJoinAllSpaces, .fullScreenAuxiliary, .stationary, .ignoresCycle ] ignoresMouseEvents = false acceptsMouseMovedEvents = true hidesOnDeactivate = false becomesKeyOnlyIfNeeded = false } // MARK: - Focus Prevention override var canBecomeKey: Bool { false } override var canBecomeMain: Bool { false } override var acceptsFirstResponder: Bool { false } override func makeKey() { } override func mouseDown(with event: NSEvent) { initialClickLocation = event.locationInWindow } override func mouseDragged(with event: NSEvent) { let current = event.locationInWindow let dx = current.x - initialClickLocation.x let dy = current.y - initialClickLocation.y let newOrigin = CGPoint( x: frame.origin.x + dx, y: frame.origin.y + dy ) setFrameOrigin(newOrigin) } func show<Content: View>(with view: Content) { let host = NSHostingView(rootView: view) host.autoresizingMask = [.width, .height] host.frame = contentLayoutRect contentView = host orderFrontRegardless() } func hide() { orderOut(nil) contentView = nil } } This is my Appkit Side code make a floating window, however, when the webcam preview is clicked, it makes it as the focus app and I have to click anywhere else to loose the focus to be able to use the rest of the windows.
0
0
324
2w
SwiftData iCloud AttributedString Platform Color compatibility
Hi Given a simple multiplatform app about Mushrooms, stored in SwiftData, hosted in iCloud using a TextEditor @Model final class Champignon: Codable { var nom: String = "" ../.. @Attribute(.externalStorage) var attributedStringData: Data = Data() var attributedString: AttributedString { get { do { return try JSONDecoder().decode(AttributedString.self, from: attributedStringData) } catch { return AttributedString("Failed to decode AttributedString: \(error)") } } set { do { self.attributedStringData = try JSONEncoder().encode(newValue) } catch { print("Failed to encode AttributedString: \(error)") } } } ../.. Computed attributedString is used in a TextEditor private var textEditorView: some View { Section { TextEditor(text: $model.attributedString) } header: { HStack { Text("TextEditor".localizedUppercase) .foregroundStyle(.secondary) Spacer() } } } Plain Text encode, decode and sync like a charm through iOS and macOS Use of "FontAttributes" (Bold, Italic, …) works the same But use of "ForegroundColorAttributes" trigger an error : Failed to decode AttributedString: dataCorrupted(Swift.DecodingError.Context(codingPath: [_CodingKey(stringValue: "Index 3", intValue: 3), AttributeKey(stringValue: "SwiftUI.ForegroundColor", intValue: nil), CodableBoxCodingKeys(stringValue: "value", intValue: 1)], debugDescription: "Platform color is not available on this platform", underlyingError: nil)) Is there a way to encode/decode attributedString data platform conditionally ? Or another approach ? Thanks for advices
0
0
167
2w
iOS 26 UI Components Not Rendering in TestFlight
Issue Summary: iOS 26 UI components are not visible in the Expo app when installed via TestFlight. All components render correctly in local builds or when running with expo run:ios. Details: The app is built using Expo managed workflow. iOS 26-specific UI components do not appear in TestFlight builds. The same components display correctly in local builds and simulators. Test device: iPhone running iOS 26.1. There are no crashes or runtime errors; only the components are missing. This issue occurs only in TestFlight/release builds. Expected Behavior: All iOS 26 UI components should render in TestFlight builds the same way they do in local builds. Actual Behavior: Components fail to render or are completely missing. Device Information: Device: iPhone iOS Version: 26.1 Distribution: TestFlight Local Build: Working correctly Additional Notes: This may be related to Expo release build optimization or iOS 26 SDK compatibility.
0
0
148
2w