hwaxxer / mhwdirectorywatcher Goto Github PK
View Code? Open in Web Editor NEWA lightweight class for monitoring a directory for changes on iOS.
License: MIT License
A lightweight class for monitoring a directory for changes on iOS.
License: MIT License
I had the need to monitor the changes in the Documents Folder for this open-source app, this project looked exactly what I was looking for, so I made a swift version out of it.
It would be great if you can review it, and if it checks out, if you would consider linking it in the README
for those looking for a Swift implementation
Cocoapods is showing the latest version of this library as 0.0.6. Mind publishing the latest versions to Cocoapods? Thanks!
If ~10 files get transferred from iTunes, is there a way for the program to know that shows that files are currently transferring? could this be added as a callback?
Hello,
I've been using MHWDirectoryWatcher for years, it's cool, thank you!
I found Apple has its own solution in a sample project DocInteraction, it uses "Kernel Queues" to get notifications of file system events.
It's reacts immediately, but it doesn't consider the situation that files are modifying. So after the modifying is finished, it doesn't get updated...
I'm wondering if it's possible to combine both advantages of MHWDirectoryWatcher and Kernel Queues in the future updates?
Sincerely.
Hi,
I see that the example shown in the README makes use of "weak self" to avoid retain cycles, but it is not necessary because the object retaining the block isn't self but the class MHWDirectoryWatcher
// Avoid a retain cycle
__weak typeof(self) weakSelf = self;
_dirWatcher = [MHWDirectoryWatcher directoryWatcherAtPath:kDocumentsFolder callback:^{
// Actions which should be performed when the files in the directory
[weakSelf doSomethingNice];
}];
Reference: http://stackoverflow.com/questions/20030873/always-pass-weak-reference-of-self-into-block-in-arc.
Also: there is no need to restrict the podspec to iOS only. It works equally on OS X as well, but you won't be able to use it with CocoaPods because of this.
Other than that, keep up the good work :)
Hi,
I am having some build issues with the: __weak typeof(self) weakself = self;
I am using Xcode 6.3 and the LLVM 6.1 compiler
I used __weak id weakself = self instead but it would be nice to know if there is a configuration I'm missing to make it work as intended
Thanks
PS: very useful, thanks for your effort
I would like to be informed when a file was deleted, added or renamed by getting the file name and the action (delete, added, renamed). Is this possible with the current implementation of MHWDirectoryWatcher
? Right now it seems only inform me about a change in a monitored directory without any specification about the kind (file deleted, file added, file renamed etc.) and without any further file information (like filePath etc.)
Do you have any code samples how to implement the behaviour described above?
Thanks in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.