diff --git a/apps/ios/Snowbound/Prototypes.swift b/apps/ios/Snowbound/Prototypes.swift index 489f174c6979dcae2baa848c67fa7388a8906096..e4b9cab6eb09341cc0fcecc792702eb07c86c832 100644 --- a/apps/ios/Snowbound/Prototypes.swift +++ b/apps/ios/Snowbound/Prototypes.swift @@ -63,9 +63,10 @@ extension Prototype { field.placeholder = "Name" field.textContentType = .name field.autocapitalizationType = .words - NotificationCenter.default.addObserver( - forName: UITextField.textDidChangeNotification, object: field, queue: .main - ) { _ in save.isEnabled = !(field.text ?? "").trimmingCharacters(in: .whitespaces).isEmpty } + field.addAction( + UIAction { [weak field, weak save] _ in + save?.isEnabled = !(field?.text ?? "").trimmingCharacters(in: .whitespaces).isEmpty + }, for: .editingChanged) } alert.addAction(UIAlertAction(title: "Not Now", style: .cancel)) alert.addAction(save)