Hi, I'm using this library in a brand new vanilla SwiftUI project and anytime I make a change to a file, the callback is getting triggered twice:
import FileWatcher
class ContentScreenViewModel: ObservableObject {
let filewatcher = FileWatcher(["/Users/aryamansharda/Documents/test.md"])
init() {
filewatcher.start() // start monitoring
filewatcher.callback = { event in
print("Something happened here: " + event.path)
}
}
}
struct ContentView: View {
@StateObject var viewModel = ContentScreenViewModel()
var body: some View {
VStack {
Text("Hello, world!")
}
.padding()
}
}
Something happened here: /Users/aryamansharda/Documents/test.md
Something happened here: /Users/aryamansharda/Documents/test.md
The file /Users/aryamansharda/Documents/test.md was renamed
The file /Users/aryamansharda/Documents/test.md was created
The file /Users/aryamansharda/Documents/calc/.git/HEAD was renamed
The file /Users/aryamansharda/Documents/calc/.git/HEAD was renamed