Search results for

column

2,047 results found

Post

Replies

Boosts

Views

Activity

Collection view with self-sizing cells with SwiftUI content
I am trying to make a collection view with self-sizing cells that adapt to SwiftUI content. My test platform is macOS, but it should work on iOS all the same. I chose macOS because on macOS, you can resize the window and cause more interesting scenarios with that. My layout intent is fairly simple: a one-column collection view with cells with SwiftUI content, where the collection view cells should adapt to the height of their SwiftUI content. I got it working almost correctly. The one scenario that I don’t have working is window resizing. When the window resizes, the layout and cells should adapt to the content and change their heights. I feel that I am missing something fairly basic. How do I change this project so that the layout works correctly when I change the macOS window width? Example project and video of the behavior: https://gist.github.com/jaanus/66e3d863941ba645c88220b8a22970e1
Topic: UI Frameworks SubTopic: AppKit
1
0
347
Mar ’25
Reply to How can I change the background color of a focused item of a NSTableView?
Here is a more simplified example of the app: import SwiftUI struct NSTableViewWrapper: NSViewRepresentable { class Coordinator: NSObject, NSTableViewDataSource, NSTableViewDelegate { var parent: NSTableViewWrapper init(parent: NSTableViewWrapper) { self.parent = parent } func numberOfRows(in tableView: NSTableView) -> Int { 1 } func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { return NSTextField(labelWithString: Item) } func tableView(_ tableView: NSTableView, rowActionsForRow row: Int, edge: NSTableView.RowActionEdge) -> [NSTableViewRowAction] { return [NSTableViewRowAction(style: .destructive, title: Delete) { _, _ in }] } } func makeCoordinator() -> Coordinator { return Coordinator(parent: self) } func makeNSView(context: Context) -> NSScrollView { let scrollView = NSScrollView() let tableView = NSTableView() let column = NSTableColumn(identifier: NSUserInterfaceItemIdentifier(Column)) tableView.addTableColumn(column
Topic: UI Frameworks SubTopic: AppKit Tags:
Mar ’25
FocusState Issue in iOS 18 with Keyboard Navigation
I have implemented a SwiftUI view containing a grid of TextField elements, where focus moves automatically to the next field upon input. This behavior works well on iOS 16 and 17, maintaining proper focus highlighting when keyboard full access is enabled. However, in iOS 18 and above, the keyboard full access focus behaves differently. It always stays behind the actual focus state, causing a mismatch between the visually highlighted field and the active text input. This leads to usability issues, especially for users navigating with an external keyboard. Below is the SwiftUI code for reference: struct AutoFocusGridTextFieldsView: View { private let fieldCount: Int private let columns: Int @State private var textFields: [String] @FocusState private var focusedField: Int? init(fieldCount: Int = 17, columns: Int = 5) { self.fieldCount = fieldCount self.columns = columns _textFields = State(initialValue: Array(repeating: , count: fieldCount)) } var body: some View { let rows = (fieldCou
1
0
523
Mar ’25
NavigationSplitView and NavigationPaths
A NavigationStack with a singular enum for .navigationDestination() works fine. Both NavigationLinks(value:) and directly manipulating the NavigationPath work fine for moving around views. Zero problems. The issue is when we instead use a NavigationSplitView, I've only dabbled with two-column splits (sidebar and detail) so far. Now, if the sidebar has its own NavigationStack, everything works nicely on an iPhone, but on an iPad, you can't push views onto the detail from the sidebar. (They're pushed on the sidebar) You can solve this by keeping a NavigationStack ONLY on the detail. Sidebar links now properly push onto the detail, and the detail can move around views by itself. However, if you mix NavigationLink(value:) with manually changing NavigationPath, it stops working with no error. If you only use links, you're good, if you only change the NavigationPath you're good. Mixing doesn't work. No error in the console either, the breakpoints hit .navigationDestination and the view is returned, but nev
0
0
166
Mar ’25
Remove bottom border in a row in AppKit's NSTableView
I just made a simple AppKit app, but don't know how to remove borders of rows when they're swiped. SwiftUI's list does not have this problem though. Attaching gif demo and code: import SwiftUI struct NSTableViewWrapper: NSViewRepresentable { @State var data: [String] class Coordinator: NSObject, NSTableViewDataSource, NSTableViewDelegate { var parent: NSTableViewWrapper weak var tableView: NSTableView? init(parent: NSTableViewWrapper) { self.parent = parent } func numberOfRows(in tableView: NSTableView) -> Int { self.tableView = tableView return parent.data.count } func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(Cell), owner: nil) as? NSTextField ?? NSTextField(labelWithString: ) cell.identifier = NSUserInterfaceItemIdentifier(Cell) cell.stringValue = parent.data[row] cell.isBordered = false return cell } func tableView(_ tableView: NSTableView, rowActionsForRow row: Int, edge
Topic: UI Frameworks SubTopic: AppKit Tags:
1
0
180
Mar ’25
Reply to List does not move the view into focused element, when changing it with a keyboard
NSTableView from AppKit works just as expected, while List from SwiftUI does this weird cropping. Here is the code for the NSTableView: import SwiftUI struct NSTableViewWrapper: NSViewRepresentable { class Coordinator: NSObject, NSTableViewDataSource, NSTableViewDelegate { var parent: NSTableViewWrapper init(parent: NSTableViewWrapper) { self.parent = parent } func numberOfRows(in tableView: NSTableView) -> Int { return parent.data.count } func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(Cell), owner: nil) as? NSTextField ?? NSTextField(labelWithString: ) cell.identifier = NSUserInterfaceItemIdentifier(Cell) cell.stringValue = parent.data[row] return cell } } var data: [String] func makeCoordinator() -> Coordinator { return Coordinator(parent: self) } func makeNSView(context: Context) -> NSScrollView { let scrollView = NSScrollView() let tableView = NSTableView() let column
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’25
I found SwiftUI SF Symbols bug from WWDC24
Summary: At WWDC24, a new transition was introduced by the Apple Design team (.contentTransition(.symbolEffect(.replace))) I was writing a post about it on my LinkedIn (https://www.linkedin.com/in/alex-fila/), and out of curiosity I tried multiple symbols with slashes. Many of them were not well center aligned during a new symbol effect. Some of the examples are: speaker.fill : speaker.slash.fill”, eye.fill : eye.slash.fill”. Please check the attached Swift file for more details and full SwiftUI View with issues. Steps to Reproduce: Create a new IOS App project in XCode. Create a new SwiftUI File. Initiate state variable: @State private var isSpeakerOn = true. Create a new image with transition: Image(systemName: isSpeakerOn ? speaker.fill : speaker.slash.fill) .contentTransition(.symbolEffect(.replace)). 5. Create a switcher or set a timer with a constant variable to toggle isSpeakerOn value (see attachment file). 6. Toggle isSpeakerOn value. 7. Observe the issue (2 symbols are not well center aligned during
2
0
289
Mar ’25
Reply to Process with equal instances but unequal identities
IMPORTANT The following contains a lot of implementation details. Don’t encode this knowledge into a product that you ship to a wide range of users. It has changed in the past and will likely change again in the future. Let’s start with the runningboardd man page. That’s not super helpful, but it does at least tell you that it’s responsible for managing processes. It started on iOS and has since moved to macOS. [quote='776288021, jaikiran, /thread/776288, /profile/jaikiran'] I suspect the identity it is talking about is the one explained as designated requirement [in TN3127] [/quote] That’s not the case. Rather, this is an internal identity used by runningboardd to classify the processes it knows about based on how they got started. For example, an application process has a description that starts with app. You can see these littered throughout the system log: type: default time: 13:12:54.328208+0000 process: runningboardd subsystem: com.apple.runningboard category: monitor message: Calculated state for app…
Topic: App & System Services SubTopic: Core OS Tags:
Mar ’25
Reply to "Network Extension" does not appear in the Capability section in Xcode
I recommend that you bookmark the Developer Account Helper > Reference > Supported capabilities (iOS) page (or the equivalent for the actual platform you’re targeting). It has a table that shows which capabilities are available to which team types. I suspect you’re using a Personal Team (the Apple Developer column) and that’s why you can’t use NE. If you are using a Personal Team, be aware that it has other significant limitations. For the details, see Developer > Support > Choosing a Membership. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: Code Signing SubTopic: Entitlements Tags:
Mar ’25
Reply to SwiftUI subview .frame ignored on parent view appear, MacOS
[quote='776126021, pikes, /thread/776126, /profile/pikes'] Is there a better way to handle a collapsing subview in an HSplitView? Why is the .frame not respected? [/quote] Have you checkout out inspector? Since you're using a NavigationSplitView, an inspector would present as a trailing column and by default, trailing column inspectors have their presentation state restored by the framework.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’25
Reply to Table view with dynamic content - is it possible?
It's now possible in SwiftUI with TableColumnForEach [1] But don't use it. I tried and I got crashes when reloading data using Observable, I got crashes when changing columns. My app hung and needed killing when switching away from the table view and back. It crashes if there are zero columns. It's also really slow. Unusably so with about 200 rows and 150 columns. I tried with a release build and no difference was noticable. NSTable on the other hand handles everything admirably. [1] https://developer.apple.com/documentation/swiftui/tablecolumnforeach
Topic: UI Frameworks SubTopic: UIKit Tags:
Mar ’25
Reply to Tensor Flow Metal 1.2.0 on M2 Fails to converge on common toy models
@txoof import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Input, LSTM, Dense, Dropout import tensorflow as tf from tensorflow.keras.callbacks import EarlyStopping import logging # Suppress warnings logging.getLogger(tensorflow).setLevel(logging.ERROR) logging.getLogger(urllib3).setLevel(logging.ERROR) # Verify GPU availability physical_devices = tf.config.list_physical_devices('GPU') print(fGPUs Available: {bool(physical_devices)}) # Load data with flexible features def load_data(filename, features=['Close']): df = pd.read_csv(filename, parse_dates=['DateTime']) df['DateTime'] = pd.to_datetime(df['DateTime'], format='%Y.%m.%d %H:%M:%S') required_columns = ['DateTime'] + features df_cleaned = df[required_columns].dropna().sort_values('DateTime') if df_cleaned.empty: raise ValueError(Dataset is empty after cleaning!) return df_cleaned, features # Example using mul
Topic: Machine Learning & AI SubTopic: Core ML Tags:
Mar ’25
Exploring VoiceOver Accessibility for UITableView
I’m currently exploring VoiceOver accessibility in iOS and looking for the best way to reduce the number of swipes required to navigate a UITableView. I’ve come across a couple of potential solutions but am unsure which is preferred. Solution 1: Grouping Subviews in Each Cell Combine all subviews inside a UITableViewCell into a single accessibility element. Provide a concise and meaningful accessibilityLabel. Use custom actions (UIAccessibilityCustomAction) or accessibilityActivationPoint to handle interactions on specific elements within the cell. Solution 2: Using UIAccessibilityContainerDataTableCell & UIAccessibilityContainerDataTable Implement UIAccessibilityContainerDataTable for structured table navigation. Make each cell conform to UIAccessibilityContainerDataTableCell, defining its row and column positions. However, I’m finding this approach a bit complex, and I need guidance on properly implementing these protocols. Additionally, in my case, VoiceOver is not navigating to Section 2—I’m
3
0
652
Mar ’25
Reply to NavigationSplitView sidebar animation lag with minimum width
@captmagnus You should try using navigationSplitViewColumnWidth(min:ideal:max:) to set the preferred width for the column and .windowResizability(.contentSize) for the resizability strategy. For example: WindowGroup { ContentView() } .windowResizability(.contentSize) struct ContentView: View { @State private var columnVisibility = NavigationSplitViewVisibility.all var body: some View { NavigationSplitView(columnVisibility: $columnVisibility) { Text(Sidebar) .navigationSplitViewColumnWidth(min: 300, ideal: 300) } detail: { Text(Detail) .navigationSplitViewColumnWidth( min: 600, ideal: 600, max: 900) } .onChange(of: columnVisibility) { print(columnVisibility) } } } It's also worth filling a bug report for the animation hitch. Bug Reporting: How and Why? has tips on creating your bug report. Post the FB number here once you file the bug report.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’25
Understanding Mach-O Symbols
This posts collects together a bunch of information about the symbols found in a Mach-O file. It assumes the terminology defined in An Apple Library Primer. If you’re unfamiliar with a term used here, look there for the definition. If you have any questions or comments about this, start a new thread in the Developer Tools & Services > General topic area and tag it with Linker. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com Understanding Mach-O Symbols Every Mach-O file has a symbol table. This symbol table has many different uses: During development, it’s written by the compiler. And both read and written by the linker. And various other tools. During execution, it’s read by the dynamic linker. And also by various APIs, most notably dlsym. The symbol table is an array of entries. The format of each entry is very simple, but they have been used and combined in various creative ways to achieve a wide range of goals. For example: In a M
0
0
891
Mar ’25