Post

Replies

Boosts

Views

Activity

Reply to How to Initialize a structure with in a class?
Thanks Claude, follow up question.. How do I populate ChartSeriesData? I thought I could just add the following: However coding this way there is no append method. extension ChartSeriesRow {     func addRow(chartRow: ChartSeriesData){          ChartSeriesRow.ChartSeriesData.chartEntry.append(contentsOf: chartRow)     } }
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’22
Reply to How to add an IBAction to a macOS tableView Cell
import Cocoa class CustomTableCell: NSTableCellView {     @IBOutlet weak var userNameLabel: NSTextField!     @IBOutlet weak var roleLabel: NSTextField!    @IBOutlet var testTextView: NSTextView!     override func draw(_ dirtyRect: NSRect) {         super.draw(dirtyRect)         // Drawing code here.     }     @IBAction func emailButton(_ sender: Any) {         // Email user     } } I was first trying to add a @IBAction for a scrollview and when I control drag the scrollview to the CustomTableCell file I could not create and @IBAction. It is like having a scrollview object inside a scrollable table view is not allowed. So, I was not able to create an action to get the contents of the scrollview in the ViewController code. Much less creating code to pass to the viewController the contents of the scrollView text entered. I sent a offline demo project to illustrate what I am saying. Thanks for your help on this.
Topic: UI Frameworks SubTopic: AppKit Tags:
Nov ’22
Reply to macOS Xcode 14.2 app applicationwillterminate function is not called
I got it working. I did need to set Application can be killed immediately when user is shutting down or logging out" setting to NO to the target using the INFO tab but I had a coding error implementing applicationWillTerminate. So, here is how my app delegate looks now. import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate {         func applicationWillFinishLaunching(_ notification: Notification) {     }     func applicationDidFinishLaunching(_ aNotification: Notification) {         // Insert code here to initialize your application           //    try! DatabaseManager.setup(for: NSApp)     }     func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {         return true     }     func applicationWillTerminate(_ Notification: Notification) {         // Insert code here to tear down your application         getPrefs()         if paymePref.prefAutoBackup == "Yes" {             backupDataBase()         }     } }
Topic: UI Frameworks SubTopic: AppKit Tags:
Jan ’23
Reply to Progress Indicator not working as expected
I tried a couple of things using a separate thread but still no luck. Below is my latest try? I must be missing something basic with this in seems to be very straightforward? @IBAction func progressStart(_ sender: Any) { // Start the progress animation progressIndicator.startAnimation(self) // Do some work here... let dispatchGroup = DispatchGroup() dispatchGroup.enter() DispatchQueue.global(qos: .background).async { var progress: Double = 0.0 for _ in 0..<100 { // Update the progress value in a loop progress += 1.0 DispatchQueue.main.async { self.progressLabel.stringValue = String(progress) self.progressIndicator.doubleValue = progress / 100.0 } // Do some work here... } dispatchGroup.leave() } dispatchGroup.notify(queue: DispatchQueue.main) { // Stop the progress animation self.progressIndicator.stopAnimation(self) } } }
Jun ’23
Reply to Companion Xcode project
To Clarify, the projects I am Looking for are from WWDC2023-10154. The video says download but no link, Is the link gone after initial play? Thanks "This is a code-along. During this session, I will be building an app with you. Hit pause now, and download the companion Xcode projects: an archive with the prepared starting point, and the finished one. Open the starter project, and go to the ContentView file"
Jun ’23
Reply to Where does SwiftData store the data?
I found these three files which are part of core-data datastore as well as swiftdata 144 -rw-r--r--@ 1 bsoule staff 73728 Jul 29 10:10 default.store 64 -rw-r--r--@ 1 bsoule staff 32768 Aug 7 14:57 default.store-shm 1160 -rw-r--r--@ 1 bsoule staff 564472 Aug 7 14:56 default.store-wal in my library directory --> Library/Containers/CHCS.ArtManager/Data/Library/Application Support I expected to also see a file with an sqlite extension but I did not? Any ideas where the sqlite database is stored?
Aug ’23
Reply to How to Initialize a structure with in a class?
Thanks Claude, follow up question.. How do I populate ChartSeriesData? I thought I could just add the following: However coding this way there is no append method. extension ChartSeriesRow {     func addRow(chartRow: ChartSeriesData){          ChartSeriesRow.ChartSeriesData.chartEntry.append(contentsOf: chartRow)     } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to How to populate an array within a Class Instance?
Thanks again Claude, you have been very helpful. I think I am finally understanding to store data you need an instance of an object.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to How to add an IBAction to a macOS tableView Cell
import Cocoa class CustomTableCell: NSTableCellView {     @IBOutlet weak var userNameLabel: NSTextField!     @IBOutlet weak var roleLabel: NSTextField!    @IBOutlet var testTextView: NSTextView!     override func draw(_ dirtyRect: NSRect) {         super.draw(dirtyRect)         // Drawing code here.     }     @IBAction func emailButton(_ sender: Any) {         // Email user     } } I was first trying to add a @IBAction for a scrollview and when I control drag the scrollview to the CustomTableCell file I could not create and @IBAction. It is like having a scrollview object inside a scrollable table view is not allowed. So, I was not able to create an action to get the contents of the scrollview in the ViewController code. Much less creating code to pass to the viewController the contents of the scrollView text entered. I sent a offline demo project to illustrate what I am saying. Thanks for your help on this.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to How to add an IBAction to a macOS tableView Cell
Thanks Claude, could not have done it without your help.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to How to change the text color for SwiftUI Chart's legend text?
Thanks for the reply, I have been doing some research on secondaryLabelColor and can't find any examples as well as attempting to add it to my swiftUI view but not really sure how to code. Do you have any usage examples of this? Also, how did you go about figuring out the legend color is driven by secondaryLabelColor. Thanks
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to Remove XCode settings Document Types
Seems to be still the case with Xcode 14.2. However I don't have a info.plist. Any ideas how to delete?
Replies
Boosts
Views
Activity
Jan ’23
Reply to macOS Xcode 14.2 app applicationwillterminate function is not called
After reviewing some of the doc mentioned above, I did not see  "sudden termination" but I added "Application can be killed immediately when user is shutting down or logging out" setting to NO to the target using the INFO tab but still applicationWillTerminate function is not being called. Any ideas how to fix?
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jan ’23
Reply to macOS Xcode 14.2 app applicationwillterminate function is not called
I got it working. I did need to set Application can be killed immediately when user is shutting down or logging out" setting to NO to the target using the INFO tab but I had a coding error implementing applicationWillTerminate. So, here is how my app delegate looks now. import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate {         func applicationWillFinishLaunching(_ notification: Notification) {     }     func applicationDidFinishLaunching(_ aNotification: Notification) {         // Insert code here to initialize your application           //    try! DatabaseManager.setup(for: NSApp)     }     func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {         return true     }     func applicationWillTerminate(_ Notification: Notification) {         // Insert code here to tear down your application         getPrefs()         if paymePref.prefAutoBackup == "Yes" {             backupDataBase()         }     } }
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jan ’23
Reply to Progress Indicator not working as expected
I tried a couple of things using a separate thread but still no luck. Below is my latest try? I must be missing something basic with this in seems to be very straightforward? @IBAction func progressStart(_ sender: Any) { // Start the progress animation progressIndicator.startAnimation(self) // Do some work here... let dispatchGroup = DispatchGroup() dispatchGroup.enter() DispatchQueue.global(qos: .background).async { var progress: Double = 0.0 for _ in 0..<100 { // Update the progress value in a loop progress += 1.0 DispatchQueue.main.async { self.progressLabel.stringValue = String(progress) self.progressIndicator.doubleValue = progress / 100.0 } // Do some work here... } dispatchGroup.leave() } dispatchGroup.notify(queue: DispatchQueue.main) { // Stop the progress animation self.progressIndicator.stopAnimation(self) } } }
Replies
Boosts
Views
Activity
Jun ’23
Reply to Progress Indicator not working as expected
I ended up going a different route, I got it working like I wanted via SwifUI, I wanted to learn more about SwiftUI so this is a better way to go.
Replies
Boosts
Views
Activity
Jun ’23
Reply to Companion Xcode project
To Clarify, the projects I am Looking for are from WWDC2023-10154. The video says download but no link, Is the link gone after initial play? Thanks "This is a code-along. During this session, I will be building an app with you. Hit pause now, and download the companion Xcode projects: an archive with the prepared starting point, and the finished one. Open the starter project, and go to the ContentView file"
Replies
Boosts
Views
Activity
Jun ’23
Reply to Companion Xcode project
Here is the link for the projects. [https://developer.apple.com/documentation/SwiftUI/Building-a-document-based-app-using-SwiftData)
Replies
Boosts
Views
Activity
Jun ’23
Reply to Where does SwiftData store the data?
I found these three files which are part of core-data datastore as well as swiftdata 144 -rw-r--r--@ 1 bsoule staff 73728 Jul 29 10:10 default.store 64 -rw-r--r--@ 1 bsoule staff 32768 Aug 7 14:57 default.store-shm 1160 -rw-r--r--@ 1 bsoule staff 564472 Aug 7 14:56 default.store-wal in my library directory --> Library/Containers/CHCS.ArtManager/Data/Library/Application Support I expected to also see a file with an sqlite extension but I did not? Any ideas where the sqlite database is stored?
Replies
Boosts
Views
Activity
Aug ’23
Reply to How to customize buttons in a SwiftUI view toolbar
Yes I add tried the .tint modifier as well with no success. BTW I am using Xcode 15 beta 7, I think I will give a try with my Ventura Xcode 14 to see if that makes a difference.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’23
Reply to How to customize buttons in a SwiftUI view toolbar
I get the same results on Ventura and Xcode 14
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’23