saoudrizwan / Disk

Delightful framework for iOS to easily persist structs, images, and data
MIT License
3.08k stars 170 forks source link

tvOS Support #51

Open JaydenIrwin opened 5 years ago

JaydenIrwin commented 5 years ago

Would it be possible to add tvOS support?

saoudrizwan commented 5 years ago

tvOS, watchOS, and macOS support is on the roadmap :^)

hemangshah commented 5 years ago

watchOS++

mrgrauel commented 5 years ago

@saoudrizwan when do you plan to add support?

craigrouse commented 5 years ago

@saoudrizwan As far as I can tell at first glance, the only things currently blocking tvOS and watchOS support are the helper functions for volumeAvailableCapacityForImportantUsage and volumeAvailableCapacityForOpportunisticUsage. Removing these allows Disk to compile successfully for watchOS and tvOS. Have I missed anything? Assuming not, I will gladly work on a PR to allow it to compile for all platforms, while retaining this important functionality for iOS.

Just wondering if you had anything else in mind that would potentially block this from working on tvOS/watchOS? Thanks, Craig.

Edit: I see UIKit is used also, which stops it working on macOS, but this is easily solved too.

hemangshah commented 5 years ago

@craigrouse - I think, this would be great! Didn't know if that would be really easy to handle? I hope @saoudrizwan will take this forward from here with you.

craigrouse commented 5 years ago

@hemangshah @mrgrauel @JaydenIrwin @saoudrizwan

I have added support for tvOS, macOS and watchOS on my fork: https://github.com/craigrouse/Disk/tree/platform-support

I'm in the process of updating the README to take account of some of the differences by platform (everything pretty much behaves the same, except tvOS, where I have removed the possibility to use the documents directory and application support, since these aren't really supported on tvOS). Be aware that on tvOS, the caches directory could be purged by the OS at any time when your app is closed, if the device is running low on space (see https://developer.apple.com/library/archive/documentation/General/Conceptual/AppleTV_PG/index.html#//apple_ref/doc/uid/TP40015241-CH12-SW5).

Feedback welcome! I have built support for all platforms into a single scheme, so when you complile, you can just select the device you want to build against, and the appropriate framework will be built for that platform. This works nicely with Carthage, too.

When I've finished the README, I will create a PR.

craigrouse commented 5 years ago

PR now opened: https://github.com/saoudrizwan/Disk/pull/72

Has anyone tried my updates yet? I look forward to your comments :)