Post

Replies

Boosts

Views

Activity

Deleting CloudKit data
I have been testing an app which uses cloudKit with SWIFTDATA and after testing for several months my 200GB iCloud store is showing 168GB for iCloud Drive. Now my iCloud drive is only 22.6GB so the rest of the 168GB must be data from my app. Also, I have function in my app to delete all iCloud Data which I thought that should clean up iCloud storage but it does not. I tried resetting the Develop Environment but no change to iCloud data. Also I have several other containers in iCloud created while getting iCloud working which I would like to delete but I understand you can’t. https://forums.developer.apple.com/forums/thread/45251?answerId=788694022#788694022 Bottom line cloudkit console has been pretty much useless for me and I need a way to manage (delete containers and data). Am I missing something?
1
0
1.1k
Jun ’24
NavlgationLink Code not working on macOS Sequoia
This code which works fine on macOS Sonoma but on Sequoia the navigationLinks do not work? VStack { Text("Application Global Values") .font(.largeTitle) .fontWeight(.bold) .padding(.bottom, 10) Text("Select each of the Descriptors, enter the values and when done then Tap on (Add/Save)") .font(.title3) .foregroundColor(.secondary) List { NavigationLink("Enter Core Descriptors", destination: CoreView(systemSettings: $systemSettings)) .padding() // Add padding to create some space inside the border // .background(Color.white) // Optional: Add a background color if needed // .border(Color.red, width: 2) // Add a red border with a specified thickness .overlay( RoundedRectangle(cornerRadius: 10) // Specify the corner radius for rounded corners .stroke(Color.red, lineWidth: 2) // Define the color and thickness of the border ) SetupDivider(thickness: 3) NavigationLink("Enter Counters Descriptors", destination: CountersView(systemSettings: $systemSettings)) .padding() // .background(Color.white) .overlay( RoundedRectangle(cornerRadius: 10) // Specify the corner radius for rounded corners .stroke(Color.red, lineWidth: 2) // Define the color and thickness of the border ) SetupDivider(thickness: 3) NavigationLink("Create Custom Descriptors", destination: UserFieldsView(userFields: $userFields)) .padding() // .background(Color.white) .overlay( RoundedRectangle(cornerRadius: 10) // Specify the corner radius for rounded corners .stroke(Color.red, lineWidth: 2) // Define the color and thickness of the border ) SetupDivider(thickness: 3) NavigationLink("View All Descriptors", destination: DefaultDetailView(userFields: $userFields, systemSettings: $systemSettings)) .padding() // .background(Color.white) .overlay( RoundedRectangle(cornerRadius: 10) // Specify the corner radius for rounded corners .stroke(Color.red, lineWidth: 2) // Define the color and thickness of the border ) SetupDivider(thickness: 3) }
1
0
397
Aug ’24
How to get control from a combo box selection?
Using a combo box after a selection I want to get control to take some actions based on the selection after press tab or return in the field. I have tried a few controls like the one below: // textShouldEndEditing     func control(_ control: NSControl, textShouldEndEditing fieldEditor: NSText) - Bool {         print(#function,control.tag) But the above control only gets control if the field is edited. I want control once tab, an item selected or return is pressed while on the filed. How is this done?
2
0
583
Mar ’21
How to save an Image to NsData object and then retrieve.
My environment is as follows: Xcode 12, macOS BS developing a macOS app. I have an IBOutlet from a IB window as @IBOutlet weak var imageView: NSImageView! So, I want to store imageView to a NSData object and then save the NSData object in my UserDefaults. Once I saved the Image in my UserDefaults I need to be able to decode or retrieve the image for use in other parts of the app. How is this done? Also, I have seen some cautions about converting an Image to NSData object and retrieving. It seems the retrieved image may not be 100% as it was originally. Is this true and if so why? Thanks
2
0
1.2k
Jun ’21
How to populate an array within a Class Instance?
I have the following code: class ChartSeriesRow: ObservableObject {     var id = UUID()     var chartCategory: String     struct ChartSeriesData {         var chartEntry: [ChartData]     }     var chartSeries : ChartSeriesData     struct ChartData: Codable, Identifiable, Hashable {         var id = UUID()         let chartMonth: String         let chartSales: String     }     init() {         chartCategory = ""         chartSeries = ChartSeriesData(chartEntry: [ChartData(chartMonth: "01", chartSales: "10.0") ] )     } } 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)     } }
2
0
828
Nov ’22
Populate one column based on values of other column in a NSTableView
How do you populate one column based on values of other column for a macOS app using Xcode 12 in a tableView? The value of the first column comes from a comboBox which I get control by using the following code connected to the comboBox: @IBAction func comboAction(_ sender: NSComboBox) {         print("Combo selected", sender.selectedTag(), sender.stringValue, sender.indexOfSelectedItem, sender.identifier as Any)         } Then base on the value of the comboBox column within the comboAction function I want to populate column 2. Can this be done? If so, how
3
0
764
Mar ’21
How to Initialize a structure with in a class?
From the class below how do I initialize chartEntry for the structure array? As it is below chartEntry is outside scope of init? class ChartSeriesRow: ObservableObject {     var id = UUID()     var chartCategory: String     struct chartSeriesData{         var chartEntry: [ChartData]     }     struct ChartData: Codable, Identifiable, Hashable {         var id = UUID()         let chartMonth: String         let chartSales: String     }     init() {         chartCategory = ""         chartEntry = chartSeriesData: [ChartData.chartMonth: "01",  ChartData.chartSales: "10.0"]     }      }
3
0
862
Nov ’22
Progress Indicator not working as expected
I have a test project with a bar progress indicator create on Ventura with Xcode 14.3.1., It does not show the any animation until the @IBAction function completes. I want to show progress as it progresses not a just the end? Any ideas how to fix this? Below is my test project code.. // // ViewController.swift // ProgressTest // // Created by Bob on 6/5/23. // import Cocoa class ViewController: NSViewController { @IBOutlet weak var progressIndicator: NSProgressIndicator! // var progress: Double = 0.0 override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override var representedObject: Any? { didSet { // Update the view, if already loaded. } } @IBAction func progressStart(_ sender: Any) { // Start the progress animation progressIndicator.startAnimation(self) // Do some work here... // Do some work here... var progress: Double = 0.0 for _ in 0..<100 { // Update the progress value in a loop progress += 1.0 progressIndicator.doubleValue = progress // progress = Double(i) // progressIndicator.increment(by: 10) // progressIndicator.doubleValue = progress // Do some work here... } // Stop the progress animation progressIndicator.stopAnimation(self) } } thanks Bob
3
0
1.3k
Jun ’23
How to customize buttons in a SwiftUI view toolbar
I have the following test code import SwiftUI struct ContentView: View { @State private var field1 = "" @State private var field2 = "" @State private var field3 = "" var body: some View { VStack { Form { Section(header: Text("Input Fields")) { TextField("Field 1", text: $field1) TextField("Field 2", text: $field2) TextField("Field 3", text: $field3) } } List { ForEach(1..<6) { index in Text("Item \(index)") } } .listStyle(InsetListStyle()) } .navigationTitle("Form and List View") .toolbar { ToolbarItem(placement: .cancellationAction) { Button("Dismiss") { // Handle dismiss action } .foregroundStyle(.red) // } ToolbarItem(placement: .primaryAction) { Button("Done") { // Handle done action } .foregroundStyle(.green) // } } } } I can't customize the color of the Buttons. Besides .foreground modifier I have tried ..foregroundColor(.red) and .foregroundColor(.green) to no avail. How can I customize the buttons in the toolbar for both macOS and IOS
3
0
1k
Aug ’23
Swiftui Table statement conditional table columns
Is it possible to have conditional table columns for a swifui Table statement? Like for this code TableColumn("Image") { artPiece in if let imageData = artPiece.artImage.first, let image = UIImage(data: imageData!) { Image(uiImage: image) .resizable() .frame(width: 50, height: 50) } else { Image(systemName: "photo") .resizable() .frame(width: 50, height: 50) } } .customizationID("Image") TableColumn("Name", value: \.artName) .customizationID("Name") TableColumn ("Art ID", value: \.artPieceID) { artPiece in Text(String(artPiece.artPieceID)) } .customizationID("Art ID") have a conditional TableColumn for this part of my SWIFTDATA model var artDefinedFields: [ArtDefinedFields] = [] or if I change the variable string array to this var artDefinedFields: [ArtDefinedFields] = Array(repeating: ArtDefinedFields(), count: 10), initialize the array with "None" and only create a TableColumn when there is aArtDeginedFields value other than "None"
3
0
646
Aug ’24