I have a model object written in Objective-C, which has a property of the type `NSMutableArray`.

It can either be `nil` or has a valid object reference.

I am using bridging header and I have a few files written in Swift.

In the Swift file I want to iterate through the objects in the array, only if it has something in it.

How can I achieve this?

I have tried things such as:

```
   if let a = MyObj.myArray {
   }
   if(MyObj.myArray != nil) {
   }
   if(MyObj.myArray != NSNull()) {
   }

```

I finally got the hang of optionals in Swift code alone, but I am not able to understand the behavior when I am passing around objects written in Objective-C in Swift code.

My Actual Code Looks like this :
Code :

```
if let values = attribute.values {
    for val in values {
        print(val);
    }
    return true;
}

Exception:

-[NSNull countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance

```