Guest User

Untitled

a guest
Jan 14th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. func FetchRecords(user_name: String, password: String) -> Int {
  2. let pubData = CKContainer.default().publicCloudDatabase
  3. let predicate = NSPredicate(format: "Username = %@", user_name)
  4. let query = CKQuery(recordType: "Teachers", predicate: predicate)
  5. let operation = CKQueryOperation(query: query)
  6. var Pwd = String()
  7. var count = Int()
  8. operation.recordFetchedBlock = { (record : CKRecord!) in
  9. let Pwd: String = record["Password"] as! String
  10. if Pwd == password{
  11. count=1
  12. }else{
  13. count=0
  14. }
  15. }
  16. operation.queryCompletionBlock = { cursor, error in
  17. }
  18.  
  19. CKContainer.default().publicCloudDatabase.add(operation)
  20. return count
  21. }
Add Comment
Please, Sign In to add comment