ios - NSObject unable to convert -


i getting errors on following lines of code. since project downloaded github,https://github.com/hubspot/bidhub-ios not sure these lines doing.

  let 1 = nsmutableattributedstring(string: "bid\n", attributes: bidattrs [nsobject : anyobject] [nsobject : anyobject] )     one.appendattributedstring(nsmutableattributedstring(string: "$\(startamount + incrementone)", attributes: otherattrs))     plusonebutton.setattributedtitle(one, forstate: .normal)      let 5 = nsmutableattributedstring(string: "bid\n", attributes: bidattrs [nsobject : anyobject] [nsobject : anyobject])     five.appendattributedstring(nsmutableattributedstring(string: "$\(startamount + incrementfive)", attributes: otherattrs))     plusfivebutton.setattributedtitle(five, forstate: .normal)      let ten = nsmutableattributedstring(string: "bid\n", attributes: bidattrs [nsobject : anyobject] [nsobject : anyobject])     ten.appendattributedstring(nsmutableattributedstring(string: "$\(startamount + incrementten)", attributes: otherattrs))     plustenbutton.setattributedtitle(ten, forstate: .normal) 

error follows

/users/david/desktop/ios_app/bid-hub-app/ios-app/bidhub-ios-master/auctionapp/biddingvc/biddingviewcontroller.swift:104:109: cannot convert value of type '[nsobject : anyobject]' expected argument type '[string : anyobject]?' /users/david/desktop/ios_app/bid-hub-app/ios-app/bidhub-ios-master/auctionapp/biddingvc/biddingviewcontroller.swift:112:109: cannot convert value of type '[nsobject : anyobject]' expected argument type '[string : anyobject]?' /users/david/desktop/ios_app/bid-hub-app/ios-app/bidhub-ios-master/auctionapp/biddingvc/biddingviewcontroller.swift:108:110: cannot convert value of type '[nsobject : anyobject]' expected argument type '[string : anyobject]?' 

so before suggest me remove

as [nsobject : anyobject] 

already tried that, , gives following error

/users/david/desktop/ios_app/bid-hub-app/ios-app/bidhub-ios-master/auctionapp/biddingvc/biddingviewcontroller.swift:104:74: 'nsdictionary' not implicitly convertible '[nsobject : anyobject]'; did mean use 'as' explicitly convert? 

edit:

var bidattrs = [nsfontattributename : uifont(name: "avenir-light", size: 14.0)! , nsforegroundcolorattributename: uicolor.graycolor()] nsdictionary 

you don't need cast bidattrs nsdictionary, this:

var bidattrs = [nsfontattributename : uifont(name: "avenir-light", size: 14.0)! , nsforegroundcolorattributename: uicolor.graycolor()] let 1 = nsmutableattributedstring(string: "bid\n", attributes: bidattrs ) 

however, if need nsdictionary reason, casting should this:

let 1 = nsmutableattributedstring(string: "bid\n", attributes: bidattrs as? [string : anyobject] ) 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -