Question: I am getting this error.I have found similar code.I try to fix but I can't.Here is my code 

```
    let path = docDir.stringByAppendingPathComponent(dbName)
    let fm = NSFileManager.defaultManager()
    if !(fm.fileExistsAtPath(path)) {

if let from = (NSBundle.mainBundle().resourcePath! as NSString).stringByAppendingPathComponent(dbName)

{
             var error:NSError?
             do {
                try fm.copyItemAtPath(from, toPath: path)
            } catch let error1 as NSError {
                error = error1
                print("SQLiteDB - failed to copy writable version of DB!")
                print("Error - \(error!.localizedDescription)")
                return 
            }
        }
    }

```

The error is on line

```
if let from = (NSBundle.mainBundle().resourcePath! as NSString).stringByAppendingPathComponent(dbName)

```

report the error:

> 
> Initializer for conditional binding must have Optional type, not 'String'
> 
> 
> 

Somebody help me please . Thank a lot

Answer: 
please specify the Variable type 

```
 if let imageURL:String = array[indexPath.row].absoluteString {
    //Do something
    }

```
It because `stringByAppendingPathComponent` returns just a `String`, not optional string `String?`. So you cannot unwrap this `String` within `if let` use just `let`

```
func stringByAppendingPathComponent(_ str: String) -> String

```

---

```
let from = (NSBundle.mainBundle().resourcePath! as NSString).stringByAppendingPathComponent(dbName)

var error:NSError?
    do {
        ...

```