Search results for

“column”

2,085 results found

Post

Replies

Boosts

Views

Activity

NavigationSplitView
I need help with this topic please. I'm interested in the three column layout version. Column one I want my list of Core Data Entities, Column two I want a list of my Core Data Entity's ListView items, and for Column three I want the detail view of the selected list view item. Any help on figuring out the best way to accomplish this would be much appreciated. Thanks
2
0
1.1k
Jan ’23
Reply to NavigationSplitView
For column one I setup an enum enum Nav: String, Hashable, CaseIterable and the cases are the different Entity names. And then use a list to display them. For column two I'd need a way to show the ListView() for whatever Entity name was selected from column one. And then the third column you show the DetailView() of the selected ListView() item. I guess is my sudo way of thinking about how it should work. But maybe that's not a great way of how you'd go about it?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’23
Wired spacing between rows when using LazyVGrid
My code is import SwiftUI struct ContentView: View { var emojis = [🚂, 🤡, 🚀, 🚁, 🚕, 😅, ✅, 👍, 🥳, 🎃] @State var emojiCount = 6 var body: some View { VStack { ScrollView { LazyVGrid(columns: [GridItem(.adaptive(minimum: 65))]) { ForEach(emojis[0.. 1 { emojiCount -= 1 } }, label: { Image(systemName: minus.circle) }) } var add: some View { Button { if emojiCount < emojis.count { emojiCount += 1 } } label: { Image(systemName: plus.circle) } } } struct CardView: View { var content: String @State var isFaceUp: Bool = true var body: some View { ZStack { let shape = RoundedRectangle(cornerRadius: 20) if isFaceUp { shape.fill().foregroundColor(.white) shape.strokeBorder(lineWidth: 3) Text(content) .font(.largeTitle) } else { shape.fill() } } .onTapGesture { isFaceUp = !isFaceUp } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() .preferredColorScheme(.light) ContentView() .preferredColorScheme(.dark) } } Then I get Actually, the spacing between rows is t
1
0
845
Jan ’23
Simple core data app doesn't support undo
Hello, Amateur developer here. I dusted off a hobby core data app coded mostly under OSX 10.7, and which supported undo for free (as Apple say it). It still works when I build it with recent Xcode versions, except that it no longer supports undo. To understand why, I coded the most basic objective-C, core data (not document-based) app. In short, a single table view with a single column bound to an NSArray Controller set in entity name mode and bound to the managed object context. The core data model has a single entity class with a single NSString attribute (called name, and which the table view column shows). It all works well, I can add and remove entities, and change their names from the table. Changes are saved normally... except there is nothing I can undo. The undo menu item is greyed out. I checked that my App Delegate implements the windowWillReturnUndoManager method and that this selector is called regularly. So to check that the undo manager sees anything to undo, I added this meth
2
0
1.7k
Jan ’23
Parser Json with Single Quote
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?
2
0
1.9k
Dec ’22
Reply to Save DataFrames as CSVs
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:
Dec ’22
Deleting all items in an array causes issues with the ForEach used to render the arrays items
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
1
0
981
Dec ’22
navigationDestination(isPresent:content) in NavigationStack doesn't work on iOS16.1 beta
Hi, I've just finished replacing to NavigationStack, but I'm having trouble with this issue. The following simple sample code works on iOS 16.0 production, but it doesn't work on iOS 16.1 beta. When navigationDestination(isPresent:) is called, Xcode displays runtime warning message, but I cannot understand what the means. A `navigationDestination(isPresented:content:)` is outside an explicit NavigationStack, but inside the detail column of a NavigationSplitView, so it attempts to target the next column. There is no next column after the detail column. Did you mean to put the navigationDestination inside a NavigationStack? I didn't use NavigationSplitView and navigationDestination(isPresent:) is inside NavigationStack. Could someone please point out the problem with this code? Or is it a SwiftUI bug? Test environment Xcode Version 14.1 beta 2 (14B5024i) iPhone SE (3rd gen) (iOS 16.1) Sample Code @main struct StackViewSampleApp: App { var body: some Scene { WindowGroup { Navi
3
0
2.1k
Dec ’22
CSV to SwiftUI
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?
3
0
1.7k
Dec ’22
Reply to CSV to SwiftUI
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:
Dec ’22
Reply to CSV to SwiftUI
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:
Dec ’22
UISplitViewController broken when in tab view controllers
I'm trying to rebasline my app to iOS 14. My app's main entry point for the UI is a tab view controller. Three of its four children are then split view controllers. I configured those to 'all visible'. On iPad, this shows both master/detail at all times and on iPhone, you get the collapsed behavior. Just like the Settings app. Anyhow, I've removed the deprecations and migrated the split view controllers to use the new properties: Style of Double Column, Display Mode of One Column Beside, and Behavior of Tile. On iPad, the split view controllers will always be collapsed as if they are running on a compact device. If I make a sample project with the same exact split view controller (along with its configuration as above), but make this SVC the main entry point of the app, all is well on both iPad and iPhone. Collapsed interface only happens on iPhone (compact). But when I change the sample project to have the SVC now a child of a tab view controller, it breaks (always collapsed on all devices)
Topic: UI Frameworks SubTopic: UIKit Tags:
3
0
3k
Dec ’22
NavigationSplitView
I need help with this topic please. I'm interested in the three column layout version. Column one I want my list of Core Data Entities, Column two I want a list of my Core Data Entity's ListView items, and for Column three I want the detail view of the selected list view item. Any help on figuring out the best way to accomplish this would be much appreciated. Thanks
Replies
2
Boosts
0
Views
1.1k
Activity
Jan ’23
Reply to NavigationSplitView
For column one I setup an enum enum Nav: String, Hashable, CaseIterable and the cases are the different Entity names. And then use a list to display them. For column two I'd need a way to show the ListView() for whatever Entity name was selected from column one. And then the third column you show the DetailView() of the selected ListView() item. I guess is my sudo way of thinking about how it should work. But maybe that's not a great way of how you'd go about it?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’23
Reply to NavigationSplitView not working as shown in "What's new with SwiftUI" session
I found that appending an .id modifier to the detail column resolved the problem for me: } detail: { if let selectedCocktail { CocktailDetailView(pCocktail: selectedCocktail) .navigationTitle((selectedCocktail.favorite ? (profile.userData.favoriteCocktailsIcon.rawValue) : ) (selectedCocktail.cocktailName ?? )) .id(selectedCocktail.id) //workaround }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’23
Wired spacing between rows when using LazyVGrid
My code is import SwiftUI struct ContentView: View { var emojis = [🚂, 🤡, 🚀, 🚁, 🚕, 😅, ✅, 👍, 🥳, 🎃] @State var emojiCount = 6 var body: some View { VStack { ScrollView { LazyVGrid(columns: [GridItem(.adaptive(minimum: 65))]) { ForEach(emojis[0.. 1 { emojiCount -= 1 } }, label: { Image(systemName: minus.circle) }) } var add: some View { Button { if emojiCount < emojis.count { emojiCount += 1 } } label: { Image(systemName: plus.circle) } } } struct CardView: View { var content: String @State var isFaceUp: Bool = true var body: some View { ZStack { let shape = RoundedRectangle(cornerRadius: 20) if isFaceUp { shape.fill().foregroundColor(.white) shape.strokeBorder(lineWidth: 3) Text(content) .font(.largeTitle) } else { shape.fill() } } .onTapGesture { isFaceUp = !isFaceUp } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() .preferredColorScheme(.light) ContentView() .preferredColorScheme(.dark) } } Then I get Actually, the spacing between rows is t
Replies
1
Boosts
0
Views
845
Activity
Jan ’23
Simple core data app doesn't support undo
Hello, Amateur developer here. I dusted off a hobby core data app coded mostly under OSX 10.7, and which supported undo for free (as Apple say it). It still works when I build it with recent Xcode versions, except that it no longer supports undo. To understand why, I coded the most basic objective-C, core data (not document-based) app. In short, a single table view with a single column bound to an NSArray Controller set in entity name mode and bound to the managed object context. The core data model has a single entity class with a single NSString attribute (called name, and which the table view column shows). It all works well, I can add and remove entities, and change their names from the table. Changes are saved normally... except there is nothing I can undo. The undo menu item is greyed out. I checked that my App Delegate implements the windowWillReturnUndoManager method and that this selector is called regularly. So to check that the undo manager sees anything to undo, I added this meth
Replies
2
Boosts
0
Views
1.7k
Activity
Jan ’23
Parser Json with Single Quote
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?
Replies
2
Boosts
0
Views
1.9k
Activity
Dec ’22
Reply to Save DataFrames as CSVs
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:
Replies
Boosts
Views
Activity
Dec ’22
Deleting all items in an array causes issues with the ForEach used to render the arrays items
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
Replies
1
Boosts
0
Views
981
Activity
Dec ’22
navigationDestination(isPresent:content) in NavigationStack doesn't work on iOS16.1 beta
Hi, I've just finished replacing to NavigationStack, but I'm having trouble with this issue. The following simple sample code works on iOS 16.0 production, but it doesn't work on iOS 16.1 beta. When navigationDestination(isPresent:) is called, Xcode displays runtime warning message, but I cannot understand what the means. A `navigationDestination(isPresented:content:)` is outside an explicit NavigationStack, but inside the detail column of a NavigationSplitView, so it attempts to target the next column. There is no next column after the detail column. Did you mean to put the navigationDestination inside a NavigationStack? I didn't use NavigationSplitView and navigationDestination(isPresent:) is inside NavigationStack. Could someone please point out the problem with this code? Or is it a SwiftUI bug? Test environment Xcode Version 14.1 beta 2 (14B5024i) iPhone SE (3rd gen) (iOS 16.1) Sample Code @main struct StackViewSampleApp: App { var body: some Scene { WindowGroup { Navi
Replies
3
Boosts
0
Views
2.1k
Activity
Dec ’22
CSV to SwiftUI
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?
Replies
3
Boosts
0
Views
1.7k
Activity
Dec ’22
Reply to CSV to SwiftUI
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:
Replies
Boosts
Views
Activity
Dec ’22
Reply to CSV to SwiftUI
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:
Replies
Boosts
Views
Activity
Dec ’22
UISplitViewController broken when in tab view controllers
I'm trying to rebasline my app to iOS 14. My app's main entry point for the UI is a tab view controller. Three of its four children are then split view controllers. I configured those to 'all visible'. On iPad, this shows both master/detail at all times and on iPhone, you get the collapsed behavior. Just like the Settings app. Anyhow, I've removed the deprecations and migrated the split view controllers to use the new properties: Style of Double Column, Display Mode of One Column Beside, and Behavior of Tile. On iPad, the split view controllers will always be collapsed as if they are running on a compact device. If I make a sample project with the same exact split view controller (along with its configuration as above), but make this SVC the main entry point of the app, all is well on both iPad and iPhone. Collapsed interface only happens on iPhone (compact). But when I change the sample project to have the SVC now a child of a tab view controller, it breaks (always collapsed on all devices)
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
3
Boosts
0
Views
3k
Activity
Dec ’22
Reply to SwiftUI: .fullscreenCover doesn't show .navigationTitle
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:
Replies
Boosts
Views
Activity
Dec ’22
Reply to Launch screen not rendering correctly on iPad
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:
Replies
Boosts
Views
Activity
Dec ’22