ArchonLight ArchonLight - 1 year ago 134
Swift Question

Swift ! does not remove Optional()

Before, I have successfully added a ! to force an unwrap to remove the "Optional()" from a variable. I am unable to do this in data returned from

query.findObjectsInBackgroundWithBlock {
(objects: [AnyObject]!, error: NSError!) -> Void in
if error == nil {

for object in objects {

} else {
println("Error: \(error) \(error.userInfo!)")


In the example above, the entire table from the class is returned and printed to the console. However,


is returned for each line even though I force an unwrap using ! at the end

What am I missing?

(Note: myObject is the name of the Column in the Parse Class database)

Answer Source

MirekE was right. It was a nested Optional(Optional()).

to fix I:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download