Post

Replies

Boosts

Views

Activity

Remove items in Fileprovider
After I receive an apns request. func enumerateItems(for observer: NSFileProviderEnumerationObserver, startingAt page: NSFileProviderPage) will be called. And I start fetch new items from my server. If new items have been deleted something that old items which already showed to the user contains. These have been deleted items will not disappear on the screen. func enumerateItems(for observer: NSFileProviderEnumerationObserver, startingAt page: NSFileProviderPage) {         task = Task {             do {                 let flat = MediaItemReference.flat(enumeratedItemIdentifier == .rootContainer ? root : enumeratedItemIdentifier.rawValue)                 guard let uuid = UUID(uuidString: flat.identifier) else {                     observer.finishEnumeratingWithError(FileProviderError.other)                     return                 }                 let fileContents = try await WebApi.getSubForFileProvider(uuid)                 let refs = fileContents.map { fileContent -> MediaItemReference in                     InfoPool.shared.set(fileContent.uuid.uuidString, value: fileContent)                     return MediaItemReference(                         identifier: fileContent.uuid.uuidString,                         isDirectory: fileContent.isDictionary,                         filename: fileContent.name,                         father: uuid.uuidString)                 }                 let items = refs.map(FileProviderItem.init(reference:))                 observer.didEnumerate(items)                 observer.finishEnumerating(upTo: nil)             } catch {                 print("=>", error.localizedDescription)                 observer.finishEnumeratingWithError(error)             }         }     }
1
0
1.4k
Feb ’22
Use Live Text in SwiftUI
Menu {                 Button(action: {                     // TODO: support live text                 }) {                     Label("Live Text", systemImage: "camera.viewfinder")                 }             } label: {                 Text("Hi")             } How can I present the live text view in swiftUI
1
0
1.3k
Sep ’21