Search results for

column

2,052 results found

Post

Replies

Boosts

Views

Activity

Conflicting arguments to generic parameter 'Content' on NavigationLink for @Binding var
Hi ! I am having a very strange problem. I display a list of elements, and I created a view that takes this element as a parameter in order to allow the user to modify it in another view. my var with a forEach : @Binding var liste : Liste my code : ScrollView { LazyVGrid(columns: [GridItem(.adaptive(minimum: 100))], spacing: 5) { ForEach(liste.cartes) { c in NavigationLink(destination: ModifierUneCarte(carte: c)) { VStack { Text(c.devant) .font(.system(size: 14)) Divider() Text(c.derriere) .font(.system(size: 14)) } } } } } and my ModifierUneCarte : struct ModifierUneCarte: View { [...] @Binding var carte: Carte [...] And I have this error on a lot of lines : Conflicting arguments to generic parameter 'Content' ('<>' vs. '<>' vs. '<>' vs. '<>') but it's because of : NavigationLink(destination: EditMap(map: c)) { because when I remove it everything works...
4
0
4.3k
Jun ’23
Reply to Instruments: what is static AppName.$main() [inlined]
I submitted FB12211784 the end of May. It contains a do-nothing-much app that creates a two column table of 10K entries. Selecting an item in the table causes the color of the text in the first column to change. On my 2019 intel iMac there is about a 140 msec delay between selection and the color change. That is noticeable. I just re-ran the code using a brand new Mac Studio with M2 Max. It still takes over 100 msec. Still noticeable.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’23
This is my code - the problem is that I made most of the app so far using the iPhone 14 Pro Max and it has the sizing of that phone so can you please help change it so that it will fit any phone no matter size. This is most of the code.
// Page 1: Map Search VStack { ZStack(alignment: .topLeading) { Map(coordinateRegion: $mapAPI.region, annotationItems: mapAPI.locations) { location in MapMarker(coordinate: location.coordinate, tint: .red) } .ignoresSafeArea() VStack { HStack { TextField(Enter an address, text: $text) .textFieldStyle(.roundedBorder) .padding(.horizontal) .foregroundColor(.black) Button(action: { fetchLocationInfoFromWikipedia(for: text) mapAPI.getLocation(address: text, delta: 0.5) showLocationInfo = true }) { Image(systemName: magnifyingglass) .foregroundColor(.black) } .padding(.leading, -50) } .padding() if showLocationInfo { VStack { Spacer() Rectangle() .fill(Color.white) .frame(height: 250) .frame(width: 400) .cornerRadius(15) .overlay( ScrollView { Text(locationInfo) .foregroundColor(.black) .padding(.horizontal, 10) .font(.system(size: 14)) .font(.custom(Serif, fixedSize: 14)) } .padding() ) .padding(.horizontal, 20) .padding(.bottom, 10) // Adjust the bottom padding here HStack(spacing: 70) { Button(action: { // Open
2
0
540
Jun ’23
How do I initialize a view models variables in a view
I have a view that displays core data values (passed in as closingValues) in a data table. To make the view generic, so I can pass in arrays of different lengths (all are from the same entity and thus attributes) and account for the view having already been called with a different set of values, I need to initialize the showData array contained in the associated view model. I attempt to do so in the init of the view but I get an error message publishing changes from within a view updates is not allowed. This will cause undefined behavior. It should be noted that in the view model showData is Published and initialized = []. I attempted to do the initialization in the views onappear but the tables rows: ForEach runs before onappear and I get an index out of range on the first call to the view. I tried adding @MainActor to the view models class, which also failed to solve the problem. I am clearly not understanding a concept. Below is the code for the view. struct DataTable: View { @ObservedObject var vm: Button
2
0
974
Jun ’23
Reply to How do I initialize a view models variables in a view
I moved the on appear to the h stack but the table rows portion of the table still ran before the on appear resulting in an index out of range error. So I added the suggested state variable and if statement. The view now works perfectly. Thank you again for providing great advice. Below is the updated code. struct DataTable: View { @ObservedObject var vm: ButtonsViewModel = ButtonsViewModel.shared var closingValues: [TradingDayClose] var heading: String = @State private var hasAppeared = false init(fundName: String, closingValues: [TradingDayClose]) { self.heading = fundName self.closingValues = closingValues } var body: some View { HStack { Spacer() .frame(width: 150) GroupBox(heading) { if hasAppeared { Table (of: TradingDayClose.self) { TableColumn() { closingValue in Text(dateToStringFormatter.string(from: closingValue.timeStamp!)) .id(closingValue.timeStamp!) .textFormatting(fontSize: 14) .frame(width: 100, alignment: .center) } // end table column TableColumn() { closingValue in Text(String(fo
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’23
Reply to How to implement drag and drop of SF Symbols within a SwiftUI grid?
Thank you for responding to my question. Below is a simplified code example that displays two SF Symbol images on a Grid View, as seen in the gif. I've included a basic DragGesture but I have a feeling it isn't the right approach. In order for it to work the onEnded closure would need to somehow map the offset coordinate into a Square enum case so that I could update the ModelState. I intend for the board and pieces to scale to fit the available space so the size of the squares won't be known beforehand, making the coordinate mapping difficult. Maybe **GeometryReader ** could solve that but I could see the code becoming a mess. I see other drag and drop methods in the documentation, surely one them is designed to better fit this use case. dropDestination seems like a suitable candidate but I think read somewhere that it doesn't work with SF Symbols. I'm looking for guidance from someone familiar with Apple's documentation because they provide little explanations themselves (I've watched WWDC videos). Also the
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’23
Phantom Service
To learn how to do peer to peer communication I downloaded the TicTacToe example into my MacStudio from: https://developer.apple.com/documentation/network/building_a_custom_peer-to-peer_protocol I then loaded it into Xcode, compiled it, deployed to an iPhone 14 over a Lightning cable, and ran it. I developed code for the MacStudio in an attempt to communicate with it. The MacStudio at first detected the service but for some reason it has quit doing so. The command: dns-sd -B _services._dns-sd._udpoutputs this as one of its lines: A/R Flags if Domain Service Type Instance Name Add 3 17 . tcp.local. _tictactoe (The time stamp column deleted for clarity) This line remains the command's output even after the iPhone the TicTacToe app has been shutdown, and after in the MacStudio Xcode, and the simulator it opens, is shutdown. In an attempt to find out what application is still advertising this Bonjour service I installed Discovery from: https://apps.apple.com/us/app/discovery-dns-sd-browser/id305441017 Wh
1
0
485
Jun ’23
QuickLook on macOS: various questions
I'm trying to create a custom Quick Look preview on macOS. I've found the Quick Look Preview Extension target, which is brilliant, and does most of the 'heavy' lifting, but I've run into a few problems. I'm implementing a preview for MIDI files (which has been missing since 2009...) using AVMIDIPlayer. The player keeps playing when the file is no longer selected! What's the mechanism for fixing that? Some sort of check that the view exists..? I notice that the OS preview for audio files has a different interface for the Finder's preview column and for the QuickLook 'pop-up' window. Again, I can't see how you define different views for those two environments. Is there any documentation that's specifically Mac? I can only find iOS stuff. (Same for third-party tutorials.)
2
0
2.0k
Jun ’23
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