CapDatabase
class CapDatabase
A utility class to make Firebase communication and actions easy
-
Empty init
Declaration
Swift
init() -
Create an instance of CapDatabase with userID and get/set user information
Declaration
Swift
init(userID: String)Parameters
userIDunique user ID
-
Setup the initial user and user limit
Declaration
Swift
func setupUser()Return Value
Void
-
Update the user’s photo limit
Declaration
Swift
func photoLimit(callback: @escaping (Int)->())Parameters
callbacka callback function to return the current photoLimit
Return Value
Void
-
Update/Replace the user’s name
Declaration
Swift
func update(name: String)Parameters
namethe name to be updated/replaced
Return Value
Void
-
Accepts an image data to be uploaded and return its URL
Declaration
Swift
func uploadImage(imageData: Data, success: @escaping (_ url:String)->())Parameters
imageDatathe image data to be uploaded
successa callback function with url
Return Value
Void
-
Add a new image with text and name to Firebase
Declaration
Swift
func addNew(image data: Data, with text: String, with name: String, callback: @escaping ()->())Parameters
datathe image data to be uploaded
textthe text of the image (landmark text taken from WikiPedia).
namethe name of the image (landmark name)
callbacka callback for UI.
Return Value
Void
-
Get the user name
Declaration
Swift
func getName(_ callback: @escaping (String)->())Parameters
callbacka a callback function that returns the name of the user
Return Value
Void
View on GitHub
CapDatabase Class Reference