wordpress-mobile / wordpress-mobile/AztecEditor-iOS

Provide default implementations for optional TextViewAttachmentDelegate functions

Aperta
#998 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

[Type] Enhancement
Lingua principale
Swift
Stelle
669
Fork
153
Merge medio
11h 27m
PR unite (30g)
4

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia individuando il protocollo TextViewAttachmentDelegate e verifica i suoi requisiti di selezione e deselezione. Aggiungi le implementazioni predefinite descritte nell’esempio di estensione dell’issue, quindi verifica che un tipo conforme possa essere compilato senza implementare queste due funzioni.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
swift
Ambito
mobile
Tipo di issue
Funzionalità
Difficoltà
1/5
Tempo stimato
Meno di un'ora
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.