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 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