wordpress-mobile / wordpress-mobile/AztecEditor-iOS

Provide default implementations for optional TextViewAttachmentDelegate functions

Offen
#998 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

[Type] Enhancement
Vorherrschende Sprache
Swift
Sterne
669
Forks
153
Ø Merge
11 Std. 27 Min.
Gemergte PRs (30 T.)
4

Beschreibung

Expected behavior

Some functions of the TextViewAttachmentDelegate protocol should be considered optional since the functionality they provide is not required for many instances of a TextView. Specifically, the selection and deselection functions are not necessary if the text view is not providing any custom behavior for these actions (for example, relying on the delete key to remove the attachment, and not providing any additional attachment features).

These should be made optional by providing an empty default implementation in an extension to TextViewAttachmentDelegate:

extension TextViewAttachmentDelegate {
	func textView(_ textView: TextView, selected attachment: NSTextAttachment, atPosition position: CGPoint) { }
	func textView(_ textView: TextView, deselected attachment: NSTextAttachment, atPosition position: CGPoint) { }
}
Actual behavior

The selection and deselection functions are unnecessarily required by any object conforming to TextViewAttachmentDelegate.

Steps to reproduce the behavior

Conform to TextViewAttachmentDelegate and attempt to compile without implementing the two mentioned functions.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das Protokoll TextViewAttachmentDelegate zu finden und seine Anforderungen für Auswahl und Aufhebung der Auswahl zu überprüfen. Füge die in der Erweiterungsbeispiel des Issues beschriebenen Standardimplementierungen hinzu und überprüfe anschließend, dass ein konformer Typ kompiliert werden kann, ohne diese beiden Funktionen zu implementieren.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
swift
Bereich
mobile
Issue-Typ
Feature
Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.