0

I am designing an App for iOS using Swift 2.0, Basically my user uploads some photos to a gallery and tag the photos later. This is not a Social App, therefore only the user himself can see these photos. When the user uploads the photos, I want to store them locally somewhere because:

  • First, When the user opens the app again at a later time, and decides to browse through and tags stuff, he doesn't have to download them again.
  • Second, When he logs into another iOS device, the app should download the photos locally to the new device too and use them as cached.

So the solution should allow local caching of images, at the same time since the user may upload tons of photos, I should be selective about how many to cache locally, for instance, I think I need to have something like cache expiry in HTML, so if I hit "Let's say 50MB of local photos on device" I should wipe off the old ones until the limit goes back to 50MB.

I would like to get some expert advice on how to this.

AlexCon
  • 1,127
  • 1
  • 13
  • 31
  • http://stackoverflow.com/questions/14531912/storing-images-locally-on-an-ios-device heres some info that might help you get started – Will M. Jun 26 '15 at 17:45

1 Answers1

-2

I have created a library using swift 2 to do the request for image and cache it. it's very simple just give it a try.

https://github.com/georgehadly/GHImageCaching

all you can do is something like this ,

viewImg.getCachedImage("geo", URI: NSURL(string: "https://s-media-cache-ak0.pinimg.com/236x/8e/5a/98/8e5a98795dc2c5322cac97343a6cad6d.jpg")!) { (done) -> Void in
        if(done){
            // your extra
        }
    }

in case you want to delete all cached images

UIImageView.deleteAllCaching()
George Hanna
  • 354
  • 1
  • 19