Search results for

column

2,052 results found

Post

Replies

Boosts

Views

Activity

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
960
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
562
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
933
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
Sudo Command Unusable
I change my /private/etc permissions to eveybody can read and write, and applied this permission to all sub-folders and files. (something ****** to do)After that, when I use sudo command something went wrong:sudo: unable to stat /etc/sudoers: Permission deniedsudo: no valid sudoers sources found, quittingsudo: unable to initialize policy pluginAlso, I make a change to my sudoer file when trying to solve the problem.Here is its content:----------------------------------------------------------------------------------------------------------------------------------------# # Sample /etc/sudoers file. # # This file MUST be edited with the 'visudo' command as root. # # See the sudoers man page for the details on how to write a sudoers file. ## # Override built-in defaults ## Defaults env_reset Defaults env_keep += BLOCKSIZE Defaults env_keep += COLORFGBG COLORTERM Defaults env_keep += __CF_USER_TEXT_ENCODING Defaults env_keep += CHARSET LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE Defaults env_keep += LC_MESSAGES LC_M
1
0
1.2k
May ’23
Swift - access attribute in array of core data entities in a table column via a variable
The below code works. I pass in an array of core data entities and display attributes in a table. In the second table column I use a switch case statement to handle the 3 possible attributes I want to display. I could eliminate the switch case if I could figure out how to access a given core data attribute via a variable that contains the specific attribute name but have been unable to determine how to do so. Two attempts are commented out in the code. struct DataTable: View { private var closingValues: Array var heading: String var attribute: String init(closingValues: [TradingDayPrices], heading: String, attribute: String) { self.closingValues = closingValues self.heading = heading self.attribute = attribute } var body: some View { Text(heading) .foregroundColor(.black) .font(Font.custom(Arial, size: 18)) .bold() .padding(.top, 10) Table(self.closingValues) { TableColumn(Date) { value in HStack { Spacer() Text(dateToStringFormatter.string(from: value.timeStamp!)) Spacer() } } .width(100) TableColum
1
0
863
Apr ’23
NavigationSplitView 2-column loses state when minimized on iPad
Hello! I've noticed that when I am using NavigationSplitView and I minimize the app on iPadOS and then resume, if I am using a 2 column setup it loses state upon resume. This does not appear to happen on with a 3 column setup though. I'm wondering if others have run into this and if anyone has figured out a way around it. It seems like it's a bug and I should file a bug for it, but wanted to check with more people first. Here's some example code, run it, select your number of columns, then minimize the app, count to 3 (because why not!) and open the app and you'll notice that $selection is now nil. import SwiftUI struct Item: Identifiable, Hashable { var id: Int var name: String var description: String } struct ContentView: View { @State var selection: Item? var items: [Item] = [ .init(id: 1, name: One, description: Is the loneliest number), .init(id: 2, name: Two, description: Two can be as bad as one), .init(id: 3, name: Three, description: Three Dog Night) ] var body: some View {
1
0
733
Apr ’23
Reveal in Finder fails: anything inside home folder only reveals home
When i do reveal in finder from literally any app, including spotlight searches FROM the finder, if the item i'm revealing is in a sub-folder of my Home folder, it ONLY reveals my Home folder. for example, i have a structure like this: (home)/Documents/Filing Cabinet/Manuals/PowerSwitch/PowerSwitch.pdf Say i forgot where i put that, so i do a spotlight search for powerswitch, and spotlight helpfully locates everything with that name, so i scroll to the bottom (why is it at the bottom?) and pick search in finder, which shows a nice window with all the search results. I see a folder called PowerSwitch so i: a) double click it, or: b) right click and pick show in enclosing folder Either way, a new window comes up showing ONLY the Home folder. Note this ONLY happens when i have column view as the default. If i have list view as the default, it DOES work, showing a window containing the actual folder or file i'm interested in, but if i then switch said window to column view (which is what i alway
2
0
958
Apr ’23