-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPost.swift
39 lines (34 loc) · 1.22 KB
/
Post.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// Post.swift
// selfiegram
//
// Created by stopo on 2016-01-14.
// Copyright © 2016 stopo. All rights reserved.
//
import Foundation
import UIKit
import Parse
class Post: PFObject, PFSubclassing {
@NSManaged var image:PFFile
@NSManaged var user:PFUser
@NSManaged var comment:String
var likes: PFRelation! {
// PFRelations are a bit different from other properties
// This is called a “computed property”, because it’s value is computed every time instead of stored.
// The line below specifies that our relation column on Parse.com should be called “likes”
return relationForKey("likes")
}
// convenience init method, because it’s building on top of PFObject’s init, rather than overriding it.
convenience init(image:PFFile, user:PFUser, comment:String){
// You can name the property you are passing into the function the
// same name as the class' property. To distinguish the two
// add "self." to the beginning of the class' property.
self.init()
self.image = image
self.user = user
self.comment = comment
}
static func parseClassName() -> String {
return "Post"
}
}