Search results for

column

2,061 results found

Post

Replies

Boosts

Views

Activity

Reply to Access depth data purely from lidar
Hi I successfully saved the depth map to 32-bit binary file. Then I can read the file and convert it to png using python opencv. func convertDepthData(depthMap: CVPixelBuffer) -> [[Float32]] { let width = CVPixelBufferGetWidth(depthMap) let height = CVPixelBufferGetHeight(depthMap) var convertedDepthMap: [[Float32]] = Array( repeating: Array(repeating: 0, count: width), count: height ) CVPixelBufferLockBaseAddress(depthMap, CVPixelBufferLockFlags(rawValue: 2)) let floatBuffer = unsafeBitCast( CVPixelBufferGetBaseAddress(depthMap), to: UnsafeMutablePointer.self ) for row in 0 ..< height { for col in 0 ..< width { convertedDepthMap[row][col] = floatBuffer[width * row + col] } } CVPixelBufferUnlockBaseAddress(depthMap, CVPixelBufferLockFlags(rawValue: 2)) return convertedDepthMap } Then save it to app container. func saveFloat32ArrayToDocumentsDirectory(array: [[Float32]], fileName: String, folderName: String) -> URL? { let fileManager = FileManager.default let datasetDirectory = getDatasetDirectory(
Topic: Spatial Computing SubTopic: ARKit Tags:
Jun ’23
Reply to WARNING: Application performed a reentrant operation in its NSTableView delegate. This warning will become an assert in the future.
Having the same problem, anyone has anything new to help solve the issue? I have a NavigationSplitView with three columns and a .searchable()on the first column List view. Data to the views come from Core Data @FetchRequest. Whenever user removes a character from the search field or clears the search field, the same warning is displayed. When entering search text, warning does not appear. This does not happen always. For example when I enter a search text resulting in one row, and then remove one letter from search text. Then three rows are displayed and this warning does not appear. After removing another letter, resulting to five rows appearing, then this warning appears. Relevant parts of code below. struct ContentView: View { @Environment(.managedObjectContext) var moc @FetchRequest (sortDescriptors: [SortDescriptor(.subject)]) private var categories: FetchedResults @State private var selectedCategory : Category? = nil @State private var selectedTerm: Term? = nil @State private var searc
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’23
Reply to Xcode X Switt X SQLite
Hi AndyJJ, Thanks for the tips, after corrections the error messages disappeared. However, the command while fmResultSet!.next() != nil It always returns True, so the loop ends up giving an error when finding one of the columns of the ResultSet where I check if it is different from nil. To work around, I now check if the PkLivro field is equal to zero then I break the loop. Thanks.
Topic: Programming Languages SubTopic: Swift Tags:
May ’23
Best way to make a grid with both top and left headers
Hello, I’d like to display items in a grid, with both a header row and a header column. Something like this : A B C D 1 x y x x 2 x x x x 3 x y y y 4 y x x y What elements should I use for this arrangement? It seems Grid doesn’t allow for headers that would behave differently than the data cells, and, if using a separate HStack or VStack for the headers, I’m not sure how I could force data lines and rows to stay aligned with the headers.
4
0
1.2k
May ’23
Reply to Best way to make a grid with both top and left headers
Using private var columns: [GridItem] = [ GridItem(.fixed(100)), GridItem(.fixed(100)), GridItem(.fixed(100)) ] is the best way to guarantee them to be the same size. Using .flexible will allow to you either set nothing or the min/max. The size will change depending on the content though (and same with adaptive ). For this, you can ensure equal column widths if you make the header the same width for each column.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’23
Reply to Instruments: what is static AppName.$main() [inlined]
I see I forgot to enable email notifications of replies... fixed. I'm using a Swift table with 4 columns. In testing I replaced the columns with a fixed Text view to see if that was an issue. It wasn't. There was in issue in row: closure to the table in that the array consisted of large-ish structs and a lot of time was being taken allocating and freeing memory to copy the array entries. I changed the struct to a class and saved about 40% of the delay time. Still, there is something going on. When I select an item in the table the user experience is 1) the row turns blue, 2) longish delay, 3) text in the first column changes color. Normally lots of other stuff goes on but I disabled all of it looking for the source of the longish delay. That delay is the hang reported above. If I show system libraries it looks like this: Note that I also scrolled the tracks to show View Body and the Core Animation Commits -- fwiw I am not doing any additional animation over whatever is built into Sw
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’23
Reply to How to test my app NFC in iPhone XR, using personal team ?
That’s not possible. If you’re working with a Personal Team, you should bookmark this page. The rightmost column [1] shows capabilities available to a Personal Team. As you can see, NFC isn’t listed there, which means it isn’t available to you. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com [1] Somewhat confusingly labelled Apple Developer.
Topic: Code Signing SubTopic: Entitlements Tags:
May ’23
Reply to Safari does better than Firefox, but better isn’t good.
Another issue: If --count is set to 1 as result of round: --count: calc(round(down, calc(sqrt(var(--images))), 1) + 1); grid-template-columns: repeat(var(--count), 1fr); grid-template-columns: 1fr; isn’t the same (in Safari)! The first line results in 2 columns, not in one! Looks like the same reason. Because grid-template-columns: repeat(calc(var(--count) -0.01), 1fr); gives one column.
Topic: Safari & Web SubTopic: General Tags:
May ’23
Passing Data Up the View Hierarchy
I'm working on a calculator app but I'm having trouble displaying the results of a function. When I press a button in ButtonView, a function runs to calculate the result but that result does not display in CalculationCircleView. Main View: struct ScoreCalculatorView: View { @StateObject private var viewModel = ViewModel() var body: some View { VStack { Spacer() HStack { CalculationCircleView(calculation: viewModel.grossScore, label: Score) Spacer() CalculationCircleView(calculation: viewModel.plusMinus, label: +/-) } .padding(.horizontal, 30) Spacer() LazyVGrid(columns: viewModel.columns, spacing: 20) { ForEach(0..<4, id: .self) { index in ZStack { DataCellsView(labels: viewModel.scoreLabels[index]) TextField((viewModel.scoreLabels[index]), text: $viewModel.scoreData[index]) .font(.largeTitle) .fontWeight(.light) .frame(maxWidth: 80) .multilineTextAlignment(.center) .keyboardType(.numberPad) } } } .frame(width: 250) Spacer() ButtonView(data: viewModel.scoreData) .padding(.bottom, 20) } } } Calcula
2
0
1k
May ’23
Xcode 14.3 project->target->info view error
since 14.3 update I'm missing the type and value column in the Project->Target->%target%->Info view. I only can see the key column. I've already reinstalled Xcode multiple times and restarted my MacBook Pro. Here the screenshot from the new created project: I can add new properties, but I can't change the value. Has anyone some idea, what I can do to fix this problem? Btw: my workmate with similar MacBook Pro setup can change all the values.
1
0
578
May ’23
Selection state is lost when navigating to/from home screen
Hi! When using the Sample NavigationCookbook in the two column layout, the selection in the first column is not remembered, when navigating to the Home Screen and back. This behaviour can be reproduced by starting the app on the iPad or simulator, selecting for example Pancake and then navigating to the home screen and back into the navigation. Sometimes this (the navigation to/back from the home screen) has to be done twice, to lose the selection. In the console log you can see the message Update NavigationAuthority bound path tried to update multiple times per frame. appearing. Not sure if this has something todo with the selection being lost. This is on iOS 16.4.1 not sure if the behaviour before was different. Anybody experiences the same behaviour? Bug in SwiftUI or in the sample app? Cheers, Michael
2
0
948
Apr ’23
View is not updating while app is running
Hi :-) I´m looking for some help and advice for my little project. Basically I have a Tabview with 3 Tabs. One of them is a View for Favorites. I managed the selection and the saving of the favorites. However, the View for the Favorites is not updating while the app is running. Just when the app is closed and restarted the View of Favorites gets updated. The Array of Favorites is marked with @Published, the variable in the Favorites-View is marked as @ObservedObject. I searched a lot and can't find my mistake. „Expression“ is a Struct with about 10 properties. Class for the Favorites: class Favorites: ObservableObject { @Published var favoriteExpressions: [Expression] = [] { didSet { print(Favorites changed) } } private let saveKey = FavoriteExpressions let defaults = UserDefaults.standard init() { if let data = defaults.data(forKey: saveKey) { let decoder = JSONDecoder() if let decoderSet = try? decoder.decode([Expression].self, from: data) { favoriteExpressions = decoderSet } } } func contains() -> Bool
2
0
1.1k
May ’23
SwiftUI - ScrollView with LazyVGrid and onTap, scrolling randomly by itself
Hi everyone, I'm having a hard time figuring out why the code below results in weird behaviour with the ScrollView. Code : struct MainView: View { @State var strings: [String] = [A, B, C, D, E] @State var ints: [Int] = Array(1...300) @State var selectedInt: Int? var body: some View { ZStack { ScrollView { VStack { ForEach(strings, id: .self) { string in VStack { HStack { Text(string) Spacer() } LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())]) { ForEach(ints, id: .self) { int in VStack { Text(String(int)) Spacer() } .frame(minWidth: 0, maxWidth: .infinity) .frame(height: 200) .background( RoundedRectangle(cornerRadius: 5) .fill(int % 2 == 0 ? .orange : .green) ) .onTapGesture { self.selectedInt = int } } } } } } .padding() } if let selectedInt { VStack { Spacer() Text(String(selectedInt)) Spacer() Button { self.selectedInt = nil } label: { Image(systemName: x.circle) .resizable() .scaledToFit() .frame(width: 30) } } .frame(minWidth: 0, maxWidth: .infinity, minH
6
0
4.4k
May ’23
Reply to SwiftUI - ScrollView with LazyVGrid and onTap, scrolling randomly by itself
It seems that zstack still has some issues when recalculating multiple layers with lots of views inside it. I consider that overly a floating view on zstack, this view was not calculated by zstack, I copied the code of floating view from here, and the following is the code modified from your version: import SwiftUI struct TMainWnd: View { @State var strings: [String] = [A, B, C, D, E] @State var ints: [Int] = Array(1...300) @State var selectedInt: Int? @State var isShow = false var body: some View { ZStack { ScrollView { VStack { ForEach(strings, id: .self) { string in VStack { HStack { Text(string) Spacer() } LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())]) { ForEach(ints, id: .self) { int in VStack { Text(String(int)) Spacer() } .frame( maxWidth: .infinity ) .frame(height: 200) .background( RoundedRectangle(cornerRadius: 5) .fill(int % 2 == 0 ? .orange : .green) ) .onTapGesture { self.selectedInt = int } } } } } } .padding() } }.floatingView(above: TFloating
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’23
Reply to SwiftUI - ScrollView with LazyVGrid and onTap, scrolling randomly by itself
ah. thanks for the video, I wasn't scrolling far enough but I couldn't tell where I was. I modified your code so it is easier to see what cell you're at. I couldn't reproduce it with an array of only 30, or even 100 Ints. But with 150 (as below), I can press on C14 and the scroll position will jump so that I'm looking at E14. Your code doesn't modify the scroll position, so this looks like a bug to me. struct ContentView: View { let strings: [String] = [A, B, C, D, E] let ints: [Int] = Array(1...150) @State var selectedCell: String? var body: some View { ZStack { ScrollView { VStack { ForEach(strings, id: .self) { string in VStack { HStack { Text(string) Spacer() } LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())]) { ForEach(ints, id: .self) { int in VStack { Text(string + String(int)) Spacer() } .frame(minWidth: 0, maxWidth: .infinity) .frame(height: 200) .background( RoundedRectangle(cornerRadius: 5) .fill(int % 2 == 0 ? .orange : .green) ) .onTapGesture { sel
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’23