Search results for

“column”

2,085 results found

Post

Replies

Boosts

Views

Activity

Create a grid table with fixed number of rows and columns of variable widths
I've tried a few approaches to create a standard table - with a fixed number of columns and rows, but with variable column widths - for all device classes. The contraint system, even using Stack Views, created an impossible number of layout errors, and so it was suggested to use UICollectionViews, which appears better, but I cannot solve the following issues.Firstly, the cells in the last row of the table do not align perfectly with the cells above. Each cell is fractionally less width, making the final cell quite clearly unaligned. This issue, while minor in the example project, can appear larger depending on cell contents or device sizes.Secondly, while I can manage device orientation changes on most devices tested in the simulator, this not true for iPad Air devices. While the table layout is correct when I first run the project on iPad Air in any orientation, and is correct when re-orientated from landscape to horizontal; the layout breaks if I run the project on a iPad Air in portrait o
Topic: UI Frameworks SubTopic: UIKit Tags:
6
0
4.8k
Aug ’19
Reply to Symbolic links to root in Monterey
My symbolic links still work in Monterey. eg cat /etc/synthetic.conf srv System/Volumes/Data/srv Remember to use tabs. man synthetic.conf synthetic.conf specifies a single synthetic entity per line. Each line may have one or two columns, separated by a tab character. If a line has a single column, it denotes a virtual empty directory to be created at /. If a line has two columns, it denotes a symbolic link at / whose link target is given in the second column. Big Sur thread: https://developer.apple.com/forums/thread/670391
Topic: App & System Services SubTopic: Core OS Tags:
Mar ’22
Reply to Constraints between a UITableView and a UITableViewCell
I would recommend trying to use the same relationships to position your column headers and the views in the cells. Have a view that is the same width as the tableview. The column headers would be subviews of that view. The positions of the column header views would be relative to the container view. Set up the cells to use the same relationships relative to the cell content view.
Topic: UI Frameworks SubTopic: UIKit Tags:
Nov ’15
Reply to Read CSV file, parse into arrays, Swift 4, Xcode 9 broken, Xcode 8.3 OK
As with most things in programming, it pays to break down your problem into parts:Reading a fileBreaking it into linesBreaking the lines in columnsConverting a string to the appropriate data valueI’ll cover each in turn.If you’re just getting started, a good place to start is a command line tool. This avoids the need for dealing with file selection dialogs, the App Sandbox, and so on. Here’s a tiny shell command line tool that’ll get you going:import Foundation func process(string: String) throws { … your code here … } func processFile(at url: URL) throws { let s = try String(contentsOf: url) try process(string: s) } func main() { guard CommandLine.arguments.count > 1 else { print(usage: (CommandLine.arguments[0]) file...) return } for path in CommandLine.arguments[1...] { do { let u = URL(fileURLWithPath: path) try processFile(at: u) } catch { print(error processing: (path): (error)) } } } main() exit(EXIT_SUCCESS)Note I’ve made some shortcuts here (like assuming the file is UTF-8 and printing errors to s
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’17
Reply to Checkbox in NSTableView
If I drag a table view to the controller it defaults to two columns. I then grab a check cell and drag it to the second column and IB adds a little Table Column text. I let go, and the same thing as above happens.As to dragging into the hierarchy directly, xcode will ONLY let me drop it in place of the very last cell. The one that's light blue and says Text Cell.
Topic: UI Frameworks SubTopic: AppKit Tags:
Mar ’16
Change Navigation Stack columns dimensions
Hi. I'm writing the following code for a navigation with images and I have an issue: the images don't fit with the automatic rectangle that is created by the NavigationStack view. Here is the code and I'm attaching an image too for you to understand : import SwiftUI struct LycéesListe: View { var body: some View { NavigationStack { List(lycées) { lycée in NavigationLink { LycéeDétail(lycée: lycée) } label: { LycéesRow(lycée: lycée) } } .navigationTitle(Lycées) } } struct LycéesListe_Previews: PreviewProvider { static var previews: some View { ForEach([iPhone 13, iPhone 12], id: .self) { deviceName in LycéesListe() .previewDevice(PreviewDevice(rawValue: deviceName)) .previewDisplayName(deviceName) } } } } Anyone knows how I could make the images fit with the rectangle border so I just have images with clean rectangles and not these green lines ? I tried to do padding but it didn't help. Any answer appreciated.
0
0
739
May ’23
Reply to How to get the output of a for-in loop into a single DataFrame instead of many Dataframes
Hello @AnimalOnDrums, While you could use a for loop to append elements to your Column instances one by one, you might prefer to leverage the fact that Album's tracks are returned as a MusicItemCollection, which like most collections has the map(_:) method. let albumTracks = album.tracks ?? [] var dataFrame = DataFrame() let trackNumberColumn = Column(name: track, contents: albumTracks.map(.trackNumber)) dataFrame.append(column: trackNumberColumn) let titleColumn = Column(name: title, contents: albumTracks.map(.title)) dataFrame.append(column: titleColumn) let artistColumn = Column(name: artist, contents: albumTracks.map(.artistName)) dataFrame.append(column: artistColumn) let releaseDateColumn = Column(name: release date, contents: albumTracks.map { track in return track.releaseDate?.formatted(date: .long, time: .omitted) }) dataFrame.append(column: releaseDateColumn) let durationColumn = Column(name: duration, contents
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to Make method less repetative
Again, I may be reading your code incorrect but something like:private func generateLoserLocationFunction(numberOfPlayers: Int) -> (column: Int, row: Int) -> (column: Int, row: Int) {return { row, column inlet newCol = -2 * columnswitch numberOfPlayers {case 8:switch column {case 0:return (newCol, row / 2)case 1:return (newCol, row ^ 1)}case 16:switch column {case 0:return (newCol, row / 2)case 1:return (newCol, 3 - row)case 2:return (newCol, row ^ 1)}case 32:switch column {case 0:return (newCol, row / 2)case 1:return (newCol, (row + 4) % 8)case 2:return (newCol, row)case 3:return (newCol, row ^ 1)}default:return (newCol,0)}}It's not a big change, 35 lines instead of 50 but if I'm reading it right, it should do the same thing your existing versiondoes.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’15
Reply to process name in custom instrument
Thank you so much! Knew there was some secret incantation somewhere 🙂 <ktrace-interval-schema> <id>com-google-dyld-launch-executable-schema</id> <title>dyld launch executable</title> <start-pattern> <class>31</class> <subclass>7</subclass> <code>1</code> <function>1</function> <thread>?thread</thread> </start-pattern> <end-pattern> <class>31</class> <subclass>7</subclass> <code>1</code> <function>2</function> </end-pattern> <start-column> <mnemonic>start</mnemonic> <title>Start</title> <type>start-time</type> </start-column> <duration-column> <mnemonic>duration</mnemonic> <title>Duration</title> <type>duration</type> </duration-column> <column> <mnemonic>process</mnemonic> <title>Process
Jan ’19
Reply to NSBrowser....conditionally suppress right-click menu
Yeah, the getter for menu gets called from the addColumn method. It seems that everytime NSBrowser adds a column, it sets the menu for that column (whatever view it uses for the column) to be its menu. The main view used to create each column, far as I can tell is private API.What I'm going to try is:1) Setting the menu directly for each cell.2), Setting a different menu for the browser.3) Take hack-ish measures to validate the browser's menu to block it from being shown by hiding all the menu items when necessary.If there is a more elegant way to this, I'd love to know.
Topic: UI Frameworks SubTopic: AppKit Tags:
Jul ’15
Reply to Using Web https to install app, the app is in waiting... state on the device
If you plug the device in to your Mac and view the console output in Xcode while installing the app from your web server, what errors do you see? (In Xcode, Window > Devices, choose device on left column, look at the bottom part of the right column. You may need to click the upward pointing triangle in the bottom left corner of the right hand column to show the console output.)
Feb ’16
Create a grid table with fixed number of rows and columns of variable widths
I've tried a few approaches to create a standard table - with a fixed number of columns and rows, but with variable column widths - for all device classes. The contraint system, even using Stack Views, created an impossible number of layout errors, and so it was suggested to use UICollectionViews, which appears better, but I cannot solve the following issues.Firstly, the cells in the last row of the table do not align perfectly with the cells above. Each cell is fractionally less width, making the final cell quite clearly unaligned. This issue, while minor in the example project, can appear larger depending on cell contents or device sizes.Secondly, while I can manage device orientation changes on most devices tested in the simulator, this not true for iPad Air devices. While the table layout is correct when I first run the project on iPad Air in any orientation, and is correct when re-orientated from landscape to horizontal; the layout breaks if I run the project on a iPad Air in portrait o
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
6
Boosts
0
Views
4.8k
Activity
Aug ’19
Reply to UISplitViewController column resize event (Mac Catalyst)?
So it doesn't appear to be possible to determine when a UISplitViewController is in a column resizing event. Would be great to be able to determine this to be able to optimize the number of layout passes until after the column resize event finishes... FB11775512
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Feb ’23
Reply to How to animate NavigationSplitView's detailView column.
This isn't supported today for detail columns or content columns. You can however get an animated trailing sidebar with the .inspector modifier. There is a WWDC Session available too.
Topic: Design SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to Symbolic links to root in Monterey
My symbolic links still work in Monterey. eg cat /etc/synthetic.conf srv System/Volumes/Data/srv Remember to use tabs. man synthetic.conf synthetic.conf specifies a single synthetic entity per line. Each line may have one or two columns, separated by a tab character. If a line has a single column, it denotes a virtual empty directory to be created at /. If a line has two columns, it denotes a symbolic link at / whose link target is given in the second column. Big Sur thread: https://developer.apple.com/forums/thread/670391
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to LazyVGrid and ScrollViewReader
It works for me. I use the id modifier to set ids of LazyVGrid children. Here is my code: ScrollView { ScrollViewReader { scroller in LazyVGrid(columns: columns) { ForEach((0..
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Constraints between a UITableView and a UITableViewCell
I would recommend trying to use the same relationships to position your column headers and the views in the cells. Have a view that is the same width as the tableview. The column headers would be subviews of that view. The positions of the column header views would be relative to the container view. Set up the cells to use the same relationships relative to the cell content view.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Nov ’15
Reply to Read CSV file, parse into arrays, Swift 4, Xcode 9 broken, Xcode 8.3 OK
As with most things in programming, it pays to break down your problem into parts:Reading a fileBreaking it into linesBreaking the lines in columnsConverting a string to the appropriate data valueI’ll cover each in turn.If you’re just getting started, a good place to start is a command line tool. This avoids the need for dealing with file selection dialogs, the App Sandbox, and so on. Here’s a tiny shell command line tool that’ll get you going:import Foundation func process(string: String) throws { … your code here … } func processFile(at url: URL) throws { let s = try String(contentsOf: url) try process(string: s) } func main() { guard CommandLine.arguments.count > 1 else { print(usage: (CommandLine.arguments[0]) file...) return } for path in CommandLine.arguments[1...] { do { let u = URL(fileURLWithPath: path) try processFile(at: u) } catch { print(error processing: (path): (error)) } } } main() exit(EXIT_SUCCESS)Note I’ve made some shortcuts here (like assuming the file is UTF-8 and printing errors to s
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Oct ’17
Reply to NavigationStack and NavigationSplitView Runtime warnings
For three column layouts, try setting the selected state of the middle column to nil onDisappear as done in ThreeColumnContentView within https://developer.apple.com/documentation/swiftui/bringing_robust_navigation_structure_to_your_swiftui_app
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’22
Reply to Checkbox in NSTableView
If I drag a table view to the controller it defaults to two columns. I then grab a check cell and drag it to the second column and IB adds a little Table Column text. I let go, and the same thing as above happens.As to dragging into the hierarchy directly, xcode will ONLY let me drop it in place of the very last cell. The one that's light blue and says Text Cell.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Mar ’16
Change Navigation Stack columns dimensions
Hi. I'm writing the following code for a navigation with images and I have an issue: the images don't fit with the automatic rectangle that is created by the NavigationStack view. Here is the code and I'm attaching an image too for you to understand : import SwiftUI struct LycéesListe: View { var body: some View { NavigationStack { List(lycées) { lycée in NavigationLink { LycéeDétail(lycée: lycée) } label: { LycéesRow(lycée: lycée) } } .navigationTitle(Lycées) } } struct LycéesListe_Previews: PreviewProvider { static var previews: some View { ForEach([iPhone 13, iPhone 12], id: .self) { deviceName in LycéesListe() .previewDevice(PreviewDevice(rawValue: deviceName)) .previewDisplayName(deviceName) } } } } Anyone knows how I could make the images fit with the rectangle border so I just have images with clean rectangles and not these green lines ? I tried to do padding but it didn't help. Any answer appreciated.
Replies
0
Boosts
0
Views
739
Activity
May ’23
Reply to How to get the output of a for-in loop into a single DataFrame instead of many Dataframes
Hello @AnimalOnDrums, While you could use a for loop to append elements to your Column instances one by one, you might prefer to leverage the fact that Album's tracks are returned as a MusicItemCollection, which like most collections has the map(_:) method. let albumTracks = album.tracks ?? [] var dataFrame = DataFrame() let trackNumberColumn = Column(name: track, contents: albumTracks.map(.trackNumber)) dataFrame.append(column: trackNumberColumn) let titleColumn = Column(name: title, contents: albumTracks.map(.title)) dataFrame.append(column: titleColumn) let artistColumn = Column(name: artist, contents: albumTracks.map(.artistName)) dataFrame.append(column: artistColumn) let releaseDateColumn = Column(name: release date, contents: albumTracks.map { track in return track.releaseDate?.formatted(date: .long, time: .omitted) }) dataFrame.append(column: releaseDateColumn) let durationColumn = Column(name: duration, contents
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Make method less repetative
Again, I may be reading your code incorrect but something like:private func generateLoserLocationFunction(numberOfPlayers: Int) -> (column: Int, row: Int) -> (column: Int, row: Int) {return { row, column inlet newCol = -2 * columnswitch numberOfPlayers {case 8:switch column {case 0:return (newCol, row / 2)case 1:return (newCol, row ^ 1)}case 16:switch column {case 0:return (newCol, row / 2)case 1:return (newCol, 3 - row)case 2:return (newCol, row ^ 1)}case 32:switch column {case 0:return (newCol, row / 2)case 1:return (newCol, (row + 4) % 8)case 2:return (newCol, row)case 3:return (newCol, row ^ 1)}default:return (newCol,0)}}It's not a big change, 35 lines instead of 50 but if I'm reading it right, it should do the same thing your existing versiondoes.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’15
Reply to process name in custom instrument
Thank you so much! Knew there was some secret incantation somewhere 🙂 <ktrace-interval-schema> <id>com-google-dyld-launch-executable-schema</id> <title>dyld launch executable</title> <start-pattern> <class>31</class> <subclass>7</subclass> <code>1</code> <function>1</function> <thread>?thread</thread> </start-pattern> <end-pattern> <class>31</class> <subclass>7</subclass> <code>1</code> <function>2</function> </end-pattern> <start-column> <mnemonic>start</mnemonic> <title>Start</title> <type>start-time</type> </start-column> <duration-column> <mnemonic>duration</mnemonic> <title>Duration</title> <type>duration</type> </duration-column> <column> <mnemonic>process</mnemonic> <title>Process
Replies
Boosts
Views
Activity
Jan ’19
Reply to NSBrowser....conditionally suppress right-click menu
Yeah, the getter for menu gets called from the addColumn method. It seems that everytime NSBrowser adds a column, it sets the menu for that column (whatever view it uses for the column) to be its menu. The main view used to create each column, far as I can tell is private API.What I'm going to try is:1) Setting the menu directly for each cell.2), Setting a different menu for the browser.3) Take hack-ish measures to validate the browser's menu to block it from being shown by hiding all the menu items when necessary.If there is a more elegant way to this, I'd love to know.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jul ’15
Reply to Using Web https to install app, the app is in waiting... state on the device
If you plug the device in to your Mac and view the console output in Xcode while installing the app from your web server, what errors do you see? (In Xcode, Window > Devices, choose device on left column, look at the bottom part of the right column. You may need to click the upward pointing triangle in the bottom left corner of the right hand column to show the console output.)
Replies
Boosts
Views
Activity
Feb ’16