profile
viewpoint
Morten Heiberg heiberg Strange Loop ApS Copenhagen, Denmark strangeloop.dk

thorfroelich/GPUImage 2

An open source iOS framework for GPU-based image and video processing

heiberg/AFNetworking 0

A delightful iOS and OS X networking framework

heiberg/Alamofire 0

Elegant HTTP Networking in Swift

heiberg/alfred-workflows 0

A collection of Alfred 2 workflows that will rock your world

heiberg/ansible-nas 0

Build a full-featured home server or NAS replacement with an Ubuntu box and this playbook.

heiberg/AttributedMarkdown 0

Native Markdown Parsing to NSAttributedString on iOS

heiberg/awesome-ios 0

A curated list of awesome iOS ecosystem, including Objective-C and Swift Projects

heiberg/awesome-swift 0

A collaborative list of awesome Swift libraries and resources. Feel free to contribute!

heiberg/CollectionViewAnimations 0

Sample project demonstrating how to expand / collapse collection view cells using custom animation blocks.

heiberg/DCTextEngine 0

An engine that convert text to attributed strings and attributed strings to text. Supports HTML and markdown by default.

issue closedyapstudios/YapDatabase

Bookkeeping error in filtered views

I'm seeing a case where a filtered view is not showing the expected items after a write transaction.

The simplest reproduction I have is as follows:

Setup

  • Create a view which has a criteria for including objects in the grouping. Let's say that object.isValid must be true.
  • Create a filtered view with this view as the parent. The filter block just includes everything from the parent view.
  • Create a database object with isValid = true so that it is included in both views.

Now we would expect the two views to always include the same objects.

Trigger error

  • Open a read/write transaction on a connection.
  • Change isValid to false on the single database object. Write the object.
  • Both views would be empty if we committed the transaction now.
  • Change isValid to true on the single database object. Write the object.
  • End the transaction.

Now the regular view will include the modified object. But the filtered view will be empty.

The resulting YapDatabaseModifiedNotification looks like this:

NSConcreteNotification 0x7f81d14c8740 {name = YapDatabaseModifiedNotification; object = <YapDatabase: 0x7f81d143e500>; userInfo = {
    connection = "<YapDatabaseConnection: 0x7f81d145a590>";
    extensions =     {
        "Filtered View" =         {
            changes =             (
                "<YapDatabaseViewRowChange: Delete pre(0 -> ~) post(0 -> ~) group(Foobar) collectionKey(<YapCollectionKey collection(Foobar) key(41)>)",
                "<YapDatabaseViewSectionChange: Delete group(Foobar)"
            );
        };
        "Regular View" =         {
            changes =             (
                "<YapDatabaseViewRowChange: Delete pre(0 -> ~) post(0 -> ~) group(Foobar) collectionKey(<YapCollectionKey collection(Foobar) key(41)>)",
                "<YapDatabaseViewRowChange: Insert pre(~ -> 0) post(~ -> 0) group(Foobar) collectionKey(<YapCollectionKey collection(Foobar) key(41)>)"
            );
        };
    };
    metadataChanges = "<YapSet: 0x7f81d3e76d90>";
    objectChanges = "<YapSet: 0x7f81d3e76a70>";
    snapshot = 121;
}}

We see that the regular view experiences a delete followed by an insert. But the filtered view ends up deleting the empty group and not recreating it when the insertion happens afterwards.

Troubleshooting

I ran into this in a way more convoluted setup, where items were missing after a multi-phase database maintenance pass. My project is Swift-only and I have TaylorSource stacked on top of YapDatabaseExtensions stacked on top of YapDatabase.

But simplifying the change set, capturing the above notification and stepping through the code has led me to believe that the bookkeeping error happens in YapDatabaseFilteredViewTransaction.

It is inside YapDatabaseFilteredViewTransaction that the YapDatabaseViewSectionChange.deleteGroup initializer is called and there is no call to YapDatabaseViewSectionChange.insertGroup anywhere in that file. The group is lost and never returns, even though it is non-empty in the parent view after the transaction is committed.

closed time in a month

heiberg

issue commentyapstudios/YapDatabase

Bookkeeping error in filtered views

It's been 4 years. Closing this to clean up my issue list.

heiberg

comment created time in a month

PR closed cnoon/CollectionViewAnimations

Update to Swift 3
  • Updated the project source to Swift 3
  • Updated SnapKit
  • Xcode project settings updated to latest recommended settings
+3436 -2206

1 comment

69 changed files

heiberg

pr closed time in a month

pull request commentcnoon/CollectionViewAnimations

Update to Swift 3

Closing this. It's been 3 years.

heiberg

comment created time in a month

release Squarespace/simple-source

2.0.4

released time in 3 months

release Squarespace/simple-source

2.0.3

released time in 3 months

created tagSquarespace/simple-source

tag2.0.4

Easy and type-safe iOS table and collection views in Swift.

created time in 3 months

push eventSquarespace/simple-source

Morten Heiberg

commit sha 959a3b393e130403052a44a24aab1d35ef54a347

2.0.4

view details

push time in 3 months

push eventheiberg/simple-source

Thor Frølich

commit sha 6a74e0ff295e3b4fc8f3eb4900d44cb4f01dfb15

Remove superfluous updates from BasicDataSource when moving items (#9)

view details

push time in 3 months

PR merged Squarespace/simple-source

Reviewers
Remove superfluous updates from BasicDataSource when moving items

This PR removes superfluous updates on BasicDataSource's update handler when moving items. The cause of the extra update was in-place mutation of sections resulting in an update being sent for both the removal and insertion.

+2 -0

1 comment

1 changed file

thorfroelich

pr closed time in 3 months

push eventSquarespace/simple-source

Thor Frølich

commit sha 6a74e0ff295e3b4fc8f3eb4900d44cb4f01dfb15

Remove superfluous updates from BasicDataSource when moving items (#9)

view details

push time in 3 months

pull request commentSquarespace/simple-source

Remove superfluous updates from BasicDataSource when moving items

Good catch! 👍

thorfroelich

comment created time in 3 months

more