Search results for

column

2,052 results found

Post

Replies

Boosts

Views

Activity

Reply to Create Spreadsheet Like Grid with SwiftUI
It appears that I should have been using GridItems. They have solved my problem. Below is the code: struct DateAndCloseTable: View { let containerData: [CommonAttributes] let heading: String let verticalSpacing: CGFloat = 0 let frameWidth: CGFloat = 100 let frameHeight: CGFloat = 25 let horizontalSpacing: CGFloat = 0 let trailingPadding: CGFloat = 45 let bottomPadding: CGFloat = -2 let columns = [ GridItem(.fixed(75), spacing: 0), GridItem(.fixed(75), spacing: 0) ] var body: some View { Text() Text(heading) .font(.system(size: 18, weight: .bold, design: .default)) .foregroundColor(.blue) .padding(.trailing, 24) Text() ScrollView { let lastRowIndex: Int = containerData.count - 1 LazyVGrid(columns: columns, alignment: .center, spacing: verticalSpacing){ ForEach((0...lastRowIndex), id: .self) { index in let theDate = dateToStringFormatter.string(from: containerData[index].date!) let theClose = String(format: $%.2f, containerData[index].close ) Text(theDate) .font(.system(size: 14, weig
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
macOS TableView dynamic row height?
Environment is macOS Monterey Xcode 13. Is there a way to change the behavior of a macOS NSTableView to have the row height change based on the contents of a column. As an example when populating the column data and the width of the content exceeds the width of the column to have the content wrap to an additional line, which of course the row height would have to change then as well. If so, how can this be done? Thanks
1
0
1.2k
Aug ’22
Reply to Fatal Error in ModelData at line 43
Errors thrown by the JSONDecoder contain detailed information about the line number and column number and an explanation of what failed. If you set a breakpoint at line 29, then in the debugger show the value of error.description or String(describing: error), you should see this additional information. (IIRC it's actually carried in the NSError's userInfo dictionary. Also IIRC, error.localizedDescription does not display this additional information by default.)
Aug ’22
Reply to Getting Error status code 405 while Sending PATCH request for updating in app purchases
Also I tried to create more than one in app purchase with a payload like that: { data: [{ type: inAppPurchases, attributes: { name: dummy-353535, productId: DUMMY353535, inAppPurchaseType: CONSUMABLE, reviewNote: TEST, availableInAllTerritories: true }, relationships: { app: { data: { type: apps, id: } } } }, { type: inAppPurchases, attributes: { name: dummy-663435, productId: dummy663435, inAppPurchaseType: CONSUMABLE, reviewNote: Trying to create more than one dummy, availableInAllTerritories: true }, relationships: { app: { data: { type: apps, id: } } } }] } but I get an error like that: { errors: [ { id: ffc324af-1a66-4ea8-a086-ba41ee7069de, status: 422, code: ENTITY_UNPROCESSABLE, title: The request entity is not a valid request document object, detail: Unexpected or invalid value at 'data'., meta: { position: { row: 2, column: 11 } } } ] } Can you help me about that too? I am sending requests with postman by the way
Topic: App & System Services SubTopic: StoreKit Tags:
Aug ’22
Display a list of values in an NSTableView/NSOutlineView cell?
Background: I'm targeting macOS 11 and up, running macOS 12.4 (21F79), and working with Xcode 13.4 (13F17a). I am building an application to show a list of VMs running under my account on a hosting provider. The VMs have a lot of simple properties like a UUID, a name, a comment field, a power state, and so on. They also have a few properties which are lists of relationships to other things. For example, a single VM can have several disks or several network adapters. The VMs can be organized in folders, so I'm trying to use NSOutlineView bound to a tree controller to show the downloaded data. The problem I have is that when I scroll my outline, it has significant animation hitches. Instruments tells me they are due to expensive commits. I originally built the NSOutlineView programmatically, but I've switched to building it in Interface Builder to get the NSTableCellView reuse behavior without needing to subclass and write my own implementations. I have an NSView subclass for the disk column's views an
1
0
1.2k
Aug ’22
How to fix these errors?
Hello there! I want to create a cards game, and I'm creating it following the Stanford University's tutorial. I followed the video step by step but there is a warning that In the video doesn't appear. Can someone help me to fix it? Here's the link of the video: [https://www.youtube.com/watch?v=oWZOFSYS5GE&t=671s) This is my code: import SwiftUI struct ContentView: View { let viewModel: EmojiMemoryGame var body: some View { VStack { LazyVGrid(columns: [GridItem(), GridItem(), GridItem()]) { ForEach(viewModel.cards) { card in CardView(card: card) .aspectRatio(aspectRatio, contentMode: .fit) // here's the first error which says Cannot convert value of type '(CGFloat?, ContentMode) -> some View' to expected argument type 'CGSize' } } .padding() .foregroundColor(Color(.systemTeal)) Spacer() Button { emojiCount += 1 if emojiCount == 10 { aspectRatio = 9/3 } ì if emojiCount > 17 { print(Card finished) } } label: { Text(Add Card) } } } } struct CardView: View { let card: MemoryGame.Card var body: s
14
0
1.9k
Aug ’22
Reply to NavigationStack and NavigationSplitView Runtime warnings
Xcode 14.0 beta 5 (14A5294e) seem to have fixed my issues with NavigationSplitView Fixed - Warnings Fixed - Selection of cell not happening (2nd time) in compact mode (For 3 column layout) - so no need to set the selected state of the middle column to nil onDisappear Hopefully it has fixed your issues as well, if not please file a feedback
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
Reply to Entitlement issues with network extension
This thread is about provisioning Network Extension providers. That capability is not supported by a free accounts (what Xcode calls a Personal Team). If your goal is to create an NE provider, you’ll need a paid account. For information about which capabilities are supported by which account types, see Developer Account Help > Reference > Supported capabilities (macOS) and the equivalent docs for our other platforms. In this context the Apple Developer column shows the capabilities for a Personal Team. If you’re not trying to create an NE provider, I recommend that you start a new thread with the details of your issue. Oh wait, it looks like you’ve started this thread. I’ll respond over there. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: App & System Services SubTopic: Drivers Tags:
Aug ’22
Reply to NavigationSplitView two and three column interfaces in the same app
From the way Apple made the NavigationSplitView API, it is clear that having two and three column layouts shouldn't happen or should be avoided. Nevertheless, you can still achieve this through the use of two split views wrapped in a condition. Something like this, which I have tested, will work: struct ContentView: View { @State private var selectedInt: Int? = 1 @State private var columnVisibility: NavigationSplitViewVisibility = .all var sidebarList: some View { List(1...10, id: .self, selection: $selectedInt) { int in NavigationLink(Row (int), value: int) } .navigationTitle(Sidebar) } var contentView: some View { Text(Content (selectedInt ?? 0)) } var detailView: some View { Text(Detail (selectedInt ?? 0)) } var body: some View { Group { // Only rows that are a multiple of 2 will have a two-column layout if selectedInt?.isMultiple(of: 2) == true { NavigationSplitView(columnVisibility: $columnVisibility) { sidebarList } detail: { detailView } } else { NavigationSplitView(columnVisibility:
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
Handling single selection action in multi-selection SwiftUI Table
I have a SwiftUI Table on iPadOS that supports multiple selection and contains rows representing documents that can be opened. I want to be able to select multiple rows from edit mode or with keyboard modifiers for batch operations, but a regular tap on a single item should open it and push it onto the navigation stack. Rows are highlighted when I tap on them, but the table's selection isn't modified and I can't figure out how to respond to that action. There's nowhere for me to put a NavigationLink because I'm only providing views for each column and not for the row itself. I could also push onto the navigation stack manually if I could respond to the action, but I don't see any API for doing so. I've tried using .onChange(of: selection) and checking that the selection only contains a single element, but single taps on rows don't modify the selection, and even if they did, this logic would trigger incorrectly when adding the first item to the selection in edit mode for example. Is there something I'
2
0
1.8k
Aug ’22
Reply to DATA
You can export a CSV file and have something sort of like this. While that’ll work, if you’re doing anything serious with CSV files I strongly recommend that you check out the TabularData framework. See the code snippet below. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com import Foundation import TabularData let csv = Aloe Vera, skin healer, Cut from middle, once every three days, cut the leave and use the gel inside for your rash Almond, skin healer, cut the young leaves, daily, soak in water overnight rinse and blend func main() throws { var options = CSVReadingOptions() options.hasHeaderRow = false let frame = try DataFrame.init(csvData: Data(csv.utf8), options: options) print(frame) // ┏━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳… // ┃ ┃ Column 0 ┃ Column 1 ┃ Column 2 ┃… // ┃ ┃ ┃ ┃ ┃… // ┡━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇… // │ 0 │ Aloe Vera │ skin
Aug ’22
NavigationSplitView in two-column mode does not work properly on iOS in portrait mode
Hey there, I was trying to get an overview of the new navigation in the Xcode-14 Beta. I watched the WWDC22 session The SwiftUI Cookbook for Navigation and downloaded the associated sample code https://developer.apple.com/documentation/swiftui/bringing_robust_navigation_structure_to_your_swiftui_app. When trying it out, I noticed that the two-column mode of the NavigationSplitView in portrait mode does not work properly on iOS. In the download version of NavigationCookbook, a click on one of the related recipes in the recipe detail view does not lead to the detail view of the corresponding recipe (portrait format only on iOS), but to the detail of the NavigationSplitView. The only solution I found was to include a NavigationStack in .navigationDestation. Is there a more sophisticated solution other than using @Environment(.horizontalSizeClass) private var horizontalSizeClass to avoid the problem.
1
0
1.2k
Jul ’22