Swiftpack.co -  vexy/Fridge as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
vexy/Fridge
Handle your structs like a boss !
.package(url: "https://github.com/vexy/Fridge.git", from: "v0.8_beta")

Fridge ❄️0.8

Fridge is the perhaps the silliest refrigerator implementation you'll ever see.
With Fridge, your fancy struct(s) will raise and shine, allowing you to focus on your plan to conquer the Earth...finally !

print("Say whaat ?! 🤔 There has to be a trick !")

So, here's the story

Fridge is one super fancy Swift5.5 async/await library, and if you talk with it gently, you can expect magic !

So say you just wanna grab that model from the API and do your stuff. Your stuff... Well, if you conform your fancy struct into Decodable first:

struct My🧞truct: Decodable {
    var something: String
    var elixirOfL❤️fe: URL
    var piTimesE: Float

    //fatalError if elixir cannot be initialized (!)
    init(private🔑: Chachapoly20) { ... }
}

Then, you can go ahead and just grab it from that fancy URL of yours..

/* just grab it 😮  Really... like this ?? */

let grabbedObject: My🧞‍truct = try await Fridge.grab🔮(from: fancyURL_of_mine)

Yup, and you're all set. Fridge will perform the network fetch and decode the network data and return your struct.
Easy peasy right ?

For real ??

Fridge is here to reduce the pain of fetching your stuff from the network, parsing, doing endless error checking and yeah... good old closures. You can even say goodbay to closures if you want. It's build using async/await philosophy and requires Swift 5.5 to run.

NOTE
As of 6-8-2021 Fridge requires Swift5.5 and prebuilt Swift snapshots. You may also need to set -Xfrontend -enable-experimental-concurrency flag in other linker flags section. Checkout official Swift.org website for more info.

Library reference

Fridge has very simple interface to work with:

  • Fridge.grab🔮(from: URL) method to get your struct directly from the network
  • Fridge.freeze🧊() to store your struct on the disk

How can I install Fridge ?

Using Swift Package Manager is by far the sexiest way to install silly Fridge.
Just add following line to your Package.swift:

Package: "Fridge",  
URL: https://github.com/vexy/Fridge.git

(FRIDGE IS STILL UNDER HEAVY DEVELOPMENT)
Package BETA release : v0.8.1 ( UTC2021-06-08 )

Copyright © 2020 Veljko Tekelerović, MIT license

GitHub

link
Stars: 7
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Fridge 0.8 BETA
4 years ago

Major improvement in download process

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API