Search results for

“column”

2,085 results found

Post

Replies

Boosts

Views

Activity

Reply to NSBrowser - edit cell contents
Well, it would really be easier to read the code than reading paraphrase of it.I can't really provide any code, but what I have is a NSBrowser hooked into CoreData, with the ability to add and remove entities in the hiearchy.Did you kook in code ? If so, please showI've tried hooking a double click event up to an IBAction (though a single click is what I'm ultimately after), from here I can get a reference to the browser.You mean the NSBrowser ?But to get a refernce, it would be easier to declare an IBOutlet. Why not ?Then I was attempting to get the selected item in the appropriate column, Please show codebut on the first column I was getting an empty array back when printing the indexPath. I must be doing something wrong there. Please show code, with the print statementI removed the non working code so I can't post here.Why did you need to remove to post here ?Conclusion: if you still want some help, please help others to help by showing the code.Unless you have already solved the problem.
Topic: UI Frameworks SubTopic: AppKit Tags:
Jan ’20
Reply to Random "duplicate column name" crashes using SwiftData
I had the exact same problem. On the first startup everything is ok, then on the second one it crashes. It seems SwiftData doesn't see the already existing column for one-to-many relationship. This, in turn, crashes the application because of the duplicated column. The solution that I found is to explicitly create the inverse relationship in the second model. So, in your case, changing your DeskPosition model to this: @Model final class DeskPosition { let id: UUID var title: String var desk: Desk? private var heightInCm: Double @Transient var height: DeskHeight { get { DeskHeight(value: heightInCm, unit: .centimeters).localized } set { heightInCm = newValue.converted(to: .centimeters).value } } init(id: UUID, height: DeskHeight, title: String) { self.id = id self.heightInCm = height.converted(to: .centimeters).value self.title = title self.height = height } }
Oct ’23
Reply to Customizing Back Button in Column 2 "Content" in SplitView
You can remove the toggle to show and hide the column with .toolbar(removing: .sidebarToggle) - https://developer.apple.com/documentation/swiftui/view/toolbar(removing:) For the back button, if you're navigating to a detail view, you can use .navigationBarBackButtonHidden() - https://developer.apple.com/documentation/swiftui/view/navigationbarbackbuttonhidden(_:) - on the detail view to hide the back button
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’23
Reply to Back supported Navigation-View
NavigationView has only been soft deprecated, so will still function on iOS 16. As for manually back deploying, since NavigationView has been split into two parts but come with added components, such as a path and control over column visibility as well as the new NavigationLink(_:value:) and navigationDestination modifier, it would be quite difficult to accomodate all of this.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’22
Reply to Illegal NSTableViewDataSource
I submitted the full code:The crash is on line 62import Cocoa import CoreData class RegistrationReportsViewController: NSViewController { required init?(coder aDecoder: NSCoder) { self.items = [] super.init(coder: aDecoder) } override func viewDidLoad() { super.viewDidLoad() showRegisteredStudents() tableView.dataSource = self tableView.delegate = self tableView.reloadData() } private lazy var fetchedResultsController: NSFetchedResultsController = { let fetchRequest: NSFetchRequest = Registration.fetchRequest() let frc = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.persistentContainer.viewContext, sectionNameKeyPath: nil, cacheName: nil) frc.delegate = (self as! NSFetchedResultsControllerDelegate) return frc }() var items: [NSManagedObject] var managedObjectContext = (NSApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext let persistentContainer: NSPersistentContainer = { let container = NSPersistentContainer(name: ScorcentMasterReview) container.lo
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’20
Reply to Core Data code generation causes build failure
If you go to your data model and look at Configurations -> Default you will probably see that in the Class column everything is prefixed with a .. To fix this, go to each of your entities and on the right delete everything inside the module setting so that it goes to Global namespace. This should remove the . and will hopefully mean that your files are now found. If you clean and build again it should all work.
Oct ’16
Reply to swipeActions on macOS?
Even with two columns and a Label. It does not work for me. I am using Xcode 14 and Monterey var body: some View { VStack { List(podcast.episodes!) { episode in EpisodeView(podcast: podcast, episode: episode) .swipeActions(edge: .trailing) { Button (action: { self.deleteEpisode(episode) }) { Label(Delete, systemImage: trash) } .tint(.red) } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’22
Reply to vLookup In App?
I suspect that the reason no one has responded is that your question is cast in terms of spreadsheets, which are a bit hard to grok when you’re used to traditional programming languages. So I dusted off my copy of Numbers and looked up the VLOOKUP function. It seems to be equivalent to Swift’s array subscripting. For example: let sheet: [[Int]] = [ [1, 2, 3], [4, 5, 6], [7, 8, 9], ] let row = 1 let column = 2 print(sheet[row][column]) // prints “6”If you read the documentation on arrays and subscripts, that might put you on the right path.Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.com
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’16
Reply to Correct way to label TextField inside Form in SwiftUI
I've never needed to do this, but I've had a quick look, and this seems reasonable: var body: some View { VStack(alignment: .leading) { Form { Text(First Name) TextField(, text: $firstName, prompt: Text(Required)) Text(Last Name) .padding(.top, 10) TextField(, text: $lastName, prompt: Text(Required)) Text(Email) .padding(.top, 10) TextField(, text: $email, prompt: Text(Required)) Text(Job) .padding(.top, 10) TextField(, text: $job, prompt: Text(Required)) Text(Role) .padding(.top, 10) TextField(, text: $role, prompt: Text(Required)) } .formStyle(.columns) .padding(.horizontal, 16) .padding(.vertical, 16) Spacer() } } The key is .formStyle(.columns).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’25
Reply to SwiftUI Table Limit of Columns?
I am attempting to overcome the 10 columns limitation of Table This is Crashing the compiler with this error: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions Code: import SwiftUI //--------------------------------------------------------------------------------------------- struct TestStruct : Identifiable { var id = UUID () var name : String var val : Int } //--------------------------------------------------------------------------------------------- struct ContentView: View { @State var testData : [ TestStruct ] = [ TestStruct ( name: Leopold, val: 1 ), TestStruct ( name: Napoleon, val: 2 ) ] var body: some View { VStack { Table ( testData ) { Group { TableColumn ( Name ) { testStruct in Text ( testStruct.name ) } TableColumn ( Value ) { testStruct in Text ( String ( testStruct.val ) ) } } } } } } //--------------------------------------------------------------------------------------------- struct ContentView_Pr
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’22
Reply to Illegal NSTableViewDataSource
Hello Claude:See if the code you checked is the same as this because when I run it with changes I get the crash at line 12import Cocoa import CoreData class RegistrationReportsViewController: NSViewController { requiredinit?(coder aDecoder: NSCoder) { self.items = [] super.init(coder: aDecoder) } overridefunc viewDidLoad() { super.viewDidLoad() tableView.dataSource = self // Do this FIRST tableView.delegate = self showRegisteredStudents() // not needed, done in showRegisteredStudents } privatelazyvar fetchedResultsController: NSFetchedResultsController = { let fetchRequest: NSFetchRequest = Registration.fetchRequest() let frc = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.persistentContainer.viewContext, sectionNameKeyPath: nil, cacheName: nil) frc.delegate = (selfas! NSFetchedResultsControllerDelegate) return frc }() var items: [NSManagedObject] var managedObjectContext = (NSApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext let persistentContain
Topic: Programming Languages SubTopic: Swift Tags:
Jan ’20
Reply to NSBrowser - edit cell contents
Well, it would really be easier to read the code than reading paraphrase of it.I can't really provide any code, but what I have is a NSBrowser hooked into CoreData, with the ability to add and remove entities in the hiearchy.Did you kook in code ? If so, please showI've tried hooking a double click event up to an IBAction (though a single click is what I'm ultimately after), from here I can get a reference to the browser.You mean the NSBrowser ?But to get a refernce, it would be easier to declare an IBOutlet. Why not ?Then I was attempting to get the selected item in the appropriate column, Please show codebut on the first column I was getting an empty array back when printing the indexPath. I must be doing something wrong there. Please show code, with the print statementI removed the non working code so I can't post here.Why did you need to remove to post here ?Conclusion: if you still want some help, please help others to help by showing the code.Unless you have already solved the problem.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jan ’20
Reply to Random "duplicate column name" crashes using SwiftData
I had the exact same problem. On the first startup everything is ok, then on the second one it crashes. It seems SwiftData doesn't see the already existing column for one-to-many relationship. This, in turn, crashes the application because of the duplicated column. The solution that I found is to explicitly create the inverse relationship in the second model. So, in your case, changing your DeskPosition model to this: @Model final class DeskPosition { let id: UUID var title: String var desk: Desk? private var heightInCm: Double @Transient var height: DeskHeight { get { DeskHeight(value: heightInCm, unit: .centimeters).localized } set { heightInCm = newValue.converted(to: .centimeters).value } } init(id: UUID, height: DeskHeight, title: String) { self.id = id self.heightInCm = height.converted(to: .centimeters).value self.title = title self.height = height } }
Replies
Boosts
Views
Activity
Oct ’23
Reply to Customizing Back Button in Column 2 "Content" in SplitView
You can remove the toggle to show and hide the column with .toolbar(removing: .sidebarToggle) - https://developer.apple.com/documentation/swiftui/view/toolbar(removing:) For the back button, if you're navigating to a detail view, you can use .navigationBarBackButtonHidden() - https://developer.apple.com/documentation/swiftui/view/navigationbarbackbuttonhidden(_:) - on the detail view to hide the back button
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to Back supported Navigation-View
NavigationView has only been soft deprecated, so will still function on iOS 16. As for manually back deploying, since NavigationView has been split into two parts but come with added components, such as a path and control over column visibility as well as the new NavigationLink(_:value:) and navigationDestination modifier, it would be quite difficult to accomodate all of this.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’22
Reply to Illegal NSTableViewDataSource
I submitted the full code:The crash is on line 62import Cocoa import CoreData class RegistrationReportsViewController: NSViewController { required init?(coder aDecoder: NSCoder) { self.items = [] super.init(coder: aDecoder) } override func viewDidLoad() { super.viewDidLoad() showRegisteredStudents() tableView.dataSource = self tableView.delegate = self tableView.reloadData() } private lazy var fetchedResultsController: NSFetchedResultsController = { let fetchRequest: NSFetchRequest = Registration.fetchRequest() let frc = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.persistentContainer.viewContext, sectionNameKeyPath: nil, cacheName: nil) frc.delegate = (self as! NSFetchedResultsControllerDelegate) return frc }() var items: [NSManagedObject] var managedObjectContext = (NSApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext let persistentContainer: NSPersistentContainer = { let container = NSPersistentContainer(name: ScorcentMasterReview) container.lo
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jan ’20
Reply to iAd Revenue Not Given in December Earnings?
I just received a new Financial Report that seems to include November, December, and January iAd payments. Check the Taxes and Adjustments column under the Americas (USD) row. The Financial Report is scheduled to be paid on the 31st of March. Hopefully everything goes smoother from here on out with iAd.
Replies
Boosts
Views
Activity
Mar ’16
Reply to TabularData Framework: crash on opening CSV file
Yes, I was able to replicate the issue with a CSV file with duplicate column names Please try this out on the macOS 13 beta that we just seeded. My understanding is that this problem is fixed there. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: Machine Learning & AI SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Filtered dataFrame displays original dataFrame values
Filtered columns behave like Swift ArraySlices. In particular they maintain the original indices, see ArraySlice, Slices Maintain Indices. You need to replace for i in 0 ... data.rows.count with for i in data.rows.indices. The other option is to convert the slice back to a regular DataFrame: let data = DataFrame(data0.filter { ... })
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to Core Data code generation causes build failure
If you go to your data model and look at Configurations -> Default you will probably see that in the Class column everything is prefixed with a .. To fix this, go to each of your entities and on the right delete everything inside the module setting so that it goes to Global namespace. This should remove the . and will hopefully mean that your files are now found. If you clean and build again it should all work.
Replies
Boosts
Views
Activity
Oct ’16
Reply to swipeActions on macOS?
Even with two columns and a Label. It does not work for me. I am using Xcode 14 and Monterey var body: some View { VStack { List(podcast.episodes!) { episode in EpisodeView(podcast: podcast, episode: episode) .swipeActions(edge: .trailing) { Button (action: { self.deleteEpisode(episode) }) { Label(Delete, systemImage: trash) } .tint(.red) } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to Getting Errors in Xcode 11 Beta (Running in macOS Catalina Beta)
I see, no wonder his seem to go automatically on the next line as if he pressed enter (can't believe it was just that, been agonizing for days, even downloaded macOS Catalina beta. We just had different column setting. How do you set the XCode so it behaves exactly as that tutorial? Thank you so much, again.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’19
Reply to vLookup In App?
I suspect that the reason no one has responded is that your question is cast in terms of spreadsheets, which are a bit hard to grok when you’re used to traditional programming languages. So I dusted off my copy of Numbers and looked up the VLOOKUP function. It seems to be equivalent to Swift’s array subscripting. For example: let sheet: [[Int]] = [ [1, 2, 3], [4, 5, 6], [7, 8, 9], ] let row = 1 let column = 2 print(sheet[row][column]) // prints “6”If you read the documentation on arrays and subscripts, that might put you on the right path.Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.com
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’16
Reply to Correct way to label TextField inside Form in SwiftUI
I've never needed to do this, but I've had a quick look, and this seems reasonable: var body: some View { VStack(alignment: .leading) { Form { Text(First Name) TextField(, text: $firstName, prompt: Text(Required)) Text(Last Name) .padding(.top, 10) TextField(, text: $lastName, prompt: Text(Required)) Text(Email) .padding(.top, 10) TextField(, text: $email, prompt: Text(Required)) Text(Job) .padding(.top, 10) TextField(, text: $job, prompt: Text(Required)) Text(Role) .padding(.top, 10) TextField(, text: $role, prompt: Text(Required)) } .formStyle(.columns) .padding(.horizontal, 16) .padding(.vertical, 16) Spacer() } } The key is .formStyle(.columns).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’25
Reply to SwiftUI Table Limit of Columns?
I am attempting to overcome the 10 columns limitation of Table This is Crashing the compiler with this error: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions Code: import SwiftUI //--------------------------------------------------------------------------------------------- struct TestStruct : Identifiable { var id = UUID () var name : String var val : Int } //--------------------------------------------------------------------------------------------- struct ContentView: View { @State var testData : [ TestStruct ] = [ TestStruct ( name: Leopold, val: 1 ), TestStruct ( name: Napoleon, val: 2 ) ] var body: some View { VStack { Table ( testData ) { Group { TableColumn ( Name ) { testStruct in Text ( testStruct.name ) } TableColumn ( Value ) { testStruct in Text ( String ( testStruct.val ) ) } } } } } } //--------------------------------------------------------------------------------------------- struct ContentView_Pr
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’22
Reply to Illegal NSTableViewDataSource
Hello Claude:See if the code you checked is the same as this because when I run it with changes I get the crash at line 12import Cocoa import CoreData class RegistrationReportsViewController: NSViewController { requiredinit?(coder aDecoder: NSCoder) { self.items = [] super.init(coder: aDecoder) } overridefunc viewDidLoad() { super.viewDidLoad() tableView.dataSource = self // Do this FIRST tableView.delegate = self showRegisteredStudents() // not needed, done in showRegisteredStudents } privatelazyvar fetchedResultsController: NSFetchedResultsController = { let fetchRequest: NSFetchRequest = Registration.fetchRequest() let frc = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.persistentContainer.viewContext, sectionNameKeyPath: nil, cacheName: nil) frc.delegate = (selfas! NSFetchedResultsControllerDelegate) return frc }() var items: [NSManagedObject] var managedObjectContext = (NSApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext let persistentContain
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jan ’20