Reputation: 457
Tearing my hair out on this one.
I'm trying to pass a dictionary of type [String:UIView] to a function in swift that's expecting a [NSObject:AnyObject] :
NOTE: I get the exact same error if I use NSString instead of String:
Any ideas what I'm doing wrong?
opponentImageView is a UIImageView....
PROBLEM RESOLVED
turns out the issue was actually with the 'options' argument being passed 0. Passing NSLayoutFormatOptions(0) made this misleading error go away. Here is what the code now looks like:
It builds fine now...
Upvotes: 0
Views: 807
Reputation: 37189
There is some problem when you try to cast String
as NSObject
implicitly in pure swift class. You need to define it explicitly
let viewsDict:[NSObject:AnyObject] = ["yourview":view]
and there is one error more options
can not be 0
.So define options
as proper NSLayoutFormatOptions
type.
Upvotes: 2