{"repo":"reddavis/Papyrus","free":true,"listed":false,"github":"https://github.com/reddavis/Papyrus","clone":"git clone https://github.com/reddavis/Papyrus.git","description":"Papyrus aims to hit the sweet spot between saving raw API responses to the file system and a fully fledged database like Realm.","language":"Swift","stars":28,"topics":["swift","ios","database","realm","coredata","macos","iphone","ipad","swiftui","cache"],"license":"MIT","category":"mobile-apps","readme_excerpt":"Papyrus Papyrus enables offline first applications by providing a simple object cache layer. Simple example Realworld example In this example, we're using a AsyncThrowingStream to pump through values. The general concept is that firstly we yield the cached data, perform the API request, yield the new objects and finally merge the new cached objects. Requirements - iOS 15.0+ - macOS 12.0+ - watchOS 6.0+ - tvOS 15.0+ Installation Swift Package Manager In Xcode: 1. Click Project . 2. Click Package Dependencies . 3. Click + . 4. Enter package URL: https://github.com/reddavis/Papyrus . 5. Add Papyrus to your app target. Documentation API Reference Usage Saving Anything that conforms to the Papyrus protocol can be stored. The Papyrus protocol is simply an umbrella of these three protocols: - Codable - Equatable - Identifiable where ID: LosslessStringConvertible Example A Example B - Merge A common use case when dealing with API's is to fetch a collection of objects and the merge the results into your local collection. Papyrus provides a function for this: Fetching by ID Fetching objects has two forms: - Fetch by id. - Fetch collection. Example A Example B Fetching collections Papryrus gives you the ability to fetch, filter and observe colletions of objects. Example A - Simple fetch Example B - Filtering Example C - Sorting Example D - Observing changes Calling stream() on a PapryrusStore.CollectionQuery object will return a AsyncThrowingStream which will emit the collection of obje","default_branch":null,"files":null,"tree":[],"storefront":"/r/reddavis","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/reddavis/Papyrus/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}