Search results for

column

2,050 results found

Post

Replies

Boosts

Views

Activity

Reply to MPSMatrixDescriptor warning
The convenience initializer: init(dimensions rows: Int, columns: Int, rowBytes: Int, dataType: MPSDataType) ...has been deprecated. It looks like you should instead use: init(rows: Int, columns: Int, rowBytes: Int, dataType: MPSDataType) This seems to be the same, since the deprecated initializer replaces dimensions with rows anyway.
Topic: Graphics & Games SubTopic: Metal Tags:
Feb ’22
Reply to How to remove all columns from NSOutlineView?
>> just remove all columns and start againFor that scenario, you can easily work around the issue by adding a new outline table column first, then delete all the other columns.FWIW, it's not obvious that there's a really good reason for this restriction, at the API level, so it probably reflects some implemention detail. It would be reasonable to file a bug report to allow deletion of the outline column, but I wouldn't hold my breath that it would be done any time soon. 🙂It would also be reasonable to file a bug report against the message.
Topic: UI Frameworks SubTopic: AppKit Tags:
Sep ’18
Reply to NSSourceList not showing text
OK, I figured it out.The difference between the preconfigured outline view and the preconfigured source list (there isn't actually a NSSourceList, it's just a NSOutlineView with a different preconfiguration) is in the cell identifiers.In the outline view, there is only one cell in each column, and the cell identifier is left at the default, which means automatic. In this case, the cell identifier is actually the table column identifier, which is where you typically get the cell identifier from in your outlineView(:viewFor:item:) delegate method.In the source list, there is only one column, but it has two cells (one for the group header and one for the detail row), and they come preconfigured with cell identifiers HeaderCell and DataCell respectively. Set up that way, you can't follow the usual pattern of using the column identifier, since neither cell matches the column identifier.To fix this, you can just use the HeaderCell and DataCell identifiers directly in out
Topic: UI Frameworks SubTopic: AppKit Tags:
Aug ’18
2D-array 5rows X 5 columns matrix HELP
https://drive.google.com/file/d/1GWV9MYs_X4HG0XT4_-wDPPHdWOFwsRJs/view?usp=sharing Hi, everyone! So, I am trying to create an app that is like a survey app. I am new to coding by the way (less than a month) I have this long-ass code that I am trying to work. Well, it is working except for one more part of the code. I've been trying to make it work for days now and I cannot seem to figure it out. I uploaded it in a google drive link above. This is what it is: If you try to run this code in Xcode, you can see a thing like this: The app works like this, users select the pickers beside the Criteria and Relative Risk. The scores will show as: Score: 2,4 (just a sample score) criteria = row relative risk = column what I want to happen is that this score will immediately translate as a coordinate in the risk matrix below. There are 21 sets of pickers for this part of the app. The coordinates can have more than 1 value. so if there are 3 scores that have the same coordinate, such coordinate in the matrix sho
0
0
295
Jul ’23
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
121
6d
Reply to Make method less repetative
Although not understand the purpose of your code (which makes it difficult to propose any improvement), try this:private func generateLoserLocationFunction(numberOfPlayers: Int) -> (column: Int, row: Int) -> (column: Int, row: Int) { switch numberOfPlayers { case 8,16,32: return { row, column in let newCol = -2 * column switch column { case 0: return (newCol, row / 2) case 1 where numberOfPlayers == 8: return (newCol, row ^ 1) case 1 where numberOfPlayers == 16: return (newCol, 3 - row) case 1 where numberOfPlayers == 32: return (newCol, (row + 4) % 8) case 2 where numberOfPlayers == 16: return (newCol, row ^ 1) case 2 where numberOfPlayers == 32: return (newCol, row) case 3 where numberOfPlayers == 32: return (newCol, row ^ 1) default: return (newCol, 0) } } default:abort() } }You also can combo some cases like this:case 1,2 where numberOfPlayers < 32: return (newCol, row ^ 1)But only you can tell whats make sense for your code.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’15
Reply to vLookup In App?
Thank you, I'll be sure to check out the documentation. Now, again, I'm new to Swift, so forget the silly questions, but can you generate array numbers based upon other array inputs?Basically, I want to have people input 3 numbers (which will be a part of the arrays), and have the rest of the array numbers generate in a certain manner from there. For example, if I want the user to input row 1, column 1, and from there, it would make, say, row 2, column 1 two more, and row 2, column 2 one more, could I do something like that?I assume I can.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’16
Reply to If parent Node will be moved, childnodes will followed.
I did. But when I use hitTest.first.node, the childnode will be touch, not all parts of the object. Can you look at my code?Here is my code when touching: let location = recognizer.location(in: sceneView) var hitTestOptions = [SCNHitTestOption: Any]() hitTestOptions[SCNHitTestOption.boundingBoxOnly] = true let hit=sceneView.hitTest(location, options: hitTestOptions).first print(You're dragging) guard let selectedNode=(hit?.node) as SCNNode? else { return } let transform = arHitTestResult.last?.worldTransform let newPosition = float3((transform?.columns.3.x)!, ((transform?.columns.3.y)!), (transform?.columns.3.z)!) selectedNode.simdPosition = newPosition sceneView.scene.rootNode.addChildNode(selectedNode)
Topic: Spatial Computing SubTopic: ARKit Tags:
Apr ’18
Reply to Filling in a MTLAccelerationStructureInstanceDescriptor
The compiler errors generally warn me that MTLPackedFloat4x3 has no subscripts. Columns in MTLPackedFloat4x3 are represented as a fixed-sized C-array, and imported into Swift as a tuple. So, you need to access each column by tuple member access like .0, .1, .2 or .3. Or else access whole columns as a tuple. I would do it in this way. First, prepare an initializer taking SIMD matrix. extension MTLPackedFloat4x3 { ttinit(_ mat4x4: matrix_float4x4) { ttttself.init(columns: ( ttttttMTLPackedFloat3(mat4x4[0]), ttttttMTLPackedFloat3(mat4x4[1]), ttttttMTLPackedFloat3(mat4x4[2]), ttttttMTLPackedFloat3(mat4x4[3]) tttt)) tt} } extension MTLPackedFloat3 { ttinit(_ vec4: simd_float4) { ttttself.init() ttttself.elements = (vec4[0], vec4[1], vec4[2]) tt} } And set whole transformationMatrix at once. anInstanceDescriptorPointer.pointee.transformationMatrix = MTLPackedFloat4x3(aNodeInstance.transform)
Topic: Graphics & Games SubTopic: General Tags:
Jul ’20
Reply to swipeActions on macOS?
I have to admit though, I'm still a bit curious about why this doesn't seem to work for me in a two-column layout. The Messages app on macOS is an example of a swipe action occurring without having three columns. So, I'm still not certain about the conditions under which the .swipeAction modifier will work.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21
Reply to TableView Functions Missing Items
The previous sample is more that what I need. The first sample is what I'm using. The table view is displaying data but the data is going down the left side of the tableView. The data should go across the tableView for 6 sections or columns and begin another row for 6 sections or columns.
Mar ’17