Skip to content

[Fix] Remove meaningless casting operators

Pre-release
Pre-release

Choose a tag to compare

@SHcommit SHcommit released this 20 May 07:37

[Fix] Remove wrong working casting operators

/// This protocol defines objects that can access Firestore.
public protocol FirestoreAccessible {
  var collectionRef: CollectionReference { get }
  var documentRef: DocumentReference? { get }
}

// MARK: - Helpers
public extension FirestoreAccessible {
  var asCollectionRef: CollectionReference? {
    return self as? CollectionReference
  }
  
  var asDocumentRef: DocumentReference? {
    return self as? DocumentReference
  }
}
  • remove asCollectionRef, asDocumentRef.

It can be used without a where condition, whether the implementation of firestoreAccessible refers to a Collection or Document Ref. In this case, an error occurred, so I removed this code.😅