Created
April 8, 2016 00:26
-
-
Save gtokman/38c898d6a202cbf2e14fffff0b9260e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
protocol PostGateway { | |
func getPosts(completion: (String) -> Void) | |
} | |
protocol getPosts { | |
func addPost(postID: String) | |
func removePost(postID: String) | |
func comment() | |
} | |
class User { | |
var userName: String! | |
var gateway: PostGateway | |
init(userName: String, gateway: PostGateway) { | |
self.userName = userName | |
self.gateway = gateway | |
} | |
class func addAnomUser() { | |
// insert code here for adding a Anom user. | |
// gateway.add | |
} | |
class func deleteUser() { | |
// insert code here for deleting the Anom user. | |
// gateway.delete | |
} | |
class func addPhotoPermission() { | |
} | |
class func encodeUserPhoto(image: UIImage) { | |
/* | |
Code for adding picture to Firebase. | |
var base64String: NSString! | |
var uploadImage = image | |
var imageData: NSData = UIImagePNGRepresentation(uploadImage)! | |
base64String = imageData.base64EncodedStringWithOptions(.Encoding64CharacterLineLength) | |
*/ | |
} | |
} | |
class Post: User { | |
var post = [String]() | |
var timeStamp = "Time" | |
var upVote = 0 | |
var comment = [String]() | |
var author = "User" | |
var location = "Location" | |
class func dateFormatter() { | |
// Insert code here for formatting the date. | |
} | |
class func addVoteToPost() { | |
// Insert code here to increment and decrement votes of post. | |
} | |
class func deletePost() { | |
// Insert code here to delete the post from Firebase. | |
} | |
class func addPost() { | |
// Insert code here to add post to Firebase. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment