https://github.com/maxvol/combineondemandresources
Access to on-demand resources via Combine
https://github.com/maxvol/combineondemandresources
Last synced: over 1 year ago
JSON representation
Access to on-demand resources via Combine
- Host: GitHub
- URL: https://github.com/maxvol/combineondemandresources
- Owner: maxvol
- License: mit
- Created: 2021-06-30T09:40:13.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-30T10:17:24.000Z (almost 5 years ago)
- Last Synced: 2025-01-10T08:09:01.255Z (over 1 year ago)
- Language: Swift
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CombineOnDemandResources
Access to on-demand resources via Combine
Example:.
```swift
Bundle
.main
.demandResources(withTags: ... ) // tags: Set
.sink(receiveCompletion: { completion in
switch completion {
case .failure(let error):
print(error)
case .finished:
print("done")
if let url = Bundle.main.url(forResource: file, withExtension: "") {
os_log("url: %@", log: Log.odr, type: .info, "\(url)")
// TODO use your resource
}
}
},
receiveValue: { progress in
self.showProgress(progress: Float(progress.fractionCompleted)) // declare your handler first
})
.store(in: &self.cancellables) // cancellables: Set
```