Question: When a user registers on my app he gets an email. In this email is a link to activate/confirm his account.

My idea was: The database record has a field `activated (boolean)`, a field `activation code (objectid/guid)` and `id (objectid/guid)`.  

So the email would contain a link to

```
https://my.foo.bar.com/auth/activation/{userid}/{activationcode}

```

which would activate the account.

The actual question is: Is this secure (enough) ? I'm fairly new to authentication in general and I am not sure if this way is the correct way. Should I just use 2 activation codes instead of userid/activation code?

Answer: 
・If you use storyboard, make imageView unoptional like

```
@IBOutlet weak var UploadHiddenImage: UIImageView!

```

・Then unwrap the image of the imageView

```
var parseImageFile: PFFile?
if let image = UploadHiddenImage.image, 
    imageData = UIImageJPEGRepresentation(image, 0.5) {
    parseImageFile = PFFile(name:"ask_image.jpeg", data: imageData)
}

//use the parseImageFile with if let 
if let parseImageFile = parseImageFile {
} 

//or
parseImageFile?

```
You have a couple of options depending on your Swift version and how you want your code to look.

If you have Swift 2, the most elegant option will be to use a guard statement.

```
guard let image = self.UploadHiddenImage?.image else {
    return // or handle nil some other way
}

let imageData = UIImageJPEGRepresentation(image, 0.5)
let parseImageFile = PFFile(name:"ask_image.jpeg", data: imageData)

```

You can also use an if let statement:

```
if let image = self.UploadHiddenImage?.image {
    let imageData = UIImageJPEGRepresentation(image, 0.5)
    let parseImageFile = PFFile(name:"ask_image.jpeg", data: imageData)
}

```