Search results for

“column”

2,085 results found

Post

Replies

Boosts

Views

Activity

Reply to Plist max size
john daniel wrote:I think most people take up more space than that for icons on buttons.Right. But this will be considerably bigger if you put it in an XML plist.@DenisO, For a rectangular array like this I’d probably put the data into a file in binary form and then memory map that. You can then access the values at random and the VM subsystem will take care of the rest.Furthermore, I’d wrap this in a nice, Swift-friendly data structure. Something like this:class DataMap { let rowCount = 16 let columnCount = 16 init?(file: URL) { guard let d = try? NSData(contentsOf: file, options: [.alwaysMapped]) else { return nil } guard d.length == (self.rowCount * self.columnCount * MemoryLayout<Double>.size) else { return nil } self.data = d let base = d.bytes.assumingMemoryBound(to: Double.self) self.buffer = UnsafeBufferPointer(start: base, count: d.length) } private let data: NSData private let buffer: UnsafeBufferPointer<Double> subscript (row: Int, column: Int) -> Double { precondition((0..&
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’17
Reply to SwiftUI TableColumn with Custom Widget not able to Bind
Using a TableColumn requires a Table {// content } rows: { // data source } pattern similar to below. Where in the example rowItems is a collection of Items for the data source. Items struct Item { let from: Date let to: Date let hours: Double } // The table view Table(selection: $selection, sortOrder: $sortOrder) { // Sort column on .from key value path of item TableColumn(From, value:.from) { item in Text(item.from(date: .numeric, time: .omitted)) } // Sort column on .to key value path of item TableColumn(To, value:.to) { item in Text(item.to.formatted(date: .numeric, time: .omitted)) } // Sort column on .hours key value path of item TableColumn(Total, value:.hours) { item in Text(item.hours) } } rows: { // Populate the rows data source with TableRow types containing an item type from the rowItems collection which is passed on each TableColumm. ForEach(rowItems) { item in TableRow(item) } } See Apple example code here: https://developer.apple.com/documentation/swiftui/building_a_g
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’22
Reply to NSTextView multiple columns
The general approach is outlined in the Cocoa Text Architecture Guide: Text System Organization – Common Configurations. Look for figure 3-5. You create the components of the text system separately, rather than just creating a text view and having it create the other components for you. You use a single text storage object, a single layout manager, and multiple text containers and text views. Each page-column is associated with a pair of text container and text view. You implement a delegate for the layout manager and implement -layoutManager:didCompleteLayoutForTextContainer:atEnd: to add additional columns and pages, along with their associated text containers and text views, as necessary to accommodate the text.
Topic: UI Frameworks SubTopic: AppKit Tags:
Jun ’15
Reply to Remove gap between lazyvgrids in vstack
It's better to Paste as Paste and Match Style to avoid all the extra lines: 1. import SwiftUI 2. struct SecondView: View { 3. 4. var columns = [ 5. GridItem(.fixed(100), spacing: 0.1), 6. GridItem(.fixed(100), spacing: 0.1), 7. GridItem(.fixed(100), spacing: 0.1), 8. GridItem(.fixed(100), spacing: 0.1), 9. GridItem(.fixed(100), spacing: 0.1) 10. ] 11. let principalData: convertCSVtoArray 12. 13. var body: some View { 14. let numArrays = principalData.cvsData.count 15. let numElementsPerArray = principalData.cvsData[0].count 16. 17. VStack{ 18. Text() 19. Text(Historical Data) 20. .font(.title) 21. .padding(5) 22. Divider() 23. LazyVGrid( 24. columns: columns, 25. alignment: .center, 26. spacing: 0) 27. { 28. ForEach(0..<1) {row in 29. ForEach(0.. Could you post a screenshot to illustrate the problem ?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’21
Reply to Illegal NSTableViewDataSource
Hello Claude:func showRegisteredStudents() { guard (NSApplication.shared.delegate as? AppDelegate) != nil else { return } let managedContext = (NSApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext let fetchRequest = NSFetchRequest(entityName: Registration) fetchRequest.returnsObjectsAsFaults = false fetchRequest.sortDescriptors = [NSSortDescriptor(key: lastName, ascending: true)] do { let readItems = try managedContext.fetch(fetchRequest) as! [NSManagedObject] print (There are (readItems.count) items) _ = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.persistentContainer.viewContext, sectionNameKeyPath: nil, cacheName: nil) // Configure Fetched Results Controller print(Records are (readItems)) items = readItems print(There are (items.count) items)// NOW items is filled self.tableView.reloadData() return() fatalError(Failed to fetch employees: (error)) } } } extension RegistrationReportsViewController: NSTableViewDataSource,NSTableViewDelegate{ // Da
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’20
Reply to How can I change the background color of a focused item of a NSTableView?
Here is a more simplified example of the app: import SwiftUI struct NSTableViewWrapper: NSViewRepresentable { class Coordinator: NSObject, NSTableViewDataSource, NSTableViewDelegate { var parent: NSTableViewWrapper init(parent: NSTableViewWrapper) { self.parent = parent } func numberOfRows(in tableView: NSTableView) -> Int { 1 } func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { return NSTextField(labelWithString: Item) } func tableView(_ tableView: NSTableView, rowActionsForRow row: Int, edge: NSTableView.RowActionEdge) -> [NSTableViewRowAction] { return [NSTableViewRowAction(style: .destructive, title: Delete) { _, _ in }] } } func makeCoordinator() -> Coordinator { return Coordinator(parent: self) } func makeNSView(context: Context) -> NSScrollView { let scrollView = NSScrollView() let tableView = NSTableView() let column = NSTableColumn(identifier: NSUserInterfaceItemIdentifier(Column)) tableView.addTableColumn(column
Topic: UI Frameworks SubTopic: AppKit Tags:
Mar ’25
Reply to Plist max size
john daniel wrote:I think most people take up more space than that for icons on buttons.Right. But this will be considerably bigger if you put it in an XML plist.@DenisO, For a rectangular array like this I’d probably put the data into a file in binary form and then memory map that. You can then access the values at random and the VM subsystem will take care of the rest.Furthermore, I’d wrap this in a nice, Swift-friendly data structure. Something like this:class DataMap { let rowCount = 16 let columnCount = 16 init?(file: URL) { guard let d = try? NSData(contentsOf: file, options: [.alwaysMapped]) else { return nil } guard d.length == (self.rowCount * self.columnCount * MemoryLayout<Double>.size) else { return nil } self.data = d let base = d.bytes.assumingMemoryBound(to: Double.self) self.buffer = UnsafeBufferPointer(start: base, count: d.length) } private let data: NSData private let buffer: UnsafeBufferPointer<Double> subscript (row: Int, column: Int) -> Double { precondition((0..&
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Feb ’17
Reply to "Ratings and Reviews" is grayed out.
Looks like they just changed things around. Click iOS App (or Mac, TV etc. OS) underneath that Ratings and Reviews header in the left column, and I think you'll get the info you're looking for.
Replies
Boosts
Views
Activity
Sep ’17
Reply to SwiftUI TableColumn with Custom Widget not able to Bind
Using a TableColumn requires a Table {// content } rows: { // data source } pattern similar to below. Where in the example rowItems is a collection of Items for the data source. Items struct Item { let from: Date let to: Date let hours: Double } // The table view Table(selection: $selection, sortOrder: $sortOrder) { // Sort column on .from key value path of item TableColumn(From, value:.from) { item in Text(item.from(date: .numeric, time: .omitted)) } // Sort column on .to key value path of item TableColumn(To, value:.to) { item in Text(item.to.formatted(date: .numeric, time: .omitted)) } // Sort column on .hours key value path of item TableColumn(Total, value:.hours) { item in Text(item.hours) } } rows: { // Populate the rows data source with TableRow types containing an item type from the rowItems collection which is passed on each TableColumm. ForEach(rowItems) { item in TableRow(item) } } See Apple example code here: https://developer.apple.com/documentation/swiftui/building_a_g
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to No way to accept Updated Program License Agreement
Having the same issue here. Still not solved for me. As sole user (Admin, Account Holder Role) I get no View and Agree to Terms button in Action column or any other possibility to agree.
Replies
Boosts
Views
Activity
Jun ’20
Reply to NSTextView multiple columns
The general approach is outlined in the Cocoa Text Architecture Guide: Text System Organization – Common Configurations. Look for figure 3-5. You create the components of the text system separately, rather than just creating a text view and having it create the other components for you. You use a single text storage object, a single layout manager, and multiple text containers and text views. Each page-column is associated with a pair of text container and text view. You implement a delegate for the layout manager and implement -layoutManager:didCompleteLayoutForTextContainer:atEnd: to add additional columns and pages, along with their associated text containers and text views, as necessary to accommodate the text.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jun ’15
Reply to Finder Custom Columns For Extended Attributes
Hi Anish,No, there's definitely no way you can add custom columns in Finder, sorry - using xattr to set the Tag or Comment metadata is your best (albeit not ideal) option.
Replies
Boosts
Views
Activity
Jul ’15
Reply to Is there a way in Xcode to jump directly to edits that you made in a file, instead of having to scroll through to find them?
It sounds like you should be using View Show Code Review. In the right column, choose the version you want to compare against. At the bottom of the screen, and will step through the edits. View Hide Code Review, to exit.
Replies
Boosts
Views
Activity
Mar ’21
Reply to Create ML Training Error - Activity Classifier
This might be a bug that you have to make your column data in format float or double. If your data is in a different type, it will be filtered out. So try to convert the data type to float or double if not. Also this issue should be fixed now.
Topic: Machine Learning & AI SubTopic: Core ML Tags:
Replies
Boosts
Views
Activity
Jun ’20
Reply to Sample code for tabulardata functions
Here is an example that computes the mean of the speed and weight columns using this method: let means = dataFrame.grouped(by: species).aggregated( on: speed, weight, naming: { mean(($0)) }, transform: { (slice: DiscontiguousColumnSlice) -> Double? in slice.mean() } )
Topic: Machine Learning & AI SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to Xcode and Mac OS versions compatibility
The Xcode Support page - https://developer.apple.com/support/xcode includes a table with several recent Xcode versions and details about what that version supports. Please see the Minimum OS Required column to answer your question.
Replies
Boosts
Views
Activity
Nov ’20
Reply to unexplicable low memory crash (jetsam/per-process-limit)
So the issue with vmtracker is that it polls the system. Due to this, it can miss spikes. I bet what is happening is that something is mapping a large amount of memory into your process. Perhaps the kernel. Also the memory could be compressed out of your process so it doesn't appear in the dirty column.
Replies
Boosts
Views
Activity
Jan ’17
Reply to Remove gap between lazyvgrids in vstack
It's better to Paste as Paste and Match Style to avoid all the extra lines: 1. import SwiftUI 2. struct SecondView: View { 3. 4. var columns = [ 5. GridItem(.fixed(100), spacing: 0.1), 6. GridItem(.fixed(100), spacing: 0.1), 7. GridItem(.fixed(100), spacing: 0.1), 8. GridItem(.fixed(100), spacing: 0.1), 9. GridItem(.fixed(100), spacing: 0.1) 10. ] 11. let principalData: convertCSVtoArray 12. 13. var body: some View { 14. let numArrays = principalData.cvsData.count 15. let numElementsPerArray = principalData.cvsData[0].count 16. 17. VStack{ 18. Text() 19. Text(Historical Data) 20. .font(.title) 21. .padding(5) 22. Divider() 23. LazyVGrid( 24. columns: columns, 25. alignment: .center, 26. spacing: 0) 27. { 28. ForEach(0..<1) {row in 29. ForEach(0.. Could you post a screenshot to illustrate the problem ?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’21
Reply to Illegal NSTableViewDataSource
Hello Claude:func showRegisteredStudents() { guard (NSApplication.shared.delegate as? AppDelegate) != nil else { return } let managedContext = (NSApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext let fetchRequest = NSFetchRequest(entityName: Registration) fetchRequest.returnsObjectsAsFaults = false fetchRequest.sortDescriptors = [NSSortDescriptor(key: lastName, ascending: true)] do { let readItems = try managedContext.fetch(fetchRequest) as! [NSManagedObject] print (There are (readItems.count) items) _ = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.persistentContainer.viewContext, sectionNameKeyPath: nil, cacheName: nil) // Configure Fetched Results Controller print(Records are (readItems)) items = readItems print(There are (items.count) items)// NOW items is filled self.tableView.reloadData() return() fatalError(Failed to fetch employees: (error)) } } } extension RegistrationReportsViewController: NSTableViewDataSource,NSTableViewDelegate{ // Da
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jan ’20
Reply to how to add bluetooth permission
Hello , You have to go into your project. Click on your Bluetooth_test app and click “About”. In the Customs IOS Target table, click Plus and look for Privacy - Bluetooth Always Usage Description. In the Value column, enter your reason for wanting this permission.
Replies
Boosts
Views
Activity
Apr ’24
Reply to How can I change the background color of a focused item of a NSTableView?
Here is a more simplified example of the app: import SwiftUI struct NSTableViewWrapper: NSViewRepresentable { class Coordinator: NSObject, NSTableViewDataSource, NSTableViewDelegate { var parent: NSTableViewWrapper init(parent: NSTableViewWrapper) { self.parent = parent } func numberOfRows(in tableView: NSTableView) -> Int { 1 } func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { return NSTextField(labelWithString: Item) } func tableView(_ tableView: NSTableView, rowActionsForRow row: Int, edge: NSTableView.RowActionEdge) -> [NSTableViewRowAction] { return [NSTableViewRowAction(style: .destructive, title: Delete) { _, _ in }] } } func makeCoordinator() -> Coordinator { return Coordinator(parent: self) } func makeNSView(context: Context) -> NSScrollView { let scrollView = NSScrollView() let tableView = NSTableView() let column = NSTableColumn(identifier: NSUserInterfaceItemIdentifier(Column)) tableView.addTableColumn(column
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Mar ’25