Post

Replies

Boosts

Views

Activity

Reply to MacOS Structs, Constants, TableView Delegate (Implement a Variable) Question
As fate would have it, I managed to solve the issue a few hours after I posted the question :] I changed my Struct code in the applications (Constants File) to new base values (I probably did not need to make the change.): struct TheRequestedNumbersToFind { static var theFirstNumber = 0 // <=== Previous value = (10) static let theSecondNumber = 0 // <=== Previous value = (13) static let theThirdNumber = 0 // <=== Previous value = (15) static let theFourthNumber = 0 // <=== Previous value = (22) static let theFifthNumber = 0 // <=== Previous value = (29) static let theSixthNumber = 0 // <=== Previous value = (46) static let theSeventhNumber = 0 // <=== Previous value = (3) } I discovered I could change the (Struct Static Variable) to equal the received variable in the applications (Notification): /// Identify the received (Notification) information for the tableView textField. let theTransferredFirstNumberReceived = notification.object if let theFirstNumberReceived = (theTransferredFirstNumberReceived as AnyObject) as? Int32 { /// Note: The (USER) entered the number (10). print("THE FIRST NUMBER RECEIVED :: \(Int32(theFirstNumberReceived)) \n") // Prints: THE FIRST NUMBER RECEIVED = 10 /// ASSIGN THE REQUESTED NUMBER TO THE (STRUCT VARIABLE) TO CHANGE THE (CONSTANTS FILE STRUCT VARIABLE). /// The "Int(theFirstNumberReceived)" must remain as "Int". TheRequestedNumbersToFind.theFirstNumber = Int(theFirstNumberReceived) print("THE REVISED FIRST STRUCT NUMBER RECEIVED :: \(Int32(TheRequestedNumbersToFind.theFirstNumber)) \n") // Prints : // THE REVISED FIRST STRUCT NUMBER RECEIVED :: 10 } I modified the tableView code for the (first column) to be : /// Identify the (STRUCT CONSTANT) for the (FIRST NUMBER). /// This (STRUCT CONSTANT) works because the constant is recognized /// Change the (STRUCT STATIC VARIABLE) to (EQUAL THE REQUESTED NUMBER). let someFirstNumber = TheRequestedNumbersToFind.theFirstNumber print("First Number Struct Variable Received :: \(someFirstNumber) \n") // Prints : // First Number Struct Variable Received :: 10 This change also removed the incremental errors with the static number (10), which allowed a few numbers not equal to (10), to be erroneously displayed as equal to (10). I can now close this issue ... :] Best regards, jim_k
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’21
Reply to Core Data TableView Display Problem
Hello deeje, Thank you with your quick reply and suggestion ... :] Unfortunately, the error "Value of type "NSManagedObject" has no member "calendarDate" still persists with the suggested change, complete with me deleting the original "Derived Data," cleaning, and rebuilding the application. Again, thank you with your suggestion ... jim_k
Jun ’21
Reply to Core Data and Random NULL Values
Core Data and Random NULL Values Solution (210619) The application code caused NULL values to be saved into stored objects as follows: The application initializes the mutable array “Items.” The textFields identify the input values to save. Four constants are identified, such as managedObjectContext, entity, registerApplicationNumberObject, and component. The constant “registerApplicationNumberObject” receives textField input values with “setValue.” The constant “component” does NOT receive values with “setValue.” The constant “component” inherits missing values. The mutable array “items” is appended to the stored objects with the “component” missing values. Core Data and SQLite identify the missing values with NULL. The application does not exhibit NULL values when the following code is disabled: “//let component = NSManagedObject(entity: entity!, insertInto: managedObjectContext)” “//items.append (component)” As a side note, Xcode indicated that “entity: entity” should be addressed as “entity: entity!” Now I can store, fetch, find, and delete values from Core Data. jim_k
Jun ’21
Reply to MacOS Structs, Constants, TableView Delegate (Implement a Variable) Question
As fate would have it, I managed to solve the issue a few hours after I posted the question :] I changed my Struct code in the applications (Constants File) to new base values (I probably did not need to make the change.): struct TheRequestedNumbersToFind { static var theFirstNumber = 0 // <=== Previous value = (10) static let theSecondNumber = 0 // <=== Previous value = (13) static let theThirdNumber = 0 // <=== Previous value = (15) static let theFourthNumber = 0 // <=== Previous value = (22) static let theFifthNumber = 0 // <=== Previous value = (29) static let theSixthNumber = 0 // <=== Previous value = (46) static let theSeventhNumber = 0 // <=== Previous value = (3) } I discovered I could change the (Struct Static Variable) to equal the received variable in the applications (Notification): /// Identify the received (Notification) information for the tableView textField. let theTransferredFirstNumberReceived = notification.object if let theFirstNumberReceived = (theTransferredFirstNumberReceived as AnyObject) as? Int32 { /// Note: The (USER) entered the number (10). print("THE FIRST NUMBER RECEIVED :: \(Int32(theFirstNumberReceived)) \n") // Prints: THE FIRST NUMBER RECEIVED = 10 /// ASSIGN THE REQUESTED NUMBER TO THE (STRUCT VARIABLE) TO CHANGE THE (CONSTANTS FILE STRUCT VARIABLE). /// The "Int(theFirstNumberReceived)" must remain as "Int". TheRequestedNumbersToFind.theFirstNumber = Int(theFirstNumberReceived) print("THE REVISED FIRST STRUCT NUMBER RECEIVED :: \(Int32(TheRequestedNumbersToFind.theFirstNumber)) \n") // Prints : // THE REVISED FIRST STRUCT NUMBER RECEIVED :: 10 } I modified the tableView code for the (first column) to be : /// Identify the (STRUCT CONSTANT) for the (FIRST NUMBER). /// This (STRUCT CONSTANT) works because the constant is recognized /// Change the (STRUCT STATIC VARIABLE) to (EQUAL THE REQUESTED NUMBER). let someFirstNumber = TheRequestedNumbersToFind.theFirstNumber print("First Number Struct Variable Received :: \(someFirstNumber) \n") // Prints : // First Number Struct Variable Received :: 10 This change also removed the incremental errors with the static number (10), which allowed a few numbers not equal to (10), to be erroneously displayed as equal to (10). I can now close this issue ... :] Best regards, jim_k
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Sep ’21
Reply to Core Data TableView Display Problem
Hello deeje, Thank you with your quick reply and suggestion ... :] Unfortunately, the error "Value of type "NSManagedObject" has no member "calendarDate" still persists with the suggested change, complete with me deleting the original "Derived Data," cleaning, and rebuilding the application. Again, thank you with your suggestion ... jim_k
Replies
Boosts
Views
Activity
Jun ’21
Reply to Core Data and Random NULL Values
Core Data and Random NULL Values Solution (210619) The application code caused NULL values to be saved into stored objects as follows: The application initializes the mutable array “Items.” The textFields identify the input values to save. Four constants are identified, such as managedObjectContext, entity, registerApplicationNumberObject, and component. The constant “registerApplicationNumberObject” receives textField input values with “setValue.” The constant “component” does NOT receive values with “setValue.” The constant “component” inherits missing values. The mutable array “items” is appended to the stored objects with the “component” missing values. Core Data and SQLite identify the missing values with NULL. The application does not exhibit NULL values when the following code is disabled: “//let component = NSManagedObject(entity: entity!, insertInto: managedObjectContext)” “//items.append (component)” As a side note, Xcode indicated that “entity: entity” should be addressed as “entity: entity!” Now I can store, fetch, find, and delete values from Core Data. jim_k
Replies
Boosts
Views
Activity
Jun ’21
Reply to Is there a FAQ sheet to properly ask a question and display code?
Gentlemen, thank you for the updated information ... :] It was fun trying to navigate with my first attempt, but successful. I shall generate more questions about Swift in the future, once I understand how to ask the right question, since Swift is new to me, but not coding. Again, thank you. Best regards, jim k
Replies
Boosts
Views
Activity
May ’21