1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Swift] Firebase Firestoreデータを削除する方法

Posted at

[Swift] Firebase Firestoreデータを削除する方法

[1] コレクションを削除する。

ViewContoroller.swift
import FirebaseFirestore

Firestore.firestore().collection("[コレクション名]").getDocuments { (snapshot, error) in
            if let error = error{
                print("エラー",error)
                return
            }
         
            for document in snapshot!.documents{
                document.reference.delete()
            }
            
     }



[2] ドキュメントを削除する。

ViewContoroller.swift
 Firestore.firestore().collection("[コレクション名]").document("[document]").delete()

参考記事

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?