Guest User

Untitled

a guest
Jan 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. @IBAction func saveButton(_ sender: Any) {
  2. db.collection("violets").document(plantName.text!).setData([
  3. "Plant Name": "(plantName.text ?? "")",
  4. "Hybridizer": "(hybridizer.text ?? "")",
  5. "Registration Number": Int("(registrationNumber.text ?? "")"),
  6. "Type": "(type.text ?? "")",
  7. "Description": "(generalDescription.text ?? "")",
  8. "Notes": "(notes.text ?? "")"
  9. ]) { err in
  10. if let err = err {
  11. print("Error writing document: (err)")
  12. } else {
  13. print("Document successfully written!")
  14. }
  15. }
  16.  
  17. uploadImage(violetImage.image!)
  18.  
  19. }
  20.  
  21. service cloud.firestore {
  22. match /databases/{database}/documents {
  23. match /{document=**} {
  24. allow read: if request.auth.uid != null;
  25. allow write: if request.auth.uid != null && !exists(resource.data)
  26. }
  27.  
  28. }
  29. }
Add Comment
Please, Sign In to add comment