Downcast from AnyObject to UIImage[] - Swift -



Downcast from AnyObject to UIImage[] - Swift -

i'm trying convert results of valueforkeypath array of uiimages. when trying met error

undefined symbols architecture i386: "ttofc9tableview19tableviewcontrollers6photosgsqgsacso7uiimage", referenced from: __tfc9tableview29justpostedtableviewcontroller11fetchphotosfs0_ft_t_ in justpostedtableviewcontroller.o ld: symbol(s) not found architecture i386 clang: error: linker command failed exit code 1 (use -v see invocation)

here's effort @ code in swift: propertylistresults nsdictionary, , parameter in valueforkeypath string

var photos : anyobject = (propertylistresults anyobject).valueforkeypath(flickrfetcher.flickr_results_photos) self.photos = photos as? uiimage[]

and working objective-c version of code is

nsarray *photos = [propertylistresults valueforkeypath:flickr_results_photos]; self.photos = photos

if run swift-demangle on "__ttofc9tableview19tableviewcontrollers6photosgsqgsacso7uiimage__" get:

@objc tableview.tableviewcontroller.photos.setter : (objectivec.uiimage[])?

that means linker not finding setter photos on tableviewcontroller. seems using tableviewcontroller instead of own subclass has photos property.

also, photos as? uiimage[] returns optional because possible fail. should following:

if allow images : [uiimage] = photos as? [uiimage] { self.photos = images }

this checks if photos can converted [uiimage]. if can, assigns self.photos

edit: updated uiimage array syntax new array syntax in beta 3

uiimage swift downcasting

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -