Git Product home page Git Product logo

userdefaultsstore's Introduction

Hi there ๐Ÿ‘‹

I'm a software engineer and the creator of the open source projects below ๐Ÿ‘‡

I currently work at Booking.com, previously Spotify, Backbase, and others.

I love building iOS frameworks and apps, web APIs and contributing to open source projects. Swift is my favored tool, but I also enjoy working with other languages like Python, Ruby, and Javascript.

On the side, I enjoy practicing Arabic calligraphy, playing the piano, and looking for the best cup of espresso in town.

You can find me online on Linkedin.

userdefaultsstore's People

Contributors

batarian711 avatar dependabot[bot] avatar omaralbeik avatar terwanerik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

userdefaultsstore's Issues

Fix Codecov

The project has a 100% test coverage, however codecov is not working for some reason ๐Ÿ˜ญ
If you have an idea how to fix it, your help is highly appriciated

Misleading docs

Based on the documentation in the readme, I got the impression that a laptop owned by a user came from the laptop store. Meaning that what was serialized to the store was the key to the laptop and that when I retrieved a user, it would also retrieve the laptop from the store.

What's actually happening is that the laptop is serialized into the data for the user. So if I were to say that John owned a MacBook and then changed the description of the MacBook in the laptop store, when I retrieved john's record, I would get the updated Macbook data. Instead, I get whatever was serialized when I saved john to the user store.

Does this make sense? I think it would be good to be explicit about what's happening, because I was getting inconsistency errors based on what I thought the docs were implying.

JSON Encoding doesn't store JSON

In inspecting the plist files that are created, I was surprised to see that they're not human readable, even though a JSONEncoder is being used. The issue is that you're taking the encoding and storing that directly, rather than converting it to a string.

I think it would be nice to have that at least as an option, to aid in debugging. To do so, you'd change save to look more like:

	public func save(_ object: T) throws {
		let data = try encoder.encode(object)
                if let str = String(data: json, encoding: .utf8) {
		     store.set(str, forKey: key(for: object))
		     increaseCounter()
                } else {
                     // throw appropriate error.
                }
	}

Logo contribution

I'm sorry sir, my github account was suspended, I will now open it up pr again.

userr

Not working with duplicate object

let cartSaved = UserDefaultsStore<CartItem>(uniqueIdentifier: "cart")

When I add the same product with the same id I want to increment the quantity but the saved cart (::allObject) method return me the same product

  var cart  = getCart()
        
        var targetItem  = cart.first(where: {$0.product.id == cartItem.product.id}) // <-- targetItem is a product in the [CartItem]
                
        
        if targetItem == nil  {
        
            print("prodct added ! ")
            cartItem.quantity += 1
            cart.append(cartItem)
            
            
        }else{
            
            targetItem?.quantity += 1
            
        }
        
        saveCart(cart: cart) // <--- here save again it should save the targetItem += 1

Doesn't work with classes

After porting a bunch of code to work with UserDefaultsStore, I discovered that the "objects" you store can only be structs. It would be good to document this.

Use hash value as key?

Looks dangerous.

Hash values are not guaranteed to be equal across different executions of your program. Do not save hash values to use during a future execution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.