Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support iOS7 #111

Closed
jmacmullin opened this issue Oct 20, 2014 · 33 comments
Closed

Support iOS7 #111

jmacmullin opened this issue Oct 20, 2014 · 33 comments

Comments

@jmacmullin
Copy link

Swift apps can run on iOS7. It'd be nice if I could still use HanekeSwift on iOS7 too. Obviously iOS7 doesn't support frameworks so including Haneke in my app won't be as simple, but is there any reason Haneke wouldn't work on iOS7? Or you using (or planning to use) iOS8 specific APIs?

@hpique
Copy link
Member

hpique commented Oct 20, 2014

Hi @jmacmullin.

It's more than we don't want to deal with testing or any problems that supporting iOS 7 might entail. Personally, I haven't even tried it.

The tests might not run in iOS 7 because they use the new expectations API. Other than that, nothing specific comes to mind. We're using the latests and greatest Swift APIs, that's for sure.

If you manage to get Haneke working in iOS 7 because you need it, please let me know and I'll add your fork to the readme.

@hpique
Copy link
Member

hpique commented Nov 7, 2014

Forgot to mention that frameworks don't work in iOS 7. So getting Haneke to work there will imply manually adding the files to your project, perhaps with some namespacing modification.

Reopening this issue as many people are asking for it. I'm not particularly proud of forgoing iOS 7 compatibility, even more so after the lackluster iOS 8 adoption rate, but I have to pick my battles. That said, if someone is willing to take the lead on this I'll be more than happy to help.

@hpique hpique reopened this Nov 7, 2014
@hpique hpique mentioned this issue Nov 7, 2014
@kutschenator
Copy link

Will look into this, but I will be gone for the next 2 weeks. Will start when I come back

@dmendis
Copy link

dmendis commented Nov 17, 2014

Anyone had any luck getting this going?

@yinear
Copy link

yinear commented Dec 2, 2014

Still 35% of devices are using iOS 7. It's better to cover them.

@hpique
Copy link
Member

hpique commented Dec 3, 2014

@yinear I'll be leaving this up to the Haneke userbase. As I mentioned, if someone takes the lead I will gladly help.

@dmendis
Copy link

dmendis commented Dec 3, 2014

If anyone's interested, I wrote something extremely simple/basic for my app because I really needed the iOS7 support. It would serve as a starting point for anyone wanting to support iOS7 and desperate for something (like I was). Haneke would still be the best choice if anyone gets it working in iOS7!
Blog post: http://dinethmendis.com/blog/swift-image-cache-compatible-with-ios7
Code: https://github.com/m2d2/SimpleImageCache

@kutschenator
Copy link

Hi, I just did a quick test and dropped the haneke folder into my iOS7 project.
Then I copied the files from the demo and it seems to work, no magic here.
https://github.com/eyeballz/HanekeSwiftiOS7Test

@hpique
Copy link
Member

hpique commented Dec 6, 2014

Thanks @eyeballz!

@kutschenator
Copy link

OK, I played around with it for a little bit and the main problem we have here is that we will clutter our iOS7 app with about 15 top level classes/structs.

The workarounds i see here are:

  1. Put the whole thing in a struct and simulate a namespace (Alamofire recommends this)
    --> this does NOT work for Haneke I think, since you cannot nest generic classes in a struct.
  2. Prefix those top level classes with something like HNK
    --> will work but is a lot of refactoring for every version and the usage will be slightly differnt

@kutschenator
Copy link

The top level classes that might collide with other frameworks are:

(G) Cache
DataConvertible
DataRepresentable
JSON
DiskCache
(G) DiskFetcher
(G) FetchState
(G) Fetch
(G) Fetcher
(G) SimpleFetcher
(G) Format
ImageResizer
HanekeGlobals (Not really dangerous)
Shared
Log
(G) NetworkFetcher

(G) means generic class, so those cannot be nested

@kutschenator
Copy link

Phew... I refactored the whole project with the following idea:
Keep HanekeGlobals
Prefix generic classes and protocols with HNK
Wrap normal classes in the Haneke struct

Tests are still working.
Now it should be safer to just include the whole folder. I will do some "real life" tests in the next days

You can check it out at:
https://github.com/eyeballz/HanekeSwift

@kutschenator
Copy link

Allright, I updated the https://github.com/eyeballz/HanekeSwiftiOS7Test to use the forked Haneke Swift repository at https://github.com/eyeballz/HanekeSwift
Works fine. Feedback appreciated.

@hpique
Copy link
Member

hpique commented Dec 7, 2014

@eyeballz Awesome! Do all unit tests pass?

