Post

Replies

Boosts

Views

Activity

How to disable UIAlertController Buttons?
Hi all, I'm struggling to find a way to disable buttons in a UIAlertController of .alert style. I have a textfield, for entering the current password, a button for changing the current password and a button for deleting it. I'd like to disable both password buttons until the current password is correctly entered into the textfield, but I'm struggling to find the solution. If anyone can point me in the right direction it would be much appreciated.
7
0
5k
Nov ’19
Using NSTextFieldDelegate with NSSecureTextField
Hi, I've been making good progress with learning how to use NSTextFieldDelegate with NSTextField, but I'm struggling with how to use it with NSSecureTextField. Can anyone point me in the right direction? I need to be able to grab the stringValue and work with it when the return key is pressed. The code below works fine for an NSTextField. I obviously need to use a different function, or a different responder type perhaps? func control(_ control: NSControl, textView: NSTextView, doCommandBy commandSelector: Selector) -> Bool {       if (commandSelector == #selector(NSResponder.insertNewline(_:))) {    guard let sender = control as? NSSecureTextField else {return false}    if sender.tag == 1 {     print("It equals 1")    }         if sender.stringValue != "" {       print("field is not empty")      }      self.view.window?.makeFirstResponder(sender.nextKeyView)            return true    }    return false  }
1
0
619
Oct ’22
ControlTextDidEndEditing (how to determine which textfield called)
Hi, I have a number of NSTextFields on a ViewController and I'm searching for a way to determine which textfield called the DidEndEditing method. Is there a way to do it without adding an IBOutlet for each TextField? func controlTextDidEndEditing(_ obj: Notification) {      } Also, the IBOutlet question raises another question. Is there an equivalent of UIKits IBOutletCollection for AppKit? I've been googling away but haven't found much about it so far. Cheers for any help.
1
0
452
Oct ’22
Programmatically closing an app.
Here's my context: User imports a backup file via airdrop, from a laptop to the mobile. My app opens and asks for a password to import and decrypt the file. The user decides to cancel instead, so taps the cancel button. How do I close the app at that point? I have done a lot of googling but so far have not found out how to do it.
10
0
15k
Jan ’21
How to print a QRCode to the proper size?
Hi, I'm having trouble printing a QRCode to the proper size. I pass it, as a UIImage, to a UIActivityViewController and it prints, but at the full width of the A4 page. I've been looking into all kinds of ways to try and shrink it down, but without success. Is there an image equivalent of UISimpleTextPrintFormatter or something along those lines that makes it simple? Do I need to use a UIViewPrintFormatter? Any help greatly appreciated.
0
0
617
Aug ’21
Passwords and the need for a random salt.
Hi. I have a question about whether or not a random salt is necessary when there is no centralised database for hackers to attack. It's pretty clear that it's necessary when there is, but is it important when the users simply backup their data to a password encrypted file in a place of their choosing? Is it possible for someone with malicious intent to extract a hardcoded salt from a compiled app?
1
0
942
Sep ’20
Acceptable practice for cancelling TouchID
I have the option to use touchID in my app if the user chooses to. I'm wondering though about the cancel option. I'm not planning on having a fallback. If the user decides to cancel it's simply because they've decided to close the app. Can I simply close the app using exit(0), or is this considered bad practice?
0
0
501
Jul ’20
Trouble accessing fileURL: Simulator to iPhone
Hi, I'm having trouble accessing a file on my device. The file is saved to the Files App. On the simulator it runs without a hitch, but on my iPhone it crashes because it doesn't have permission to access the file, even though it created the file. I'm guessing there's probably something that needs setting, perhaps in the info.plist? Supports opening files in place is set to yes, so I've ruled that out as the problem. Any advice much appreciated.
3
0
788
Jul ’20
openUrlContexts issue
I'm having trouble calling the openUrlContexts function from SceneDelegate. I have defined a UTI for an exported backup file, and it saves to the files app with no problems. In the simulator my app opens when the saved file is clicked, so it does make the connection there, but no function is called. Does there need to be some setup code to make this function work, or should it automatically fire up when the file is launched?
4
0
3.3k
Jun ’20
Encrypted backup
Hi, I'd like to offer my users the option to save an encrypted backup of their data, from CoreData, to a place of their choosing. Just a textfile with the data in json format. How I envisage it is that they will click the backup button, a popup will ask them to input a password, then they'll save the outputted file somewhere. I don't know how to implement this. I've been playing around with CryptoKit in a playground, but tutorials seem few and far between. What is available isn't geared towards explaining how to do what I want to do. Does anyone know of a resource or tutorial that could help me learn to implement this feature? Any help much appreciated.
9
0
2.7k
May ’20