View and Secondary Index Extensions

13 views
Skip to first unread message

Kamal

unread,
Jun 29, 2018, 5:11:16 AM6/29/18
to YapDatabase
Hi, I'm relatively new here so any kind of help is appreciated. I'm developing a storage app that will display uploaded files in a table. I used view extension to create a view based on folder level and folder name itself. Thus, creating multiple views (depending on the directory itself) in the same view controller. The problem comes when I upload files, the only update I get from yapDatabaseModified is on the currently active view. So let's say if I upload a folder "Images/img01.png", the root view will definitely insert folder "Images" folder into the table but not file "img01.png" in the view where it's supposed to display the file when folder is selected. Is there a solution to this? I group filter the view by the type of files object, so it returns path extension and folder.

Another way I can think of is using secondary index where I have to enumerate the objects and store in array and feed into the table view. So that every time a folder is selected, I'll enumerate and reload the table. Is this efficient? Considering that I'll have large dataset including uploading processes later on.

Robbie Hanson

unread,
Jul 2, 2018, 9:18:17 AM7/2/18
to yapda...@googlegroups.com
YapDatabaseAutoView performs a mapping, where each object can be mapped to 1 (and only 1) view/group.

So if you have an object, say “/foo/bar/buzz.png”, then that object can only affect a single view/group.
In this case it will likely affect the view/group representing its parent folder, i.e. “/foo/bar”

However, if you also create directory objects: “/foo” and “/bar”, then an insert (of all 3 objects) will affect 3 different views:
- “/foo” will affect “/“
- “/bar” will affect “/foo”
- “buzz.png” will affect “/bar"

I do something similar in one of my apps, and it works quite nicely.

The problem comes when I upload files, the only update I get from yapDatabaseModified is on the currently active view. So let's say if I upload a folder "Images/img01.png", the root view will definitely insert folder "Images" folder into the table but not file "img01.png" in the view where it's supposed to display the file when folder is selected.

The YapDatabaseModifiedNotification will contain all the information about the changes that you made to the database. In fact, it’s quite helpful for debugging too. It contains a userInfo object that will have all kinds of data about the changes you made.

Thus, creating multiple views (depending on the directory itself) in the same view controller.

Can you explain what you mean by this? Perhaps we can come up with a better solution.


-Robbie Hanson

On June 29, 2018 at 05:11:17, 'Kamal' via YapDatabase (yapda...@googlegroups.com) wrote:

Hi, I'm relatively new here so any kind of help is appreciated. I'm developing a storage app that will display uploaded files in a table. I used view extension to create a view based on folder level and folder name itself. Thus, creating multiple views (depending on the directory itself) in the same view controller. The problem comes when I upload files, the only update I get from yapDatabaseModified is on the currently active view. So let's say if I upload a folder "Images/img01.png", the root view will definitely insert folder "Images" folder into the table but not file "img01.png" in the view where it's supposed to display the file when folder is selected. Is there a solution to this? I group filter the view by the type of files object, so it returns path extension and folder.

Another way I can think of is using secondary index where I have to enumerate the objects and store in array and feed into the table view. So that every time a folder is selected, I'll enumerate and reload the table. Is this efficient? Considering that I'll have large dataset including uploading processes later on.
--
You received this message because you are subscribed to the Google Groups "YapDatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yapdatabase...@googlegroups.com.
To post to this group, send email to yapda...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages