I am getting stuck, and this makes me crazy. I have a function that returns a NSManagedObject:

```
let getaccount = AccountModel.getFirst(globals.managedObjectContext)

```

and I have to cast it into its generated representation `Account`

I'll do this:

```
dump("--------------------")
dump(getaccount)
dump("--------------------")
if let acc = getaccount as? Account {
    print("OK")
} else {
    print("not convertable ")
}
dump("*********************")

```

And the output **FROM MY UNITTEST** looks like this:

```
- --------------------
▿ Ticketstream.Account
  ▿ Some: Coredataexampleapp.Account #0
    ▿ super: <Coredataexampleapp.Account: 0x138d85f90> (entity: Account; id: 0x1398a9fe0 <x-coredata://06F96EF3-96A6-4C32-A6A2-F16BCB8318EA/Account/p1> ; data: {
    active = 0;
    avatar =     (
    );
    config =     (
    );
    createdAt = "2015-07-31 23:34:58 +0000";
    displayName = "My Account (1)";
    host = localhost;
    lastUpdatedDate = "2015-07-31 23:34:58 +0000";
    password = nil;
    port = 8080;
    schema = HTTPS;
    username = "";
})
      - NSObject: <Coredataexampleapp.Account: 0x138d85f90> (entity: Account; id: 0x1398a9fe0 <x-coredata://06F96EF3-96A6-4C32-A6A2-F16BCB8318EA/Account/p1> ; data: {
    active = 0;
    avatar =     (
    );
    config =     (
    );
    createdAt = "2015-07-31 23:34:58 +0000";
    displayName = "My Account (1)";
    host = localhost;
    lastUpdatedDate = "2015-07-31 23:34:58 +0000";
    password = nil;
    port = 8080;
    schema = HTTPS;
    username = "";
})
- --------------------
not convertable 
- *********************

```

How to cast a **NSManagedObject** into **Account**?

I need this, because I can't get the first Account otherwise than:

```
class func getFirst(context: NSManagedObjectContext) -> NSManagedObject? {
    let request = NSFetchRequest(entityName: accountEntityName)
    request.fetchLimit = 1
    let list: NSArray = try! context.executeFetchRequest(request)
    return list.firstObject as? NSManagedObject
}

```

I've tried this with NSManagedObject, AnyObject and Account... How do i get the first Account the right way?

*UPDATE*: 
In normal running mode: **all is fine**! I'll get: 

```
- --------------------
OK
- *********************

```

But not from my tests :-( 

Thanks for your help, I am lost.