diff --git a/Example/Cartfile b/Cartfile.private similarity index 62% rename from Example/Cartfile rename to Cartfile.private index 309f09c..bb9bd71 100644 --- a/Example/Cartfile +++ b/Cartfile.private @@ -1,3 +1,2 @@ github "Quick/Nimble" "v2.0.0" github "Quick/Quick" "v0.6.0" -github "realm/realm-cocoa" "v0.95.3" diff --git a/Example/Cartfile.resolved b/Cartfile.resolved similarity index 100% rename from Example/Cartfile.resolved rename to Cartfile.resolved diff --git a/Example/RealmResultsController.xcodeproj/project.pbxproj b/RealmResultsController.xcodeproj/project.pbxproj similarity index 97% rename from Example/RealmResultsController.xcodeproj/project.pbxproj rename to RealmResultsController.xcodeproj/project.pbxproj index ba31a3f..13692e9 100644 --- a/Example/RealmResultsController.xcodeproj/project.pbxproj +++ b/RealmResultsController.xcodeproj/project.pbxproj @@ -91,7 +91,7 @@ 6A1010FB1B74A83600321CE6 /* RealmSection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RealmSection.swift; path = ../../Source/RealmSection.swift; sourceTree = ""; }; 6A1010FD1B74C5BB00321CE6 /* RealmSectionSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmSectionSpec.swift; sourceTree = ""; }; 6A1010FF1B74C92200321CE6 /* RealmExtensionSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmExtensionSpec.swift; sourceTree = ""; }; - 6A29729B1BC55D6C004D9EC9 /* RealmThreadHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmThreadHelper.swift; sourceTree = ""; }; + 6A29729B1BC55D6C004D9EC9 /* RealmThreadHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RealmThreadHelper.swift; path = ../../Source/RealmThreadHelper.swift; sourceTree = ""; }; 6A5F153D1B736D5300250E29 /* test.realm */ = {isa = PBXFileReference; lastKnownFileType = file; path = test.realm; sourceTree = ""; }; 6A68B20B1B735CFB007645A7 /* RealmResultsCacheTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmResultsCacheTests.swift; sourceTree = ""; }; C11D6BE71B7A0F72000B8398 /* RealmChange.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RealmChange.swift; path = ../../Source/RealmChange.swift; sourceTree = ""; }; @@ -203,7 +203,8 @@ C18C376D1B72670F008DE6A6 /* LaunchScreen.storyboard */, C18C37701B72670F008DE6A6 /* Info.plist */, ); - path = RealmResultsController; + name = RealmResultsController; + path = Example/RealmResultsController; sourceTree = ""; }; C1A0028C1B9702C1000C0E8C /* RealmResultsController-iOS */ = { @@ -222,7 +223,8 @@ 6A29729B1BC55D6C004D9EC9 /* RealmThreadHelper.swift */, C1A0028F1B9702C1000C0E8C /* Info.plist */, ); - path = "RealmResultsController-iOS"; + name = "RealmResultsController-iOS"; + path = "Example/RealmResultsController-iOS"; sourceTree = ""; }; C1A0029A1B9702C2000C0E8C /* RealmResultsController-iOSTests */ = { @@ -240,7 +242,8 @@ 6A5F153D1B736D5300250E29 /* test.realm */, C1A0029D1B9702C2000C0E8C /* Info.plist */, ); - path = "RealmResultsController-iOSTests"; + name = "RealmResultsController-iOSTests"; + path = "Example/RealmResultsController-iOSTests"; sourceTree = ""; }; /* End PBXGroup section */ @@ -577,7 +580,7 @@ "$(PROJECT_DIR)/RealmResultsController/Frameworks", "$(PROJECT_DIR)/Carthage/Build/iOS", ); - INFOPLIST_FILE = RealmResultsController/Info.plist; + INFOPLIST_FILE = Example/RealmResultsController/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = redbooth.RealmResultsController; @@ -594,7 +597,7 @@ "$(PROJECT_DIR)/RealmResultsController/Frameworks", "$(PROJECT_DIR)/Carthage/Build/iOS", ); - INFOPLIST_FILE = RealmResultsController/Info.plist; + INFOPLIST_FILE = Example/RealmResultsController/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = redbooth.RealmResultsController; @@ -615,7 +618,7 @@ "$(PROJECT_DIR)/RealmResultsController/Frameworks", "$(PROJECT_DIR)/Carthage/Build/iOS", ); - INFOPLIST_FILE = "RealmResultsController-iOS/Info.plist"; + INFOPLIST_FILE = "Example/RealmResultsController-iOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -640,7 +643,7 @@ "$(PROJECT_DIR)/RealmResultsController/Frameworks", "$(PROJECT_DIR)/Carthage/Build/iOS", ); - INFOPLIST_FILE = "RealmResultsController-iOS/Info.plist"; + INFOPLIST_FILE = "Example/RealmResultsController-iOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -660,7 +663,7 @@ "$(PROJECT_DIR)/RealmResultsController/Frameworks", "$(PROJECT_DIR)/Carthage/Build/iOS", ); - INFOPLIST_FILE = "RealmResultsController-iOSTests/Info.plist"; + INFOPLIST_FILE = "Example/RealmResultsController-iOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "redbooth.RealmResultsController-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -676,7 +679,7 @@ "$(PROJECT_DIR)/RealmResultsController/Frameworks", "$(PROJECT_DIR)/Carthage/Build/iOS", ); - INFOPLIST_FILE = "RealmResultsController-iOSTests/Info.plist"; + INFOPLIST_FILE = "Example/RealmResultsController-iOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "redbooth.RealmResultsController-iOSTests"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Example/RealmResultsController.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/RealmResultsController.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from Example/RealmResultsController.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to RealmResultsController.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/Example/RealmResultsController.xcodeproj/xcshareddata/xcschemes/RealmResultsController-iOS.xcscheme b/RealmResultsController.xcodeproj/xcshareddata/xcschemes/RealmResultsController-iOS.xcscheme similarity index 100% rename from Example/RealmResultsController.xcodeproj/xcshareddata/xcschemes/RealmResultsController-iOS.xcscheme rename to RealmResultsController.xcodeproj/xcshareddata/xcschemes/RealmResultsController-iOS.xcscheme diff --git a/Source/RealmResultsController.swift b/Source/RealmResultsController.swift index 3b1feea..17fef29 100644 --- a/Source/RealmResultsController.swift +++ b/Source/RealmResultsController.swift @@ -205,6 +205,7 @@ public class RealmResultsController : RealmResultsCacheDelegate { - returns: the objects count at the sectionIndex */ public func numberOfObjectsAt(sectionIndex: Int) -> Int { + if cache.sections.count == 0 { return 0 } return cache.sections[sectionIndex].objects.count } diff --git a/Example/RealmResultsController-iOS/RealmThreadHelper.swift b/Source/RealmThreadHelper.swift similarity index 100% rename from Example/RealmResultsController-iOS/RealmThreadHelper.swift rename to Source/RealmThreadHelper.swift