Rate My Talk: Hacking Cloud Kit and iOS 8 Extensions
The first day of #NSSpain, together with @bogdanIusco, @mirceaSV, @Eldorado234, @sofokli1 we made an app that allows to rate the Talks. It was a TON of Fun and we *almost* :( won.
E TA S K S • @stuffmc: CloudKit • @bogdanIusco: CloudKit • @mirceaSV: UICollectionViewController • @Eldorado234: Research on iPhone • + @sofokli1 + People not being on Twitter (Yes, they exist!)
C L O U D K I T let publicDB = CKContainer.defaultContainer().publicCloudDatabase let talkRecord = CKRecord(recordType: "Talks") talkRecord.setValue(attributes[3], forKey: "name") publicDB.saveRecord(talkRecord, completionHandler: { (savedTalk, error) -> Void in println("\(savedTalk) has no \(error)") })
K S func fetchAllTalks(finishCallback: (Array<Talk>) -> Void) { let predicate = NSPredicate(value: true) let query = CKQuery(recordType: “Talks”, predicate: predicate) query.sortDescriptors = [NSSortDescriptor(key: "begin", ascending: true)] publicDB.performQuery(query, inZoneWithID: nil) { (records, error) -> Void in self.allTalks = Array<Talk>() for record in records { let talk = Talk(record: record as CKRecord) self.allTalks?.append(talk) } dispatch_async(dispatch_get_main_queue(), { () -> Void in finishCallback(self.allTalks!) }) } }