Search results for

column

2,046 results found

Post

Replies

Boosts

Views

Activity

Filling in a MTLAccelerationStructureInstanceDescriptor
While translating the Accelerating Ray Tracing Using Metal sample project into Swift, I have run into an issue within the createAccelerationStructures function. I am trying to fill in the first three rows of the instance transformation matrix. In the Objective C example, it looks like: for (int column = 0; column < 4; column++) tfor (int row = 0; row < 3; row++) ttinstanceDescriptors[instanceIndex].transformationMatrix.columns[column][row] = instance.transform.columns[column][row]; The matrix targeted is a MTLPackedFloat4x3. It has defied me pulling out the needed elements from my instance transform and placing them in the descriptor. I have tried the obvious: for column in 0..<( 4 ) t{ tfor row in 0..<( 3 ) tt{ ttanInstanceDescriptorPointer.pointee.transformationMatrix.columns[column][row] = aNodeInstance.transform.columns[column][row] tt} t} I have tried more obscure ideas related to simd matrices and Swift. The compiler err
3
0
1.1k
Dec ’22
Reply to Filling in a MTLAccelerationStructureInstanceDescriptor
@OOPer, thx for sharing your code. @JL, in a one-to-one port of Apple‘s ray tracer sample (Accelerating ray tracing using Metal) one would use the transpose of the matrix because the sample uses row-first order and MTLAccelerationStructureInstanceDescriptor.transformationMatrix expects column-first. anInstanceDescriptorPointer.pointee.transformationMatrix = MTLPackedFloat4x3(aNodeInstance.transform.transpose) Without transpose the render result seems to be a single Cornell Box but in fact are nine instances stacked at the same position. A bit late, but in case anyone else will come across…
Topic: Graphics & Games SubTopic: General Tags:
Dec ’22
Missing required column 'label' in json. at "HandPoseAssests.json"
I have created the .json file according to the https://developer.apple.com/documentation/createml/building-an-object-detector-data-source here is my .json file below { imagefilename:Five Fingers.HEIC, annotation: [ { coordinates: { y: 156.062, x: 195.122, height: 148.872, width: 148.03 }, label: Five Fingers } ] }, { imagefilename: One Finger.HEIC, annotation: [ { coordinates: { y: 156.062, x: 195.122, height: 148.872, width: 148.03 }, label: One Finger } ] }, { imagefilename: Two Finger.HEIC, annotation: [ { coordinates: { y: 156.062, x: 195.122, height: 148.872, width: 148.03 }, label: Two Finger } ] }, { imagefilename: Four Finger.HEIC, annotation: [ { coordinates: { y: 156.062, x: 195.122, height: 148.872, width: 148.03 }, label: Four Finger } ] } ] but it shows error as Missing required column 'label' in json. at NameOfJsonFile.json Were am I Wrong
2
0
1.4k
Dec ’22
Implement pinch gesture on a SwiftUI's scrollable LazyVGrid
Good day! Question How can we implement pinch gesture in SwiftUI and solve the gesture limitation from MagnificationGesture Description I'm trying to implement a pinch gesture recognizer on a scrollable LazyVGrid in a SwiftUI-based application, however the pinch gesture has usually been intercepted by the scroll gesture and makes it significantly harder to trigger than using UIKit's UIPinchGestureRecognizer. Here're my findings after a few tests. MagnificationGesture: can detect the pinch gesture when two fingers are dragging at the same time. UIPinchGestureRecognizer: can detect the pinch gesture when two fingers are touching and at least one finger is dragging. Cases tried ScrollView + LazyVGrid + MagnificationGesture Result: difficult to trigger as described ScrollView { LazyVGrid(columns: Array(repeating: GridItem(.flexible()), count: 3)) { ForEach(aryItems) { item in Text(item.photoId) .border(Color.black, width: 1) } } } .highPriorityGesture(MagnificationGesture() .onChanged { value in print(te
1
0
2.2k
Dec ’22
Reply to Issue with string
I figure out the issue but still unable to fix it. Firstly, I made it stop working with me by replicating all the steps the user do. Once the data is read from the SQLite table from a field type string (text typed in SQLite) using sql_column_text() function the result itself contains literal text of Optionaland will break everything. real code when I am attempting to fix, reading user department: let stringValue = String(cString: sqlite3_column_text(Statement, index)) // attempt This will show in the debugger as Optional(Dev team) and the UI where the user changes the information, also shows exactly that way! All of this trouble after updating to XCode 5 (original was done with version 4). I opened the database using a 3rd party software and these characters are there! Here how I read the data: struct ColumnValue { var Column: String var Value: Any? // Need to be any because will support int, float, string at least.. using Any or Any makes no difference } var ResultSet: [ColumnValue] var columnValue:
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’22
Reply to CoreML Performance Report Mean Latency
Hi, yes you can access this data through the Instruments trace that Xcode records when it creates a Core ML Performance Report. Steps: Click on Open in Instruments in the top right corner Click on the Core ML track on the left side In the Model Activity Aggregation view below, expand * All * You should see a column that gives you the average for stats like Load/Compile/Prediction etc Hope that helps, please let us know if you encounter any issues with this. Thanks.
Topic: Machine Learning & AI SubTopic: General Tags:
Dec ’22
SwiftUI - Nested links within NavigationStack inside a NavigationSplitView not working
I'm playing around with the new navigation API's offered in ipadOS16/macOS13, but having some trouble working out how to combine NavigationSplitView, NavigationStack and NavigationLink together on macOS 13 (Testing on a Macbook Pro M1). The same code does work properly on ipadOS. I'm using a two-column NavigationSplitView. Within the 'detail' section I have a list of SampleModel1 instances wrapped in a NavigationStack. On the List I've applied navigationDestination's for both SampleModel1 and SampleModel2 instances. When I select a SampleModel1 instance from the list, I navigate to a detailed view that itself contains a list of SampleModel2 instances. My intention is to navigate further into the NavigationStack when clicking on one of the SampleModel2 instances but unfortunately this doesn't seem to work. The SampleModel2 instances are selectable but no navigation is happening. When I remove the NavigationSplitView completely, and only use the NavigationStack the problem does not arise, and i can suc
3
0
4.4k
Dec ’22
Having an issue in Playgrounds - Object is not appearing
Greetings, I'm just learning Swift language by Playgrounds and some Udemy educations. I have a problem with Coding 2 - Connect and Solve episode. I supposed to build 3 - 2 - 3 blocks to three spots on 2nd column BUT blocks are acting like ghosting, it appears like for 0.5 seconds and disappear again. Then only change that I made is updating MacOS system with the lastest patch. Open to any ideas about the issue. Tnank you!
2
0
761
Nov ’22
swiftui+combine: why isFavoriteO changed when scroll the LazyVGrid?
I have a LazyVGrid, every item with is favorite button. and use combine to debounce user input($isFavoriteI), when isFavoriteO changed, then modify the items. it works fine, but when i scroll the list, log will print: X, isFavorite changed as false/true), what cause isFavoriteO changed and why? because of item reusing in list? how to avoid it? index 7, isFavorite changed as true index 7, isFavorite changed as true index 7, isFavorite changed as true index 7, isFavorite changed as true index 7, isFavorite changed as true index 7, isFavorite changed as true index 7, isFavorite changed as true index 7, isFavorite changed as true import SwiftUI import Combine struct Item { var index: Int var favorite: Bool } var items = [ Item(index: 0, favorite: true), Item(index: 1, favorite: false), Item(index: 2, favorite: true), Item(index: 3, favorite: false), Item(index: 4, favorite: true), Item(index: 5, favorite: false), Item(index: 6, favorite: true), Item(index: 7, favorite: false), // Item(index: 8, favorite: true), /
1
0
1.7k
Nov ’22
Reply to How to: Compositional layout with self-sizing rows of N columns where the height of each item is set to the tallest item in its row
I feel weird replying to my own post, but since no one else has replied, I'm going to seed this with another example of why developers want this. While my above example uses a two column grid, another common use case is a collection view containing a section with an orthogonal scroll direction, and a series of items with potentially different heights (self-sizing for the win, right?). Think: Horizontally scrolling carousel of cards. It's easy to force the height of this carousel and its items to some fixed height, but we don't want that. We want the content to self-size and the height to be a function of that. That's also easy if we don't care about the vertical alignment of the items, or requiring the items to share the height of the tallest item. Here's a visual aid: How can we leverage self-sizing, but then additional require that all of the items in the group must share the height of the tallest item? In a more general sense, you can think of this as an alignment issue. How do you leverage self-s
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’22
In custom Instrument, how can I include the duration in a value
I have a custom Instrument with a os-signpost-interval-schema that captures a state string. I would like the final plot value to be : , but I don't know how to get the duration into the string. My working schema is the following, which just stores the state itself in the column: state-interval State Interval ... ... state ?state state State string ?state I would like to change the expression in the column to (str-cat ?state : ?duration), but that fails with: Variable '?duration' must appear in a pattern element to be used in a later expression. I don't see any way to compute this later in the graph, lane, or plot. I've also tried explicitly creating a , but that doesn't seem to change anything. The rest of the pieces include the table: state-table state-interval And the lane, which I would like to display as : rather than just the duration: State state-table state
1
0
1.2k
Nov ’22
Reply to Swift performance - efficient calculation of boolean logical operations
I have a follow up question. I have not implemented the BNNS approach proposed above and it works. However, the calculation speed is still about 3 times as high when I use a similar approach in Python - without any particular special packages or approaches on Python side. I was hoping that Swift would generally be faster so wanted to get your view on whether maybe my approach is generally flawed and her any potential alternatives. I would love to continue with coding in Swift on the project but with runtime being 300% it is just too compelling to rather use Python. Let me explain what I am doing: I create a lot of (random) binary trees which contain arithmetic or logic operations in all non-leaf nodes and numeric arrays (all of the same length) on leaf nodes which are taken from return_data. I.e. my trees are representing (simple) mathematic formulas. I have tens of thousands such trees and need to efficiently evaluate them. I currently do this via a recursive function evaluate_signal. As said above, the same
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’22
Scroll conflict when there is ScrollView inside a ScrollView in SwiftUI
I'm trying to reproduce in a way the finder column view, but I'm facing an issue. A scroll conflict occurs when I put a ScrollView or a List inside another ScrollView. The horizontal scroll is lagging when the cursor is over the nested ScrollView. Here is my simplified code: struct SplitView: View { var body: some View { ScrollView(.horizontal, showsIndicators: false){ HSplitView{ ScrollView(showsIndicators: false) { VStack(alignment: .leading) { ForEach(0..<100) { Text(Row ($0)) } }.frame(minWidth: 200, alignment: .leading) } ScrollView { VStack(alignment: .leading) { ForEach(0..<100) { Text(Row ($0)) } }.frame(minWidth: 200, alignment: .leading) } ScrollView { VStack(alignment: .leading) { ForEach(0..<100) { Text(Row ($0)) } }.frame(minWidth: 200, alignment: .leading) } } } } } I have the same issue with nested List. Do you have any idea how I can prevent that? Or any workaround?
2
0
891
Nov ’22
Reply to Scroll conflict when there is ScrollView inside a ScrollView in SwiftUI
Yes sorry, I'm using MacOS 13.0.1 - Xcode 14.1 I'm basically trying to mimic the finder column view. So, to have multiple Lists that are horizontally aligned. If there is too many List for the window size, then I can scroll horizontally. When I use VStack instead of List/ScrollView, it works perfectly. When I use List/ScrollView, if the cursor is over the nested List/ScrollView, the horizontal scroll lags. But if the cursor is next to the nested List/ScrollView, the horizontal scroll works fine. Here is a video that shows the issue. https://www.youtube.com/watch?v=_UdlNZQH6Pg
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’22