Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Update Method to know when Adding An element to an array #4

Open
harrytwright opened this issue Nov 7, 2017 · 1 comment
Open
Assignees

Comments

@harrytwright
Copy link
Member

To save time, and having to manually call database

could add some new DBObject methods

i.e:

add(to type: Type, forKey key: String, callback: (Bool, Error?) -> Void)
remove(from type: Type, forKey key: String, callback: (Bool, Error?) -> Void)
@harrytwright
Copy link
Member Author

harrytwright commented Nov 10, 2017

Adding will be added soon, with remove coming soon, these will currently only work with Arrays and CodableColection CodableArray with a Dictionary overload coming soon

func addChange<Change: Codable, Sequence: RangeReplaceableCollection>(_:forKeyPath:callback:) where Sequence.Element == Change

// _: Change
// forKeyPath: WritableKeyPath<Self, Sequence>
// callback: @escaping (DBObjectChange, DBDocument) -> Void

This will just allow users to access there Document from a new perspective, if they were to have an Array all the way in the back, they could access that and change it without long messy callbacks

harrytwright added a commit that referenced this issue Nov 10, 2017
harrytwright added a commit that referenced this issue Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant