Forever

1.1.0

A ridiculously simple persistence library.
jiachenyee/Forever

What's New

1.1.0

2023-01-19T17:55:25Z

Resolves #1

  • Adds Combine support
  • Use combine operators like sink to observe the values

Forever

Persist any Codable item.

@Forever("todos") var todos = [Todo(title: "Feed the cat", isCompleted: true),
                               Todo(title: "Play with cat"),
                               Todo(title: "Get allergies"),
                               Todo(title: "Run away from cat"),
                               Todo(title: "Get a new cat")]
struct Todo: Codable {
    var title: String
    var isCompleted = false
}

One line and it lasts @Forever.

@Forever("counter") var counter = 1

Using UIKit? Forever+Combine

Thanks #1.

class ViewController: UIViewController {

    @Forever("counter") var counter = 1
    var cancellables = Set<AnyCancellable>()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        _counter.sink(receiveValue: { value in
            print(value)
        })
        .store(in: &cancellables)
    }
    //...
}

Don't like Forever? Use another one.

@DontDie("name") var name = "Potato"
@DontLeaveMe("todo") var todo = Todo(...)
@BePersistent("a") var b = true

Installation

Requirements

Platform Version
iOS 13.0 or later
macOS 11.0 or later
watchOS 6.0 or later
tvOS 13.0 or later

Add as Swift Package

In Xcode, File → Add Packages… → Paste https://github.com/jiachenyee/forever in the search field.

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

  • None
Last updated: Thu Oct 17 2024 15:32:01 GMT-0900 (Hawaii-Aleutian Daylight Time)