I tried to update the UISplitViewController in my old iOS project to use the newer column-based API, but noticed that when setting the Style to Double Column in IB from the currently selected Unspecified (Discouraged), the swipe gesture doesn't show and hide the master view controller anymore, even if the option Presents Primary With Gesture is selected. This also happens with a fresh project where I dragged the standard split view controller into the IB canvas as the initial view controller. Is this expected or am I missing something?
Search results for
column
2,062 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm trying to use the refreshable modifier on a Scrollview in an app that targets iOS 16. But the asynchronus task gets cancelled during the pull to refresh gesture. It was tested on a physical device. Here is some code that demonstrates the problem and an image with the error printed: ExploreViewModel.swift class ExploreViewModel: ObservableObject { @Published var randomQuotes: [Quote] = [] init() { Task { await loadQuotes() } } @MainActor func loadQuotes() async { let quotesURL = URL(string: https://type.fit/api/quotes)! do { let (data, urlResponse) = try await URLSession.shared.data(from: quotesURL) guard let response = urlResponse as? HTTPURLResponse else { print(no response); return} if response.statusCode == 200 { let quotes = try JSONDecoder().decode([Quote].self, from: data) randomQuotes.append(contentsOf: quotes) } } catch { debugPrint(error) debugPrint(error.localizedDescription) } } func clearQuotes() { randomQuotes.removeAll() } } Content.swift import SwiftUI struct ContentView: View { @StateObjec
I don’t think there’s a way to do that but, if you know that the names are unique, you can rename the columns after the join. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic:
Programming Languages
SubTopic:
Swift
Tags:
Hi. I am having issues with json parsing. all my source data use double quote except for one. here is the sample do { let json = [['16772', 'Cebu', 'Philippines']] if let jsonArray = try JSONSerialization.jsonObject(with: Data(json.utf8), options: []) as? [[Any]] { print(Hello World) } } catch { print(error) } if the json string is let json = [[16772, Cebu, Philippines]] it works ok. but if it is single quote, then it gives out the error message Error Domain=NSCocoaErrorDomain Code=3840 Invalid value around line 1, column 2. UserInfo={NSDebugDescription=Invalid value around line 1, column 2., NSJSONSerializationErrorIndex=2} What am i missing to enable parsing single quote normally? Thoughts?
I use Core Data with two entities: Set and Link. Both entities contain a UUID id. Sets can contain 1 or more Links and this is represented in a 1-many relationship When the user wants to delete ALL links, this code is called for link in learningSet.webLinksArray.reversed(){ container.viewContext.delete(link) } do{ try container.viewContext.save() } catch let error { print(Failure deleting all links } Here is the view code that renders link if !learningSet.webLinksArray.isEmpty{ LazyVGrid(columns: columns, alignment: .center, spacing: 16, pinnedViews: []) { ForEach(learningSet.webLinksArray, id: .id) { link in RichWebLinkView(webLink: link) } } } It all works, but I get the following error/warning in the console ForEach, _FlexFrameLayout>>: the ID nil occurs multiple times within the collection, this will give undefined results! LazyVGridLayout: the ID nil is used by multiple child views, this will give undefined results! It's unclear why the LazyVGrid is even being re-rendered when the
I must have been imprecise, my problems are: I don’t know how to read the two different columns per row of a csv into two seperate lists I want to have one vstack containing a scrollable list of all the company names in the corresponding color. E.g. with the csv file: Apple,#FFFFFF Adobe,#FF0000 I want a white text element reading “Apple” and a red text with “Adobe underneath
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
How do I now separate the two columns from each other You could use a HStack . how do I implement this in a ForEach struct If I understand correctly, I would create 2 computed var to hold each of the columns content. And use these var in 2 ForEach in the HStack
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Hello all, I want to create an app right now that can generate SwiftUI views from csv tables. They have two columns, one with a name and the other contains a hex color code (e.g. Apple,#FFFFFF). I want to read the csv file and then use the first column of each row as text and the second row of the column as the color of the text. But I cannot seem to get this to work. Currently I read the csv with: var filecontent = String(contentsOf: file); where file is defined as a URL(fileURLWithPath: „colors.csv“) How do I now separate the two columns from each other and how do I implement this in a ForEach struct to get this kind of „prodcedural“ item generation?
NavigationView was deprecated but was replaced by two new views: NavigationStack (single column) and NavigationSplitView (multiple columns). In your case, you should just use a NavigationStack where you would have otherwise used a NavigationView.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Does your app use column-style layouts(for iOS 14 and later) of UISplitViewController or a classic interface style? I guess the classic interface style might be the problem.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags:
There seems no way to work with NavigationSplitView other than List at first column for now, but I think adding a empty List with selection parameter can solve this problem almostly. Here's my solution: var categories : [Category] // can be replaced to NavigationPath @State var path : Category? = nil @State var subpath : Item? = nil var row = [ GridItem(), GridItem(), GridItem() ] var body: some View { NavigationSplitView { LazyVGrid(columns: row) { ForEach(categories) { category in Button(category.title) { path = category } // can use NavigationLink with value parameter, .onTapGesture, etc. } } // coordinates with the NavigationSplitView via selection parameter. List(selection: $path) {} } content: { // MiddleSidebarView(category: path, selection: $subpath) } detail: { // ... } } You can resize or hide List, but always have to be active while navigation feature is needed.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
@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:
Is there a built-in functionality to retrieve the current column and row during a print operation when using the built-in pagination mechanism of NSView? All I could find in the general printing documentation and for the NSPrintOperation and NSPrintInfo classes is the NSPrintOperation.currentOperation.currentPage property. I'm basically attempting to access the 'address' (page number or row/column) of pages bordering to the left/right/above/below the current page to enable assembly constructions being shown to the user on printouts spanning multiple pages. Hope this makes sense. Thanks, Jay
I am working on an app that will allow users to share or save the view via a share sheet. To capture the view I am using the ImageRenderer. When I go to click on the share button, it does not work and says, Unable to render flattened version of PlatformViewControllerRepresentableAdaptor, Never, _UnaryViewAdaptor>>. When I go to the issues it will say, Context in environment is not connected to a persistent store coordinator: . How can I fix this. This is the code. struct DividendView: View { @Environment(.managedObjectContext) var moc @FetchRequest(sortDescriptors: [ SortDescriptor(.stock_name) ]) var dividends: FetchedResults @State private var showingAddScreen = false @State private var showingShare = false // @EnvironmentObject var vm = ViewModel() @State private var renderedImage: Image? @State private var selectedName: String? @State private var expanded: Bool = false let dividend: Dividend // @State private var items: [Any] = [] // @State private var sheet: Bool = false // let columns = [
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