motion-yapper 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +3 -1
- data/lib/yapper.rb +3 -3
- data/lib/yapper/db.rb +61 -4
- data/lib/yapper/document/persistence.rb +4 -0
- data/lib/yapper/document/selection.rb +13 -0
- data/lib/yapper/version.rb +1 -1
- data/motion-yapper.gemspec +1 -1
- data/spec/integration/search_spec.rb +111 -0
- data/vendor/Podfile.lock +11 -7
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +16 -2
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +10 -7
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +20 -2
- metadata +19 -297
- data/vendor/Pods/.build/libPods-CocoaLumberjack.a +0 -0
- data/vendor/Pods/.build/libPods-NSData+MD5Digest.a +0 -0
- data/vendor/Pods/.build/libPods-YapDatabase.a +0 -0
- data/vendor/Pods/.build/libPods.a +0 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +0 -41
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +0 -102
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDContextFilterLogFormatter.h +0 -63
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDDispatchQueueLogFormatter.h +0 -128
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +0 -369
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog+LOGV.h +0 -99
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +0 -634
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDMultiFormatter.h +0 -30
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +0 -181
- data/vendor/Pods/BuildHeaders/NSData+MD5Digest/NSData+MD5Digest.h +0 -18
- data/vendor/Pods/BuildHeaders/YapDatabase/NSDictionary+YapDatabase.h +0 -8
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +0 -91
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +0 -23
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +0 -547
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +0 -449
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnectionState.h +0 -29
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +0 -37
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtension.h +0 -15
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionConnection.h +0 -11
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +0 -444
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionTransaction.h +0 -11
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +0 -81
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewConnection.h +0 -12
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +0 -39
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTypes.h +0 -32
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearch.h +0 -89
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchConnection.h +0 -32
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +0 -77
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +0 -79
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchTransaction.h +0 -68
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseLogging.h +0 -158
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseManager.h +0 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +0 -446
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseQuery.h +0 -42
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationship.h +0 -35
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipConnection.h +0 -29
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdge.h +0 -163
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdgePrivate.h +0 -79
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipNode.h +0 -99
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipOptions.h +0 -59
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipPrivate.h +0 -125
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipTransaction.h +0 -384
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +0 -149
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexConnection.h +0 -33
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +0 -83
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetup.h +0 -33
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetupPrivate.h +0 -18
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +0 -58
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseStatement.h +0 -13
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseString.h +0 -121
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +0 -651
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +0 -127
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +0 -272
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChangePrivate.h +0 -94
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +0 -116
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +0 -842
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappingsPrivate.h +0 -72
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +0 -63
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPage.h +0 -36
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPageMetadata.h +0 -27
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +0 -170
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptions.h +0 -330
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +0 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +0 -498
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTypes.h +0 -99
- data/vendor/Pods/BuildHeaders/YapDatabase/YapMemoryTable.h +0 -74
- data/vendor/Pods/BuildHeaders/YapDatabase/YapNull.h +0 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapSet.h +0 -41
- data/vendor/Pods/BuildHeaders/YapDatabase/YapTouch.h +0 -15
- data/vendor/Pods/CocoaLumberjack/LICENSE.txt +0 -18
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +0 -41
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +0 -100
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +0 -102
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +0 -727
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +0 -369
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +0 -1539
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog+LOGV.h +0 -99
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +0 -634
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +0 -1208
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +0 -181
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +0 -1520
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.h +0 -63
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.m +0 -191
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.h +0 -128
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.m +0 -253
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.h +0 -30
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.m +0 -127
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +0 -7
- data/vendor/Pods/CocoaLumberjack/README.markdown +0 -74
- data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +0 -41
- data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +0 -102
- data/vendor/Pods/Headers/CocoaLumberjack/DDContextFilterLogFormatter.h +0 -63
- data/vendor/Pods/Headers/CocoaLumberjack/DDDispatchQueueLogFormatter.h +0 -128
- data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +0 -369
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog+LOGV.h +0 -99
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +0 -634
- data/vendor/Pods/Headers/CocoaLumberjack/DDMultiFormatter.h +0 -30
- data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +0 -181
- data/vendor/Pods/Headers/NSData+MD5Digest/NSData+MD5Digest.h +0 -18
- data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +0 -23
- data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +0 -547
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +0 -449
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtension.h +0 -15
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionConnection.h +0 -11
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionTransaction.h +0 -11
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +0 -81
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewConnection.h +0 -12
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +0 -39
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTypes.h +0 -32
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearch.h +0 -89
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchConnection.h +0 -32
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +0 -79
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchTransaction.h +0 -68
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseQuery.h +0 -42
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationship.h +0 -35
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipConnection.h +0 -29
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipEdge.h +0 -163
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipNode.h +0 -99
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipOptions.h +0 -59
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipTransaction.h +0 -384
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +0 -149
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexConnection.h +0 -33
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexSetup.h +0 -33
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +0 -58
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +0 -651
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +0 -127
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +0 -272
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +0 -116
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +0 -842
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +0 -63
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptions.h +0 -330
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +0 -498
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTypes.h +0 -99
- data/vendor/Pods/Headers/YapDatabase/YapSet.h +0 -41
- data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +0 -7
- data/vendor/Pods/Headers/____Pods-NSData+MD5Digest-prefix.h +0 -5
- data/vendor/Pods/Headers/____Pods-YapDatabase-prefix.h +0 -5
- data/vendor/Pods/Headers/____Pods-environment.h +0 -38
- data/vendor/Pods/Manifest.lock +0 -22
- data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.h +0 -18
- data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.m +0 -39
- data/vendor/Pods/NSData+MD5Digest/README.md +0 -11
- data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-CocoaLumberjack-dummy.m +0 -5
- data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +0 -7
- data/vendor/Pods/Pods-CocoaLumberjack.xcconfig +0 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-NSData+MD5Digest-dummy.m +0 -5
- data/vendor/Pods/Pods-NSData+MD5Digest-prefix.pch +0 -5
- data/vendor/Pods/Pods-NSData+MD5Digest.xcconfig +0 -0
- data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-YapDatabase-dummy.m +0 -5
- data/vendor/Pods/Pods-YapDatabase-prefix.pch +0 -5
- data/vendor/Pods/Pods-YapDatabase.xcconfig +0 -1
- data/vendor/Pods/Pods-acknowledgements.markdown +0 -59
- data/vendor/Pods/Pods-acknowledgements.plist +0 -97
- data/vendor/Pods/Pods-dummy.m +0 -5
- data/vendor/Pods/Pods-environment.h +0 -38
- data/vendor/Pods/Pods-resources.sh +0 -68
- data/vendor/Pods/Pods.xcconfig +0 -5
- data/vendor/Pods/Pods.xcodeproj/project.pbxproj +0 -4807
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-CocoaLumberjack.xcscheme +0 -59
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-NSData+MD5Digest.xcscheme +0 -59
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-YapDatabase.xcscheme +0 -59
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods.xcscheme +0 -59
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/xcschememanagement.plist +0 -31
- data/vendor/Pods/YapDatabase/LICENSE.txt +0 -18
- data/vendor/Pods/YapDatabase/README.md +0 -32
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +0 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +0 -81
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +0 -159
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.h +0 -12
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.m +0 -41
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +0 -39
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +0 -1235
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTypes.h +0 -32
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +0 -77
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.h +0 -89
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.m +0 -146
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.h +0 -32
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +0 -298
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.h +0 -79
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.m +0 -95
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.h +0 -68
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +0 -1403
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +0 -444
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.h +0 -15
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +0 -83
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.h +0 -11
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +0 -46
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.h +0 -11
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +0 -204
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipEdgePrivate.h +0 -79
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipPrivate.h +0 -125
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.h +0 -35
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.m +0 -129
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.h +0 -29
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.m +0 -802
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.h +0 -163
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.m +0 -408
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipNode.h +0 -99
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.h +0 -59
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.m +0 -29
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.h +0 -384
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.m +0 -5254
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +0 -83
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexSetupPrivate.h +0 -18
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +0 -149
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +0 -161
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.h +0 -33
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +0 -331
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.h +0 -33
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +0 -245
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.h +0 -58
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +0 -1269
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewChangePrivate.h +0 -94
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewMappingsPrivate.h +0 -72
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.h +0 -36
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.mm +0 -296
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.h +0 -27
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.m +0 -28
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +0 -170
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewRangeOptionsPrivate.h +0 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +0 -272
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +0 -2500
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +0 -842
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +0 -1714
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.h +0 -330
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.m +0 -141
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +0 -127
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +0 -194
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +0 -116
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +0 -888
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +0 -63
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.m +0 -27
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +0 -498
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +0 -4986
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTypes.h +0 -99
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.h +0 -8
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.m +0 -19
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +0 -91
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +0 -465
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.h +0 -29
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.m +0 -48
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +0 -37
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +0 -83
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.h +0 -158
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.m +0 -73
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.h +0 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.m +0 -56
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +0 -446
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.h +0 -13
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.m +0 -26
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseString.h +0 -121
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.h +0 -74
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.m +0 -603
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.h +0 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +0 -35
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.h +0 -15
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.m +0 -31
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +0 -23
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +0 -199
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.h +0 -42
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.m +0 -96
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.h +0 -41
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.m +0 -82
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +0 -547
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +0 -2013
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +0 -449
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +0 -4046
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +0 -651
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +0 -5602
- data/vendor/Pods/build-iPhoneSimulator/Pods.bridgesupport +0 -3172
- data/vendor/Pods/build-iPhoneSimulator/libPods.a +0 -0
@@ -1,842 +0,0 @@
|
|
1
|
-
#import <Foundation/Foundation.h>
|
2
|
-
#import "YapDatabaseViewRangeOptions.h"
|
3
|
-
|
4
|
-
@class YapDatabaseReadTransaction;
|
5
|
-
|
6
|
-
/**
|
7
|
-
* Welcome to YapDatabase!
|
8
|
-
*
|
9
|
-
* https://github.com/yaptv/YapDatabase
|
10
|
-
*
|
11
|
-
* The project wiki has a wealth of documentation if you have any questions.
|
12
|
-
* https://github.com/yaptv/YapDatabase/wiki
|
13
|
-
*
|
14
|
-
* YapDatabaseView is an extension designed to work with YapDatabase.
|
15
|
-
* It gives you a persistent sorted "view" of a configurable subset of your data.
|
16
|
-
*
|
17
|
-
* For the full documentation on Views, please see the related wiki article:
|
18
|
-
* https://github.com/yaptv/YapDatabase/wiki/Views
|
19
|
-
*
|
20
|
-
* YapDatabaseViewMappings helps you map from groups to sections.
|
21
|
-
* Let's take a look at a concrete example:
|
22
|
-
*
|
23
|
-
* Say you have a database full of items for sale in a grocery store.
|
24
|
-
* You have a view which sorts the items alphabetically, grouped by department.
|
25
|
-
* There are many different departments (produce, bakery, dairy, wine, etc).
|
26
|
-
* But you want to display a table view that contains only a few departments: (wine, liquor, beer).
|
27
|
-
*
|
28
|
-
* This class allows you to specify that you want:
|
29
|
-
* - section 0 = wine
|
30
|
-
* - section 1 = liquor
|
31
|
-
* - section 2 = beer
|
32
|
-
*
|
33
|
-
* From this starting point, the class helps you map from section to group, and vice versa.
|
34
|
-
* Plus it can properly take into account empty sections. For example, if there are no items
|
35
|
-
* for sale in the liquor department then it can automatically move beer to section 1 (optional).
|
36
|
-
*
|
37
|
-
* But the primary purpose of this class has to do with assisting in animating changes to your view.
|
38
|
-
* In order to provide the proper animation instructions to your tableView or collectionView,
|
39
|
-
* the database layer needs to know a little about how you're setting things up.
|
40
|
-
*
|
41
|
-
* Using the example above, we might have code that looks something like this:
|
42
|
-
*
|
43
|
-
* - (void)viewDidLoad
|
44
|
-
* {
|
45
|
-
* // Freeze our connection for use on the main-thread.
|
46
|
-
* // This gives us a stable data-source that won't change until we tell it to.
|
47
|
-
*
|
48
|
-
* [databaseConnection beginLongLivedReadTransaction];
|
49
|
-
*
|
50
|
-
* // The view may have a whole bunch of groups.
|
51
|
-
* // In our example, the view contains a group for every department in the grocery store.
|
52
|
-
* // We only want to display the alcohol related sections in our tableView.
|
53
|
-
*
|
54
|
-
* NSArray *groups = @[@"wine", @"liquor", @"beer"];
|
55
|
-
* mappings = [[YapDatabaseViewMappings alloc] initWithGroups:groups view:@"order"];
|
56
|
-
*
|
57
|
-
* // There are several ways in which we can further configure the mappings.
|
58
|
-
* // You would configure it however you want.
|
59
|
-
*
|
60
|
-
* // ...
|
61
|
-
*
|
62
|
-
* // Now initialize the mappings.
|
63
|
-
* // This will allow the mappings object to get the counts per group.
|
64
|
-
*
|
65
|
-
* [databaseConnection readWithBlock:(YapDatabaseReadTransaction *transaction){
|
66
|
-
* // One-time initialization
|
67
|
-
* [mappings updateWithTransaction:transaction];
|
68
|
-
* }];
|
69
|
-
*
|
70
|
-
* // And register for notifications when the database changes.
|
71
|
-
* // Our method will be invoked on the main-thread,
|
72
|
-
* // and will allow us to move our stable data-source from our existing state to an updated state.
|
73
|
-
*
|
74
|
-
* [[NSNotificationCenter defaultCenter] addObserver:self
|
75
|
-
* selector:@selector(yapDatabaseModified:)
|
76
|
-
* name:YapDatabaseModifiedNotification
|
77
|
-
* object:databaseConnection.database];
|
78
|
-
* }
|
79
|
-
*
|
80
|
-
* - (void)yapDatabaseModified:(NSNotification *)notification
|
81
|
-
* {
|
82
|
-
* // End & Re-Begin the long-lived transaction atomically.
|
83
|
-
* // Also grab all the notifications for all the commits that I jump.
|
84
|
-
*
|
85
|
-
* NSArray *notifications = [databaseConnection beginLongLivedReadTransaction];
|
86
|
-
*
|
87
|
-
* // Process the notification(s),
|
88
|
-
* // and get the changeset as it applies to me, based on my view and my mappings setup.
|
89
|
-
*
|
90
|
-
* NSArray *sectionChanges = nil;
|
91
|
-
* NSArray *rowChanges = nil;
|
92
|
-
*
|
93
|
-
* [[databaseConnection ext:@"order"] getSectionChanges:§ionChanges
|
94
|
-
* rowChanges:&rowChanges
|
95
|
-
* forNotifications:notifications
|
96
|
-
* withMappings:mappings];
|
97
|
-
*
|
98
|
-
* // No need to update mappings.
|
99
|
-
* // The above method did it automatically.
|
100
|
-
*
|
101
|
-
* if ([sectionChanges count] == 0 & [rowChanges count] == 0)
|
102
|
-
* {
|
103
|
-
* // Nothing has changed that affects our tableView
|
104
|
-
* return;
|
105
|
-
* }
|
106
|
-
*
|
107
|
-
* // Now it's time to process the changes.
|
108
|
-
* //
|
109
|
-
* // Note: Because we explicitly told the mappings to allowEmptySections,
|
110
|
-
* // there won't be any section changes. If we had instead set allowEmptySections to NO,
|
111
|
-
* // then there might be section deletions & insertions as sections become empty & non-empty.
|
112
|
-
*
|
113
|
-
* [self.tableView beginUpdates];
|
114
|
-
*
|
115
|
-
* for (YapDatabaseViewSectionChange *sectionChange in sectionChanges)
|
116
|
-
* {
|
117
|
-
* // ... (see https://github.com/yaptv/YapDatabase/wiki/Views )
|
118
|
-
* }
|
119
|
-
*
|
120
|
-
* for (YapDatabaseViewRowChange *rowChange in rowChanges)
|
121
|
-
* {
|
122
|
-
* // ... (see https://github.com/yaptv/YapDatabase/wiki/Views )
|
123
|
-
* }
|
124
|
-
*
|
125
|
-
* [self.tableView endUpdates];
|
126
|
-
* }
|
127
|
-
*
|
128
|
-
* - (NSInteger)numberOfSectionsInTableView:(UITableView *)sender
|
129
|
-
* {
|
130
|
-
* // We can use the cached information in the mappings object.
|
131
|
-
* //
|
132
|
-
* // This comes in handy if my sections are dynamic,
|
133
|
-
* // and automatically come and go as individual sections become empty & non-empty.
|
134
|
-
*
|
135
|
-
* return [mappings numberOfSections];
|
136
|
-
* }
|
137
|
-
*
|
138
|
-
* - (NSInteger)tableView:(UITableView *)sender numberOfRowsInSection:(NSInteger)section
|
139
|
-
* {
|
140
|
-
* // We can use the cached information in the mappings object.
|
141
|
-
*
|
142
|
-
* return [mappings numberOfItemsInSection:section];
|
143
|
-
* }
|
144
|
-
*
|
145
|
-
* - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
146
|
-
* {
|
147
|
-
* // If my sections are dynamic (they automatically come and go as individual sections become empty & non-empty),
|
148
|
-
* // then I can easily use the mappings object to find the appropriate group.
|
149
|
-
*
|
150
|
-
* NSString *group = [mappings groupForSection:indexPath.section];
|
151
|
-
*
|
152
|
-
* __block id object = nil;
|
153
|
-
* [databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction){
|
154
|
-
*
|
155
|
-
* object = [[transaction ext:@"view"] objectAtIndex:indexPath.row inGroup:group];
|
156
|
-
* }];
|
157
|
-
*
|
158
|
-
* // configure and return cell...
|
159
|
-
* }
|
160
|
-
*
|
161
|
-
* @see YapDatabaseConnection getSectionChanges:rowChanges:forNotifications:withMappings:
|
162
|
-
**/
|
163
|
-
|
164
|
-
/**
|
165
|
-
* The YapDatabaseViewRangePosition struct represents the range window within the full group.
|
166
|
-
* @see rangePositionForGroup:
|
167
|
-
**/
|
168
|
-
struct YapDatabaseViewRangePosition {
|
169
|
-
NSUInteger offsetFromBeginning;
|
170
|
-
NSUInteger offsetFromEnd;
|
171
|
-
NSUInteger length;
|
172
|
-
|
173
|
-
};
|
174
|
-
typedef struct YapDatabaseViewRangePosition YapDatabaseViewRangePosition;
|
175
|
-
|
176
|
-
typedef BOOL (^YapDatabaseViewMappingGroupFilter)(NSString *group, YapDatabaseReadTransaction *transaction);
|
177
|
-
typedef NSComparisonResult (^YapDatabaseViewMappingGroupSort)(NSString *group1, NSString *group2, YapDatabaseReadTransaction *transaction);
|
178
|
-
|
179
|
-
@interface YapDatabaseViewMappings : NSObject <NSCopying>
|
180
|
-
|
181
|
-
/**
|
182
|
-
* Initializes a new mappings object.
|
183
|
-
*
|
184
|
-
* @param allGroups
|
185
|
-
* The ordered array of group names.
|
186
|
-
* From the example above, this would be @[ @"wine", @"liquor", @"beer" ]
|
187
|
-
*
|
188
|
-
* @param registeredViewName
|
189
|
-
* This is the name of the view, as you registered it with the database system.
|
190
|
-
**/
|
191
|
-
+ (instancetype)mappingsWithGroups:(NSArray *)allGroups view:(NSString *)registeredViewName;
|
192
|
-
|
193
|
-
/**
|
194
|
-
* Initializes a new mappings object.
|
195
|
-
*
|
196
|
-
* @param allGroups
|
197
|
-
* The ordered array of group names.
|
198
|
-
* From the example above, this would be @[ @"wine", @"liquor", @"beer" ]
|
199
|
-
*
|
200
|
-
* @param registeredViewName
|
201
|
-
* This is the name of the view, as you registered it with the database system.
|
202
|
-
*
|
203
|
-
*
|
204
|
-
**/
|
205
|
-
- (id)initWithGroups:(NSArray *)allGroups
|
206
|
-
view:(NSString *)registeredViewName;
|
207
|
-
|
208
|
-
|
209
|
-
/**
|
210
|
-
* Initializes a new mappings object that uses a filterBlock and a sortBlock to dynamically construct sections from view.
|
211
|
-
* @param filterBlock
|
212
|
-
* Block that takes a string and returns a BOOL. returning YES will include the group in the sections of the mapping.
|
213
|
-
* @param sortBlock
|
214
|
-
* Block used to sort group names for groups that pass the filter.
|
215
|
-
* @param registeredViewName
|
216
|
-
* This is the name of the view, as you registered it with the database system.
|
217
|
-
*
|
218
|
-
**/
|
219
|
-
- (id)initWithGroupFilterBlock:(YapDatabaseViewMappingGroupFilter)filterBlock
|
220
|
-
sortBlock:(YapDatabaseViewMappingGroupSort)sortBlock
|
221
|
-
view:(NSString *)registeredViewName;
|
222
|
-
|
223
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
224
|
-
#pragma mark Accessors
|
225
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
226
|
-
|
227
|
-
/**
|
228
|
-
* The allGroups property returns the groups that were passed in the init method.
|
229
|
-
* That is, all groups, whether currently visible or non-visible.
|
230
|
-
*
|
231
|
-
* @see visibleGroups
|
232
|
-
**/
|
233
|
-
@property (nonatomic, copy, readonly) NSArray *allGroups;
|
234
|
-
|
235
|
-
/**
|
236
|
-
* The registeredViewName that was passed in the init method.
|
237
|
-
**/
|
238
|
-
@property (nonatomic, copy, readonly) NSString *view;
|
239
|
-
|
240
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
241
|
-
#pragma mark Configuration
|
242
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
243
|
-
|
244
|
-
/**
|
245
|
-
* A group/section can either be "static" or "dynamic".
|
246
|
-
*
|
247
|
-
* A dynamic section automatically disappears if it becomes empty.
|
248
|
-
* A static section is always visible, regardless of its item count.
|
249
|
-
*
|
250
|
-
* By default all groups/sections are static.
|
251
|
-
* You can enable dynamic sections on a per-group basis (just for certain sections) or for all groups (all sections).
|
252
|
-
*
|
253
|
-
* If you enable dynamic sections, be sure to use the helper methods available in this class.
|
254
|
-
* This will drastically simplify things for you.
|
255
|
-
* For example:
|
256
|
-
*
|
257
|
-
* Let's say you have 3 groups: @[ @"wine", @"liquor", @"beer" ]
|
258
|
-
* You've enabled dynamic sections for all groups.
|
259
|
-
* Section 0 refers to what group?
|
260
|
-
*
|
261
|
-
* The answer depends entirely on the item count per section.
|
262
|
-
* If "wine" is empty, but "liquor" isn't, then section zero is "liquor".
|
263
|
-
* If "wine" and "liquor" are empty, but "beer" isn't, then section zero is "beer".
|
264
|
-
*
|
265
|
-
* But you can simply do this to get the answer:
|
266
|
-
*
|
267
|
-
* NSString *group = [mappings groupForSection:indexPath.section];
|
268
|
-
*
|
269
|
-
* @see numberOfSections
|
270
|
-
* @see groupForSection:
|
271
|
-
* @see visibleGroups
|
272
|
-
*
|
273
|
-
* The mappings object is used with:
|
274
|
-
*
|
275
|
-
* - YapDatabaseViewConnection getSectionChanges:rowChanges:forNotifications:withMappings:
|
276
|
-
*
|
277
|
-
* If all your sections are static, then you won't ever get any section changes.
|
278
|
-
* But if you have one or more dynamic sections, then be sure to process the section changes.
|
279
|
-
* As the dynamic sections disappear & re-appear, the proper section changes will be emitted.
|
280
|
-
*
|
281
|
-
* By DEFAULT, all groups/sections are STATIC.
|
282
|
-
* You can configure this per group, or all-at-once.
|
283
|
-
**/
|
284
|
-
|
285
|
-
- (void)setIsDynamicSectionForAllGroups:(BOOL)isDynamic;
|
286
|
-
- (BOOL)isDynamicSectionForAllGroups;
|
287
|
-
|
288
|
-
- (void)setIsDynamicSection:(BOOL)isDynamic forGroup:(NSString *)group;
|
289
|
-
- (BOOL)isDynamicSectionForGroup:(NSString *)group;
|
290
|
-
|
291
|
-
/**
|
292
|
-
* You can use the YapDatabaseViewRangeOptions class to configure a "range" that you would
|
293
|
-
* like to restrict your tableView / collectionView to.
|
294
|
-
*
|
295
|
-
* Two types of ranges are supported:
|
296
|
-
*
|
297
|
-
* 1. Fixed ranges.
|
298
|
-
* This is similar to using a LIMIT & OFFSET in a typical sql query.
|
299
|
-
*
|
300
|
-
* 2. Flexible ranges.
|
301
|
-
* These allow you to specify an initial range, and allow it to grow and shrink.
|
302
|
-
*
|
303
|
-
* The YapDatabaseViewRangeOptions header file has a lot of documentation on
|
304
|
-
* setting up and configuring range options.
|
305
|
-
*
|
306
|
-
* One of the best parts of using rangeOptions is that you get animations for free.
|
307
|
-
* For example:
|
308
|
-
*
|
309
|
-
* Say you have view that sorts items by sales rank.
|
310
|
-
* You want to display a tableView that displays the top 20 best-sellers. Simple enough so far.
|
311
|
-
* But you want the tableView to automatically update throughout the day as sales are getting processed.
|
312
|
-
* And you want the tableView to automatically animate any changes. (No wimping out with reloadData!)
|
313
|
-
* You can get this with only a few lines of code using range options.
|
314
|
-
*
|
315
|
-
* Note that if you're using range options, then the indexPaths in your UI might not match up directly
|
316
|
-
* with the indexes in the view's group. No worries. You can use the various mapping methods in this class
|
317
|
-
* to automatically handle all that for you.
|
318
|
-
*
|
319
|
-
* @see getGroup:viewIndex:forIndexPath:
|
320
|
-
* @see viewIndexForRow:inSection:
|
321
|
-
* @see viewIndexForRow:inGroup:
|
322
|
-
*
|
323
|
-
* The rangeOptions you pass in are copied, and YapDatabaseViewMappings keeps a private immutable version of them.
|
324
|
-
* So if you make changes to the rangeOptions, you need to invoke this method again to set the changes.
|
325
|
-
**/
|
326
|
-
|
327
|
-
- (void)setRangeOptions:(YapDatabaseViewRangeOptions *)rangeOpts forGroup:(NSString *)group;
|
328
|
-
- (YapDatabaseViewRangeOptions *)rangeOptionsForGroup:(NSString *)group;
|
329
|
-
|
330
|
-
- (void)removeRangeOptionsForGroup:(NSString *)group;
|
331
|
-
|
332
|
-
/**
|
333
|
-
* There are some times when the drawing of one cell depends somehow on a neighboring cell.
|
334
|
-
* For example:
|
335
|
-
*
|
336
|
-
* Apple's SMS messaging app draws a timestamp if more than a certain amount of time has elapsed
|
337
|
-
* between a message and the previous message. The timestamp is actually drawn at the top of a cell.
|
338
|
-
* So cell-B would draw a timestamp at the top of its cell if cell-A represented a message
|
339
|
-
* that was sent/received say 3 hours ago.
|
340
|
-
*
|
341
|
-
* We refer to this as a "cell drawing dependency". For the example above, the timestamp drawing is dependent
|
342
|
-
* upon the cell at offset -1. That is, the drawing of cell at index 5 is dependent upon the cell at index (5-1).
|
343
|
-
*
|
344
|
-
* This method allows you to specify if there are cell drawing dependecies.
|
345
|
-
* For the example above you could simply do the following:
|
346
|
-
*
|
347
|
-
* [mappings setCellDrawingDependencyForNeighboringCellWithOffset:-1 forGroup:@""]
|
348
|
-
*
|
349
|
-
* This will inject extra YapDatabaseViewChangeUpdate's for cells that may have been affected by
|
350
|
-
* other Insert/Delete/Update/Move operations (and thus need to be redrawn).
|
351
|
-
*
|
352
|
-
* Continuing the example above, if the item at index 7 is deleted, then changeset processing will automatically emit
|
353
|
-
* and update change for the item that was previously at index 8. This is because, as specified by the "cell drawing
|
354
|
-
* offset" configuration, the drawing of index 8 was dependent upon the item before it (offset=-1). The item
|
355
|
-
* before it has changed, so it gets an update emitted for it automatically.
|
356
|
-
*
|
357
|
-
* Using this configuration makes it exteremely simple to handle various "cell drawing dependencies".
|
358
|
-
* You can just ask for changesets as you would if there weren't any dependencies,
|
359
|
-
* perform the boiler-plate updates, and everything just works.
|
360
|
-
*
|
361
|
-
* Note that if a YapDatabaseViewChangeUpdate is emitted due to a cell drawing dependeny,
|
362
|
-
* AND there were no actual updates for the corresponding item,
|
363
|
-
* and you'd like to detect these changes for whatever reason (optimizing, etc),
|
364
|
-
* then you can do so by checking to see if the rowChange.changes == YapDatabaseViewChangedDependency.
|
365
|
-
*
|
366
|
-
* If you have multiple cell drawing dependencies (e.g. +1 & -1),
|
367
|
-
* then you can pass in an NSSet of NSNumbers.
|
368
|
-
**/
|
369
|
-
|
370
|
-
- (void)setCellDrawingDependencyForNeighboringCellWithOffset:(NSInteger)offset forGroup:(NSString *)group;
|
371
|
-
|
372
|
-
- (void)setCellDrawingDependencyOffsets:(NSSet *)offsets forGroup:(NSString *)group;
|
373
|
-
- (NSSet *)cellDrawingDependencyOffsetsForGroup:(NSString *)group;
|
374
|
-
|
375
|
-
/**
|
376
|
-
* You can tell mappings to reverse a group/section if you'd like to display it in your tableView/collectionView
|
377
|
-
* in the opposite direction in which the items actually exist within the database.
|
378
|
-
*
|
379
|
-
* For example:
|
380
|
-
*
|
381
|
-
* You have a database view which sorts items by sales rank. The best-selling item is at index 0.
|
382
|
-
* Sometimes you use the view to display the top 20 best-selling items.
|
383
|
-
* But other times you use the view to display the worst-selling items (perhaps to dump these items in order
|
384
|
-
* to make room for new inventory). You want to display the worst-selling item at index 0.
|
385
|
-
* And the second worst-selling item at index 1. Etc.
|
386
|
-
* This happens to be the opposite sorting order from how the items are in stored in the database.
|
387
|
-
* So you simply use the reverse option in mappings to handle the math for you.
|
388
|
-
*
|
389
|
-
* It's important to understand the relationship between reversing a group and the other mapping options
|
390
|
-
* (such as ranges and cell-drawing-dependencies):
|
391
|
-
*
|
392
|
-
* Once you reverse a group (setIsReversed:YES forGroup:group) you can visualize the view as reversed in your head,
|
393
|
-
* and set all other mappings options as if it was actually reversed.
|
394
|
-
*
|
395
|
-
* >>>>> ORDER MATTERS <<<<<
|
396
|
-
*
|
397
|
-
* To be more precise:
|
398
|
-
*
|
399
|
-
* - After reversing a group, you can pass in rangeOptions as if the group were actually reversed in the database.
|
400
|
-
* This makes it easier to configure, as your mental model can match how you configure it.
|
401
|
-
*
|
402
|
-
* rangeOptions = [YapDatabaseViewRangeOptions fixedRangeWithLength:20 offset:0 from:YapDatabaseViewEnd];
|
403
|
-
* [mappings setRangeOptions:rangeOptions forGroup:@"books"];
|
404
|
-
* [mappings setIsReversed:YES forGroup:@"books"];
|
405
|
-
*
|
406
|
-
* is EQUIVALENT to:
|
407
|
-
*
|
408
|
-
* [mappings setIsReversed:YES forGroup:@"books"];
|
409
|
-
* rangeOptions = [YapDatabaseViewRangeOptions fixedRangeWithLength:20 offset:0 from:YapDatabaseViewBeginning];
|
410
|
-
* [mappings setRangeOptions:rangeOptions forGroup:@"books"];
|
411
|
-
*
|
412
|
-
* - In terms of cell-drawing-dependencies, its a similar effect.
|
413
|
-
*
|
414
|
-
* [mappings setCellDrawingDependencyForNeighboringCellWithOffset:+1 forGroup:@"books"]; // <-- Positive one
|
415
|
-
* [mappings setIsReversed:YES forGroup:@"books"];
|
416
|
-
*
|
417
|
-
* is EQUIVALENT to:
|
418
|
-
*
|
419
|
-
* [mappings setCellDrawingDependencyForNeighboringCellWithOffset:-1 forGroup:@"books"]; // <-- Negative one
|
420
|
-
* [mappings setIsReversed:YES forGroup:@"books"];
|
421
|
-
*
|
422
|
-
*
|
423
|
-
* In general, if you wish to visualize other configuration options in terms of how they're going to be displayed
|
424
|
-
* in your user interface, you should reverse the group BEFORE you make other configuration changes.
|
425
|
-
* Alternatively you might visualize it differently. Perhaps you're imaging the database view, applying
|
426
|
-
* range options first, and then reversing the final product for dispaly in a tableView.
|
427
|
-
* So in this case you should reverse the group AFTER you make other configuration changes.
|
428
|
-
*
|
429
|
-
* It's simply a matter of how you visualize it.
|
430
|
-
* Either order is fine, but one likely makes more sense in your head.
|
431
|
-
**/
|
432
|
-
|
433
|
-
- (void)setIsReversed:(BOOL)isReversed forGroup:(NSString *)group;
|
434
|
-
- (BOOL)isReversedForGroup:(NSString *)group;
|
435
|
-
|
436
|
-
/**
|
437
|
-
* This configuration allows you to take multiple groups in a database view,
|
438
|
-
* and display them in a single section in your tableView / collectionView.
|
439
|
-
*
|
440
|
-
* It's called a "consolidated group".
|
441
|
-
*
|
442
|
-
* Further, you can configure a threshold where the mappings will automatically switch between
|
443
|
-
* using a "consolidated group" and normal mode.
|
444
|
-
*
|
445
|
-
* This is useful for those situations where the total number of items in your tableView
|
446
|
-
* could be very small or very big. When the count is small, you don't want to use sections.
|
447
|
-
* But when the count reaches a certain size, you do want to use sections.
|
448
|
-
* For these situations, you can configure the threshold to meet your requirements,
|
449
|
-
* and mappings will automatically handle everything for you.
|
450
|
-
* Including animating the changes when switching back and forth between consolidated mode and normal mode.
|
451
|
-
*
|
452
|
-
* The threshold represents the point at which the transition occurs. That is:
|
453
|
-
* - if the total number of items is less than the threshold, then consolidated mode will be used.
|
454
|
-
* - if the total number of items is equal or greater than the threshold, then normal mode will be used.
|
455
|
-
*
|
456
|
-
* If the threshold is 0, then auto consolidation is disabled.
|
457
|
-
*
|
458
|
-
* For example, imagine you're displaying a list of contacts.
|
459
|
-
* You might setup a view like this:
|
460
|
-
*
|
461
|
-
* view = @{
|
462
|
-
* @"A" : @[ @"Allison Jones" ],
|
463
|
-
* @"B" : @[ @"Billy Bob", @"Brandon Allen" ],
|
464
|
-
* @"R" : @[ @"Ricky Bobby" ]
|
465
|
-
* }
|
466
|
-
*
|
467
|
-
* The total number of contacts is only 4. So it might look better to display them without sections.
|
468
|
-
* However, you're going to want to switch to sections at some point. Perhaps when the total count reaches 10?
|
469
|
-
*
|
470
|
-
* It would be nice if there was something to handle this for you.
|
471
|
-
* And even better if that something would help you properly animate the tableView
|
472
|
-
* when switching between no-sections & sections (and vice versa).
|
473
|
-
* This is exactly what the autoConsolidateGroupsThreshold does for you!
|
474
|
-
*
|
475
|
-
* The default threshold value is 0 (disabled).
|
476
|
-
**/
|
477
|
-
|
478
|
-
- (void)setAutoConsolidateGroupsThreshold:(NSUInteger)threshold withName:(NSString *)consolidatedGroupName;
|
479
|
-
- (NSUInteger)autoConsolidateGroupsThreshold;
|
480
|
-
- (NSString *)consolidatedGroupName;
|
481
|
-
|
482
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
483
|
-
#pragma mark Initialization & Updates
|
484
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
485
|
-
|
486
|
-
/**
|
487
|
-
* You have to call this method to initialize the mappings.
|
488
|
-
* This method uses the given transaction to fetch and cache the counts for each group.
|
489
|
-
*
|
490
|
-
* This class is designed to be used with the method getSectionChanges:rowChanges:forNotifications:withMappings:.
|
491
|
-
* That method needs the 'before' & 'after' snapshot of the mappings in order to calculate the proper changeset.
|
492
|
-
* In order to get this, it automatically invokes this method.
|
493
|
-
*
|
494
|
-
* Thus you only have to manually invoke this method once.
|
495
|
-
* Aftewards, it should be invoked for you.
|
496
|
-
*
|
497
|
-
* Please see the example code above.
|
498
|
-
**/
|
499
|
-
- (void)updateWithTransaction:(YapDatabaseReadTransaction *)transaction;
|
500
|
-
|
501
|
-
/**
|
502
|
-
* Returns the snapshot of the last time the mappings were initialized/updated.
|
503
|
-
*
|
504
|
-
* This method is primarily for internal use.
|
505
|
-
* When the changesets are being calculated from the notifications & mappings,
|
506
|
-
* this property is consulted to ensure the mappings match the notifications.
|
507
|
-
*
|
508
|
-
* Everytime the updateWithTransaction method is invoked,
|
509
|
-
* this property will be set to transaction.abstractConnection.snapshot.
|
510
|
-
*
|
511
|
-
* If never initialized/updated, the snapshot will be UINT64_MAX.
|
512
|
-
*
|
513
|
-
* @see YapDatabaseConnection snapshot
|
514
|
-
**/
|
515
|
-
@property (nonatomic, readonly) uint64_t snapshotOfLastUpdate;
|
516
|
-
|
517
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
518
|
-
#pragma mark Getters
|
519
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
520
|
-
|
521
|
-
/**
|
522
|
-
* Returns the actual number of visible sections.
|
523
|
-
*
|
524
|
-
* This number may be less than the original count of groups passed in the init method.
|
525
|
-
* That is, if dynamic sections are enabled for one or more groups, and some of these groups have zero items,
|
526
|
-
* then those groups will be removed from the visible list of groups. And thus the section count may be less.
|
527
|
-
**/
|
528
|
-
- (NSUInteger)numberOfSections;
|
529
|
-
|
530
|
-
/**
|
531
|
-
* Returns the number of items in the given section.
|
532
|
-
* @see groupForSection
|
533
|
-
**/
|
534
|
-
- (NSUInteger)numberOfItemsInSection:(NSUInteger)section;
|
535
|
-
|
536
|
-
/**
|
537
|
-
* Returns the number of items in the given group.
|
538
|
-
*
|
539
|
-
* This is the cached value from the last time one of the following methods was invoked:
|
540
|
-
* - updateWithTransaction:
|
541
|
-
* - changesForNotifications:withMappings:
|
542
|
-
**/
|
543
|
-
- (NSUInteger)numberOfItemsInGroup:(NSString *)group;
|
544
|
-
|
545
|
-
/**
|
546
|
-
* The visibleGroups property returns the current sections setup.
|
547
|
-
* That is, it only contains the visible groups that are being represented as sections in the view.
|
548
|
-
*
|
549
|
-
* If all sections are static, then visibleGroups will always be the same as allGroups.
|
550
|
-
* However, if one or more sections are dynamic, then the visible groups may be a subset of allGroups.
|
551
|
-
*
|
552
|
-
* Dynamic groups/sections automatically "disappear" if/when they become empty.
|
553
|
-
**/
|
554
|
-
- (NSArray *)visibleGroups;
|
555
|
-
|
556
|
-
/**
|
557
|
-
* Returns YES if there are zero items in all sections/groups.
|
558
|
-
**/
|
559
|
-
- (BOOL)isEmpty;
|
560
|
-
|
561
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
562
|
-
#pragma mark Mapping: UI -> View
|
563
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
564
|
-
|
565
|
-
/**
|
566
|
-
* Maps from a section (in the UI) to a group (in the View).
|
567
|
-
*
|
568
|
-
* Returns the group for the given section.
|
569
|
-
* This method properly takes into account dynamic groups.
|
570
|
-
*
|
571
|
-
* If the section is out-of-bounds, returns nil.
|
572
|
-
**/
|
573
|
-
- (NSString *)groupForSection:(NSUInteger)section;
|
574
|
-
|
575
|
-
/**
|
576
|
-
* Maps from an indexPath (in the UI) to a group & index (within the View).
|
577
|
-
*
|
578
|
-
* When your UI doesn't exactly match up with the View in the database, this method does all the math for you.
|
579
|
-
*
|
580
|
-
* For example, if using rangeOptions, the rows in your tableView/collectionView may not
|
581
|
-
* directly match the index in the corresponding view & group (in the database).
|
582
|
-
*
|
583
|
-
* For example, say a view in the database has a group named "elders" and contains 100 items.
|
584
|
-
* A fixed range is used to display only the last 20 items in the "elders" group (the 20 oldest elders).
|
585
|
-
* Thus row zero in the tableView is actually index 80 in the "elders" group.
|
586
|
-
*
|
587
|
-
* So you pass in an indexPath or row & section from the UI perspective,
|
588
|
-
* and it spits out the corresponding index within the database view's group.
|
589
|
-
*
|
590
|
-
* Code sample:
|
591
|
-
*
|
592
|
-
* - (UITableViewCell *)tableView:(UITableView *)sender cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
593
|
-
* {
|
594
|
-
* NSString *group = nil;
|
595
|
-
* NSUInteger groupIndex = 0;
|
596
|
-
*
|
597
|
-
* [mappings getGroup:&group index:&groupIndex forIndexPath:indexPath];
|
598
|
-
*
|
599
|
-
* __block Elder *elder = nil;
|
600
|
-
* [databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
601
|
-
*
|
602
|
-
* elder = [[transaction extension:@"elders"] objectAtIndex:groupIndex inGroup:group];
|
603
|
-
* }];
|
604
|
-
*
|
605
|
-
* // configure and return cell...
|
606
|
-
* }
|
607
|
-
**/
|
608
|
-
- (BOOL)getGroup:(NSString **)groupPtr index:(NSUInteger *)indexPtr forIndexPath:(NSIndexPath *)indexPath;
|
609
|
-
|
610
|
-
/**
|
611
|
-
* Maps from an indexPath (in the UI) to a group & index (within the View).
|
612
|
-
*
|
613
|
-
* When your UI doesn't exactly match up with the View in the database, this method does all the math for you.
|
614
|
-
*
|
615
|
-
* For example, if using rangeOptions, the rows in your tableView/collectionView may not
|
616
|
-
* directly match the index in the corresponding view & group (in the database).
|
617
|
-
*
|
618
|
-
* For example, say a view in the database has a group named "elders" and contains 100 items.
|
619
|
-
* A fixed range is used to display only the last 20 items in the "elders" group (the 20 oldest elders).
|
620
|
-
* Thus row zero in the tableView is actually index 80 in the "elders" group.
|
621
|
-
*
|
622
|
-
* So you pass in an indexPath or row & section from the UI perspective,
|
623
|
-
* and it spits out the corresponding index within the database view's group.
|
624
|
-
*
|
625
|
-
* Code sample:
|
626
|
-
*
|
627
|
-
* - (UITableViewCell *)tableView:(UITableView *)sender cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
628
|
-
* {
|
629
|
-
* NSString *group = nil;
|
630
|
-
* NSUInteger groupIndex = 0;
|
631
|
-
*
|
632
|
-
* [mappings getGroup:&group index:&groupIndex forIndexPath:indexPath];
|
633
|
-
*
|
634
|
-
* __block Elder *elder = nil;
|
635
|
-
* [databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
636
|
-
*
|
637
|
-
* elder = [[transaction extension:@"elders"] objectAtIndex:groupIndex inGroup:group];
|
638
|
-
* }];
|
639
|
-
*
|
640
|
-
* // configure and return cell...
|
641
|
-
* }
|
642
|
-
**/
|
643
|
-
- (BOOL)getGroup:(NSString **)groupPtr
|
644
|
-
index:(NSUInteger *)indexPtr
|
645
|
-
forRow:(NSUInteger)row
|
646
|
-
inSection:(NSUInteger)section;
|
647
|
-
|
648
|
-
/**
|
649
|
-
* Maps from a row & section (in the UI) to an index (within the View).
|
650
|
-
*
|
651
|
-
* This method is shorthand for getGroup:index:forIndexPath: when you already know the group.
|
652
|
-
* @see getGroup:index:forIndexPath:
|
653
|
-
*
|
654
|
-
* Returns NSNotFound if the given row & section are invalid.
|
655
|
-
**/
|
656
|
-
- (NSUInteger)indexForRow:(NSUInteger)row inSection:(NSUInteger)section;
|
657
|
-
|
658
|
-
/**
|
659
|
-
* Maps from a row & section (in the UI) to an index (within the View).
|
660
|
-
*
|
661
|
-
* This method is shorthand for getGroup:index:forIndexPath: when you already know the group.
|
662
|
-
* @see getGroup:index:forIndexPath:
|
663
|
-
*
|
664
|
-
* Returns NSNotFound if the given row & group are invalid.
|
665
|
-
**/
|
666
|
-
- (NSUInteger)indexForRow:(NSUInteger)row inGroup:(NSString *)group;
|
667
|
-
|
668
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
669
|
-
#pragma mark Mapping: View -> UI
|
670
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
671
|
-
|
672
|
-
/**
|
673
|
-
* Maps from a group (in the View) to the corresponding section (in the UI).
|
674
|
-
*
|
675
|
-
* Returns the visible section number for the visible group.
|
676
|
-
* Returns NSNotFound if the group is NOT visible (or invalid).
|
677
|
-
**/
|
678
|
-
- (NSUInteger)sectionForGroup:(NSString *)group;
|
679
|
-
|
680
|
-
/**
|
681
|
-
* Maps from an index & group (in the View) to the corresponding row & section (in the UI).
|
682
|
-
*
|
683
|
-
* Returns YES if the proper row & section were found.
|
684
|
-
* Returns NO if the given index is NOT visible (or out-of-bounds).
|
685
|
-
* Returns NO if the given group is NOT visible (or invalid).
|
686
|
-
**/
|
687
|
-
- (BOOL)getRow:(NSUInteger *)rowPtr
|
688
|
-
section:(NSUInteger *)sectionPtr
|
689
|
-
forIndex:(NSUInteger)index
|
690
|
-
inGroup:(NSString *)group;
|
691
|
-
|
692
|
-
/**
|
693
|
-
* Maps from an index & group (in the View) to the corresponding indexPath (in the UI).
|
694
|
-
*
|
695
|
-
* Returns the indexPath with the proper section and row.
|
696
|
-
* Returns nil if the given index & group is NOT visible (or out-of-bounds).
|
697
|
-
**/
|
698
|
-
- (NSIndexPath *)indexPathForIndex:(NSUInteger)index inGroup:(NSString *)group;
|
699
|
-
|
700
|
-
/**
|
701
|
-
* Maps from an index & group (in the View) to the corresponding row (in the UI).
|
702
|
-
*
|
703
|
-
* This method is shorthand for getRow:section:forIndex:inGroup: when you already know the section.
|
704
|
-
* @see getRow:section:forIndex:inGroup:
|
705
|
-
*
|
706
|
-
* Returns NSNotFound if the given index & group is NOT visible (or out-of-bounds).
|
707
|
-
**/
|
708
|
-
- (NSUInteger)rowForIndex:(NSUInteger)index inGroup:(NSString *)group;
|
709
|
-
|
710
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
711
|
-
#pragma mark Getters + Consolidation
|
712
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
713
|
-
|
714
|
-
/**
|
715
|
-
* Whether or not the groups have been automatically consolidated due to the configured autoConsolidateGroupsThreshold.
|
716
|
-
**/
|
717
|
-
- (BOOL)isUsingConsolidatedGroup;
|
718
|
-
|
719
|
-
/**
|
720
|
-
* Returns the total number of items by summing up the totals across all groups.
|
721
|
-
**/
|
722
|
-
- (NSUInteger)numberOfItemsInAllGroups;
|
723
|
-
|
724
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
725
|
-
#pragma mark Getters + Utilities
|
726
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
727
|
-
|
728
|
-
/**
|
729
|
-
* The YapDatabaseViewRangePosition struct represents the range window within the full group.
|
730
|
-
* For example:
|
731
|
-
*
|
732
|
-
* You have a section in your tableView which represents a group that contains 100 items.
|
733
|
-
* However, you've setup rangeOptions to only display the first 20 items:
|
734
|
-
*
|
735
|
-
* YapDatabaseViewRangeOptions *rangeOptions =
|
736
|
-
* [YapDatabaseViewRangeOptions fixedRangeWithLength:20 offset:0 from:YapDatabaseViewBeginning];
|
737
|
-
* [mappings setRangeOptions:rangeOptions forGroup:@"sales"];
|
738
|
-
*
|
739
|
-
* The corresponding rangePosition would be: (YapDatabaseViewRangePosition){
|
740
|
-
* .offsetFromBeginning = 0,
|
741
|
-
* .offsetFromEnd = 80,
|
742
|
-
* .length = 20
|
743
|
-
* }
|
744
|
-
**/
|
745
|
-
- (YapDatabaseViewRangePosition)rangePositionForGroup:(NSString *)group;
|
746
|
-
|
747
|
-
/**
|
748
|
-
* This is a helper method to assist in maintaining the selection while updating the tableView/collectionView.
|
749
|
-
* In general the idea is this:
|
750
|
-
* - yapDatabaseModified is invoked on the main thread
|
751
|
-
* - at the beginning of the method, you grab some information about the current selection
|
752
|
-
* - you update the database connection, and then start the animation for the changes to the table
|
753
|
-
* - you reselect whatever was previously selected
|
754
|
-
* - if that's not possible (row was deleted) then you select the closest row to the previous selection
|
755
|
-
*
|
756
|
-
* The last step isn't always what you want to do. Maybe you don't want to select anything at that point.
|
757
|
-
* But if you do, then this method can simplify the task for you.
|
758
|
-
*
|
759
|
-
* For example:
|
760
|
-
*
|
761
|
-
* - (void)yapDatabaseModified:(NSNotification *)notification {
|
762
|
-
*
|
763
|
-
* // Grab info about current selection
|
764
|
-
*
|
765
|
-
* NSString *selectedGroup = nil;
|
766
|
-
* NSUInteger selectedRow = 0;
|
767
|
-
* __block NSString *selectedWidgetId = nil;
|
768
|
-
*
|
769
|
-
* NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow];
|
770
|
-
* if (selectedIndexPath) {
|
771
|
-
* selectedGroup = [mappings groupForSection:selectedIndexPath.section];
|
772
|
-
* selectedRow = selectedIndexPath.row;
|
773
|
-
*
|
774
|
-
* [databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
775
|
-
* selectedWidgetId = [[transaction ext:@"widgets"] keyAtIndex:selectedRow inGroup:selectedGroup];
|
776
|
-
* }];
|
777
|
-
* }
|
778
|
-
*
|
779
|
-
* // Update the database connection (move it to the latest commit)
|
780
|
-
*
|
781
|
-
* NSArray *notifications = [databaseConnection beginLongLivedReadTransaction];
|
782
|
-
*
|
783
|
-
* // Process the notification(s),
|
784
|
-
* // and get the changeset as it applies to me, based on my view and my mappings setup.
|
785
|
-
*
|
786
|
-
* NSArray *sectionChanges = nil;
|
787
|
-
* NSArray *rowChanges = nil;
|
788
|
-
*
|
789
|
-
* [[databaseConnection ext:@"order"] getSectionChanges:§ionChanges
|
790
|
-
* rowChanges:&rowChanges
|
791
|
-
* forNotifications:notifications
|
792
|
-
* withMappings:mappings];
|
793
|
-
*
|
794
|
-
* if ([sectionChanges count] == 0 & [rowChanges count] == 0)
|
795
|
-
* {
|
796
|
-
* // Nothing has changed that affects our tableView
|
797
|
-
* return;
|
798
|
-
* }
|
799
|
-
*
|
800
|
-
* // Update the table (animating the changes)
|
801
|
-
*
|
802
|
-
* [self.tableView beginUpdates];
|
803
|
-
*
|
804
|
-
* for (YapDatabaseViewSectionChange *sectionChange in sectionChanges)
|
805
|
-
* {
|
806
|
-
* // ... (see https://github.com/yaptv/YapDatabase/wiki/Views )
|
807
|
-
* }
|
808
|
-
*
|
809
|
-
* for (YapDatabaseViewRowChange *rowChange in rowChanges)
|
810
|
-
* {
|
811
|
-
* // ... (see https://github.com/yaptv/YapDatabase/wiki/Views )
|
812
|
-
* }
|
813
|
-
*
|
814
|
-
* [self.tableView endUpdates];
|
815
|
-
*
|
816
|
-
* // Try to reselect whatever was selected before
|
817
|
-
*
|
818
|
-
* __block NSIndexPath *indexPath = nil;
|
819
|
-
*
|
820
|
-
* if (selectedIndexPath) {
|
821
|
-
* [databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
822
|
-
* indexPath = [[transaction ext:@"widgets"] indexPathForKey:selectedWidgetId
|
823
|
-
* withMappings:mappings];
|
824
|
-
* }];
|
825
|
-
* }
|
826
|
-
*
|
827
|
-
* // Otherwise select the nearest row to whatever was selected before
|
828
|
-
*
|
829
|
-
* if (!indexPath && selectedGroup) {
|
830
|
-
* indexPath = [mappings nearestIndexPathForRow:selectedRow inGroup:selectedGroup];
|
831
|
-
* }
|
832
|
-
*
|
833
|
-
* if (indexPath) {
|
834
|
-
* [self.tableView selectRowAtIndexPath:indexPath
|
835
|
-
* animated:NO
|
836
|
-
* scrollPosition:UITableViewScrollPositionMiddle];
|
837
|
-
* }
|
838
|
-
* }
|
839
|
-
**/
|
840
|
-
- (NSIndexPath *)nearestIndexPathForRow:(NSUInteger)row inGroup:(NSString *)group;
|
841
|
-
|
842
|
-
@end
|