Skip to content

store struct not working #28

@niskah-media

Description

@niskah-media

I'm trying to store struct object but not work.

struct InstagramApiUser: Codable {
    var access_token: String
    var user_id: Int
}

storing with:

let json = try JSONDecoder().decode(InstagramApiUser.self, from: data)
KeychainPreferences.sharedInstance[InstagramClient.keychain_api_user_key, .archive] = json

retrieving with:

         if let user = self.keychain.object(forKey: InstagramClient.keychain_api_user_key) as? InstagramApiUser {
             print("- OAuth2 user api: \(String(describing: self.user_api))")
         } 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions