evgenyneu / Auk

An image slideshow for iOS written in Swift.
MIT License
277 stars 44 forks source link

Using different download manager #48

Closed sakicnet closed 7 years ago

sakicnet commented 7 years ago

Hello,

Would you consider decoupling Auk from moa and allow for using different image download library, like SDWebImage or AlamofireImage?

I made a switch to SDWebImage myself, only because it is used by another library and they can share the cache this way. Besides, no need to use multiple libraries in the same app that do the same thing.

I could make a PU with what I have if you like.

Thanks.

evgenyneu commented 7 years ago

Hello @sakicnet, this is a very good point about sharing the cache with the rest of the app. Thank you for the idea. There was already a setting in Moa for the cache directory. However, it was an internal property. I have made it public in the latest 8.0.2 version of moa.

Here is how to use it:

import moa
...
Moa.settings.cache.diskPath = "MyAppSharedCache"

Moa uses URLSession for networking and caching. The cache directory should be shared if your other libraries use URLSession as well.

As for your main question, removing moa dependency from Auk is a very reasonable thing to do. However, I want to keep Auk integrated with moa for the following reasons:

  1. It provides an easy way to setup and use the library. This is especially important for beginner iOS programmers.
  2. Everything "just works", because it comes from one source. It is important in iOS because, as the Xcode and Swift progresses, both libraries are updated at the same time making sure they work nicely together.
  3. In the future I am planning to do some additions to Auk that would be much easier to implement if I have control of the image downloader as well and not limited by the dependency on the other downloaders that may not all have needed capabilities.

To summarise, your proposal is very sound and it has many advantages. However, for now, I would like the two libraries to stay integrated for simplicity of usage and code maintenance. Let me know if you agree or disagree.

sakicnet commented 7 years ago

Hi Evgenii,

Thanks for the cache settings. Unfortunately I have to use Swift 2.3 and older version for the moment (want to maintain compatibility with iOS 8 and major libraries that switched to Swift 3 already dropped support for iOS 8).

I agree 100% with your arguments. Ideally moa would be included while you would have an option to remove it and use another library. But I understand it would probably cause more problems than it's worth. Thankfully, it's easy enough to fork it and do the necessary changes.

Anyway, thanks for the great library and keep up the good work!

evgenyneu commented 7 years ago

Thank you @sakicnet. I hope developers would not drop iOS 8.0 versions so early, given that it still has nearly 10% usage, which is millions of people. And yes, good idea about opening the Auk API for other downloaders, I will keep it in mind. Good luck with your project.

evgenyneu commented 7 years ago

Closing the issue, feel free to reopen if needed.