Post

Replies

Boosts

Views

Activity

Reply to Hit Breakpoint running Playground
Has anything changed about this? I'm actually in Playground, not Playground in Xcode, and I am able to set breakpoints in a file in the Source folder, but code execution doesn't stop at the breakpoints. I know the code runs to those points, because there are print statements that print into the debug area that are placed between those breakpoints.
Oct ’22
Reply to How do I get the value of UITextField text instance property and update UITableView row whenever the user edits the UITextField text property?
Here's my code below. The textfield is outside of the table view. I do use reloadRows. I call it from textField(:charactersShouldChangeIn::). It reloads the row so that the table view cell in the row shows the current state of text field's text property before the text property is updated with the change the user made. self.temporaryMessageBeingEdited?.subject is type String, as you must realize. This temporaryMessageBeingEdited object is in the array the table view uses at the same chronological position as the table view row that is reloaded as must be obvious to you. Neither the textDidChange(:) nor the textWillChange(:) ever fires, though the other two callback methods of the UITextInputDelegate do fire when I test the code by typing into the text field during run time. // MARK: - UITextFieldDelegate extension MessagesViewController: UITextFieldDelegate {       func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {           print("#", #function)           guard string != "\n" else {       return false     }           self.temporaryMessageBeingEdited?.subject = self.textFieldSubject.text           if let guardedIndexPathToReload = self.indexPathOfMessageBeingEdited {       self.tableView.reloadRows(at: [guardedIndexPathToReload], with: .none)     }           return true   }     } // MARK: - UITextInputDelegate extension MessagesViewController: UITextInputDelegate {       func selectionWillChange(_ textInput: UITextInput?) {     print("#", #function)   }       func selectionDidChange(_ textInput: UITextInput?) {     print("#", #function)   }       func textWillChange(_ textInput: UITextInput?) {     print("#", #function)   }       func textDidChange(_ textInput: UITextInput?) {      print("#", #function)   }          }         }     }
Oct ’22
Reply to Does a parent record in CloudKit have to be in the same CKDatabase as a child record?
I don't think it's possible to save a record in one database and another record in a different database at the same time, so the parent record and the child record I mention in my post would have be saved in different lines of code. I think. I don't think it is possible to save two records in two different databases using CKModifyRecordsOperation. I don't know if there is a way at all.
Aug ’22
Reply to Does synchronous mean that by definition it is run on and called from separate threads, or does it have to be that way because of the way things are?
Apple documentation says that Operations run synchronously. Why then does the code continue to run after an operation is added to a queue? Here is my code: let op = BlockOperation(block: { print("Done") }) let qu = OperationQueue() qu.addOperation(op) print("after!") Here is the debug results: after! Done
Jul ’22