@kutschenator
Copy link

Yes, unit tests still pass. I wanted to put everything in one file, to make it easier to import but SourceKit had a problem with that and kept on crashing.
How should we make this available for others?

@AvdLee
Copy link

AvdLee commented Jan 15, 2015

Any news on this? I'm thinking to implemented HanekeSwift instead of SDWebImage, but I need iOS 7 support for this.

@kutschenator
Copy link

you can use my fork which works for iOS7
i don't think Haneke Swift will officially support iOS7 since there are a lot of drawbacks.

@fabdarice
Copy link

Hi @eyeballz
I've used your fork to copy the Haneke folder into my project and I'm having this error that affects a lot of my files :
"'JSON' is ambiguous for type lookup in his context".
Do you have any idea why and how to fix it?
Very much appreciate thanks

@kutschenator
Copy link

Hey @fabdarice ,
since you are using ios 7 there is no namespacing. That means all your classes live in one big namespace. My guess is that you have another class from another library named JSON aswell and that it is conflicting.

@fabdarice
Copy link

Thanks @eyeballz .
Indeed I'm was using SwiftJSON which has a JSON struct too.
I end up renamed all JSON to JSON_SWIFTY and it solves the problems. Thanks a lot!

@dwoshadha
Copy link

Hi @eyeballz ,
I was working on this and it worked perfectly. After the xcode 6.3 with swift 1.2 release it give me errors. Could you please help me on this? Thanks a lot.

@thomascsorbamedia
Copy link

@dwoshadha, try comparing your version of Haneke with the original code and replace the functions that are giving errors for most of the errors this will solve it. The only error that remains for me is in this function and i can't seem to figure it out. Maybe someone can have a look?

in Cache.Swift

public init(name : String) {
    self.name = name

    let notifications = NSNotificationCenter.defaultCenter()
    // Using block-based observer to avoid subclassing NSObject
    memoryWarningObserver = notifications.addObserverForName(UIApplicationDidReceiveMemoryWarningNotification,
        object: nil,
        queue: NSOperationQueue.mainQueue(),
        usingBlock: { [unowned self] (notification : NSNotification!) -> Void in
            self.onMemoryWarning()
        }
    )

    var originalFormat = HNKFormat<T>(name: HanekeGlobals.Cache.OriginalFormatName)
    self.addFormat(originalFormat)
}

usingBlock: { [unowned self](notification : NSNotification!) -> Void in self.onMemoryWarning() }
gives the error

SOLVED my own issue, change
let memoryWarningObserver : NSObjectProtocol!
above this function to
var memoryWarningObserver : NSObjectProtocol!
and then it should al work again

@oshadha
Copy link

oshadha commented Apr 26, 2015

@eyeballz is there a way that I can show a default image while it loads the actual. Do we have a default function for that?

@oshadha
Copy link

oshadha commented Jul 14, 2015

@eyeballz I converted the Haneke iOS7 to work with xCode 6.4 and Swift 1.2. I wanna push it. Please let me know how can I do that.

@seenickcode
Copy link

@eyeballz , any update on this or what @oshadha has done? Thanks.

@oshadha
Copy link

oshadha commented Sep 21, 2015

Hi @seenickcode , Please let me know if you wanna have Swift 1.2 converted code.

@seenickcode
Copy link

Yes please!

On Mon, Sep 21, 2015 at 5:05 AM, Oshadha notifications@github.com wrote:

Hi @seenickcode https://github.com/seenickcode , Please let me know if
you wanna have Swift 1.2 converted code.


Reply to this email directly or view it on GitHub
#111 (comment).

@kutschenator
Copy link

Hey, you can also make a pull request here https://github.com/eyeballz/HanekeSwift
then i will accept it

@oshadha
Copy link

oshadha commented Sep 22, 2015

@seenickcode just drop me a mail. oshadha@gmail.com

@oshadha
Copy link

oshadha commented Sep 22, 2015

hi @eyeballz , When I try to sync it give me following error:
fatal: unable to access 'https://github.com/eyeballz/HanekeSwift.git/': Empty reply from server
(128)

Please advise me.

@kutschenator
Copy link

Just fork it and then commit the changes there. dont even have to create a pull request then

@oshadha
Copy link

oshadha commented Sep 27, 2015

I was trying to upload my Swift 1.2 changes as new branch and it keeps me saying that "Authentication Failed"

@hpique
Copy link
Member

hpique commented Jan 7, 2016

Closing this as it's less and less likely that new people will find it helpful.

@hpique hpique closed this as completed Jan 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests