korhan-Ö
11/5/2016 - 8:35 AM

#Image Operation

func loadImageFromPath(imageName: String) -> UIImage? {
    
    
    let image = UIImage(contentsOfFile: imageName)
    
    if image == nil {
        
        print("missing image at: (path)")
    }
    print("\(imageName)") // this is just for you to see the path in case you want to go to the directory, using Finder.
    return image
    
}
func downloadImage (url:String, imagePath: String) {
        
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0)) {

            
            dispatch_async(dispatch_get_main_queue()) {


                return
            }
        }
    }
ivIcon.image = UIImage(named: "iron")

alienImage.image = UIImage(named: "image1.png")
func checkImageLocation (imagePath:String) -> Bool{
        let paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as String
        
        let getImagePath = paths.stringByAppendingString(imagePath)
        
        let checkValidation = NSFileManager.defaultManager()
        
        if (checkValidation.fileExistsAtPath(getImagePath))
        {
            // FILE AVAILABLE
            return false
        }
        else
        {
            //FILE NOT AVAILABLE
            return true
        }
    }