ios - How to check the content availability of a URL -


i'm creating app has uitableview. when user selects 1 row, transitions content page has image slider , content. there can minimum of 0 , maximum of 4 images per item.

when loading inner page, i'm checking image availability using method:

func validateurl (stringurl : nsstring) -> bool {      let url = nsurl(string: stringurl string)     if (nsdata(contentsofurl: url!) ==  nil){         return false     }     else{         return true     }  }  

it's simple method proper output , works, takes lot of time , because of have load images twice (one method , second time display them).

is there better way this?

i add method code catch data received from

nsdata(contentsofurl: url!) 

for example map url key , data object. way, display picture first check map , if it's not there download it


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -