Post

Replies

Boosts

Views

Activity

Reply to Remove gap between lazyvgrids in vstack
Yes, between those two lazyVgrids. I ended up adding negative padding right after the closing } of the first lazyVgrid and it removed the gap. .padding(.bottom, - 7.5) As far as a screen shot I know how to cut out a section with shift + command + 4. When I select the paper clip below and add image I select the associated png file from my desktop but I do no see it appear in this box. I clearly do not understand how to do it. Below is the section of code that includes the two lazyVgrids and the added padding. Thank you for giving me the heads up on paste and match style. It sure looks a lot cleaner. Regards, Chris LazyVGrid( columns: columns, alignment: .center, spacing: 0) { ForEach(0..<1) {row in ForEach(0..<numElementsPerArray) {col in Rectangle() .foregroundColor(.white) .overlay (Text(principalData.csvData[row][col]).bold()) .frame(height: 30) .border(Color.gray, width: 2) } } }.padding(.bottom, -7.5) ScrollView{ LazyVGrid(
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’21
Reply to Swift + OS X + Xcode : Change NavigationLink destination and text programtically
I have looked at using observable objects and adjusted my code as shown below. Xcode does not like any line with the word ObservableObject in it. The attempt I am trying to make is to change the firstPass variable so that the navigation panel in ContentView redraws. I was going also link the observable object to the NextContentView view, toggle it there then hope that the ContentView navigation panel finally redraws and shows the updated button text and NavigationLink destination. My hope is that I have made some simple stupid error. Any help would be appreciated. Chris import SwiftUI import Combine class SelectedView: ObservedObject {     @Published var firstPass : Bool = true } struct ContentView: View {          @ObservedObject var theSelection = SelectedView()          var body: some View {         NavigationView {             if (self.theSelection.firstPass){                 NavigationLink(destination: NextContentView()){                     Text ("Next View")                 }             }             else {                 NavigationLink(destination: ContentView()) {                     Text ("Previous View")                         }                 }             }     } }
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’21
Reply to Remove gap between lazyvgrids in vstack
Yes, between those two lazyVgrids. I ended up adding negative padding right after the closing } of the first lazyVgrid and it removed the gap. .padding(.bottom, - 7.5) As far as a screen shot I know how to cut out a section with shift + command + 4. When I select the paper clip below and add image I select the associated png file from my desktop but I do no see it appear in this box. I clearly do not understand how to do it. Below is the section of code that includes the two lazyVgrids and the added padding. Thank you for giving me the heads up on paste and match style. It sure looks a lot cleaner. Regards, Chris LazyVGrid( columns: columns, alignment: .center, spacing: 0) { ForEach(0..<1) {row in ForEach(0..<numElementsPerArray) {col in Rectangle() .foregroundColor(.white) .overlay (Text(principalData.csvData[row][col]).bold()) .frame(height: 30) .border(Color.gray, width: 2) } } }.padding(.bottom, -7.5) ScrollView{ LazyVGrid(
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’21
Reply to Swift + OS X + Xcode : Change NavigationLink destination and text programtically
I have looked at using observable objects and adjusted my code as shown below. Xcode does not like any line with the word ObservableObject in it. The attempt I am trying to make is to change the firstPass variable so that the navigation panel in ContentView redraws. I was going also link the observable object to the NextContentView view, toggle it there then hope that the ContentView navigation panel finally redraws and shows the updated button text and NavigationLink destination. My hope is that I have made some simple stupid error. Any help would be appreciated. Chris import SwiftUI import Combine class SelectedView: ObservedObject {     @Published var firstPass : Bool = true } struct ContentView: View {          @ObservedObject var theSelection = SelectedView()          var body: some View {         NavigationView {             if (self.theSelection.firstPass){                 NavigationLink(destination: NextContentView()){                     Text ("Next View")                 }             }             else {                 NavigationLink(destination: ContentView()) {                     Text ("Previous View")                         }                 }             }     } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21
Reply to Swift + OS X + Xcode : Change NavigationLink destination and text programtically
Claude, I have attempted to add a line beneath navigation link as follows: self.firstPass.toggle() It does not work. Any ideas. Sorry I overlooked you last response. Chris
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Swift + OS X + Xcode : Change NavigationLink destination and text programtically
After some additional testing, it appears that when an @State variable changes the view is redrawn. So it would appear that all I need to do is toggle firstPass when the navigation button is selected. Unfortunately I have yet to find a way to do that. If anyone knows, please let me know. Chris
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Swift + OS X + Xcode : Change NavigationLink destination and text programtically
Thank you for the response but the code appears to only take me to the second view. The button text does not change and it does not take me back to the first view. Does the var firstPass have to be changed to false once the NextContentView() is displayed? Chris
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to OS X + Swift + Xcode : Programmatically transition from one view controller to another
if let primaryController = self.storyboard?.instantiateController(withIdentifier: "ViewController") as? NSViewController {             self.view.window?.contentViewController = primaryController         } This code appears to work. Thank you for the input. Chris
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21