From d72e891d59226268e094cf04aaf705cdff74b718 Mon Sep 17 00:00:00 2001 From: Max Lampert Date: Thu, 6 Oct 2016 12:00:32 -0700 Subject: [PATCH 1/4] Executing beginUpdates for tableView in didChange where we are passing it in a weak reference. --- .../Core/Extensions/UITableViewExtensions.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/AlecrimCoreData/Core/Extensions/UITableViewExtensions.swift b/Source/AlecrimCoreData/Core/Extensions/UITableViewExtensions.swift index 1b29a49..6d3f236 100644 --- a/Source/AlecrimCoreData/Core/Extensions/UITableViewExtensions.swift +++ b/Source/AlecrimCoreData/Core/Extensions/UITableViewExtensions.swift @@ -46,9 +46,6 @@ extension FetchRequestController { if !reloadData { // reset() - - // - tableView.beginUpdates() } } .didInsertSection { sectionInfo, sectionIndex in @@ -124,6 +121,7 @@ extension FetchRequestController { reset() } else { + tableView.beginUpdates() if deletedSectionIndexes.count > 0 { tableView.deleteSections(deletedSectionIndexes, withRowAnimation: rowAnimation) } From 67442ef622b70b142f4cc27502677f95da6186d0 Mon Sep 17 00:00:00 2001 From: Vanderlei Martinelli Date: Thu, 6 Oct 2016 18:12:06 -0300 Subject: [PATCH 2/4] Minor adjustments --- .../Core/Extensions/NSCollectionViewExtensions.swift | 8 +------- .../Core/Extensions/UICollectionViewExtensions.swift | 8 +------- .../Core/Extensions/UITableViewExtensions.swift | 10 +++++----- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/Source/AlecrimCoreData/Core/Extensions/NSCollectionViewExtensions.swift b/Source/AlecrimCoreData/Core/Extensions/NSCollectionViewExtensions.swift index efcb202..58ef39c 100644 --- a/Source/AlecrimCoreData/Core/Extensions/NSCollectionViewExtensions.swift +++ b/Source/AlecrimCoreData/Core/Extensions/NSCollectionViewExtensions.swift @@ -45,13 +45,7 @@ extension FetchRequestController { } .willChangeContent { if !reloadData { - insertedSectionIndexes.removeAllIndexes() - deletedSectionIndexes.removeAllIndexes() - updatedSectionIndexes.removeAllIndexes() - - insertedItemIndexPaths.removeAll(keepCapacity: false) - deletedItemIndexPaths.removeAll(keepCapacity: false) - updatedItemIndexPaths.removeAll(keepCapacity: false) + reset() } } .didInsertSection { sectionInfo, sectionIndex in diff --git a/Source/AlecrimCoreData/Core/Extensions/UICollectionViewExtensions.swift b/Source/AlecrimCoreData/Core/Extensions/UICollectionViewExtensions.swift index 75c27da..86a74b7 100644 --- a/Source/AlecrimCoreData/Core/Extensions/UICollectionViewExtensions.swift +++ b/Source/AlecrimCoreData/Core/Extensions/UICollectionViewExtensions.swift @@ -44,13 +44,7 @@ extension FetchRequestController { } .willChangeContent { if !reloadData { - insertedSectionIndexes.removeAllIndexes() - deletedSectionIndexes.removeAllIndexes() - updatedSectionIndexes.removeAllIndexes() - - insertedItemIndexPaths.removeAll(keepCapacity: false) - deletedItemIndexPaths.removeAll(keepCapacity: false) - updatedItemIndexPaths.removeAll(keepCapacity: false) + reset() } } .didInsertSection { sectionInfo, sectionIndex in diff --git a/Source/AlecrimCoreData/Core/Extensions/UITableViewExtensions.swift b/Source/AlecrimCoreData/Core/Extensions/UITableViewExtensions.swift index 6d3f236..3b498c2 100644 --- a/Source/AlecrimCoreData/Core/Extensions/UITableViewExtensions.swift +++ b/Source/AlecrimCoreData/Core/Extensions/UITableViewExtensions.swift @@ -44,7 +44,6 @@ extension FetchRequestController { } .willChangeContent { if !reloadData { - // reset() } } @@ -109,19 +108,22 @@ extension FetchRequestController { } } .didChangeContent { [weak tableView] in + // + defer { reset() } + + // guard let tableView = tableView else { - reset() return } // if reloadData { tableView.reloadData() - reset() } else { tableView.beginUpdates() + if deletedSectionIndexes.count > 0 { tableView.deleteSections(deletedSectionIndexes, withRowAnimation: rowAnimation) } @@ -155,8 +157,6 @@ extension FetchRequestController { } } } - - reset() } } From 3d37c2e96e09ec597b971b61c7241369a8f36bba Mon Sep 17 00:00:00 2001 From: Vanderlei Martinelli Date: Thu, 6 Oct 2016 18:19:24 -0300 Subject: [PATCH 3/4] Updated version --- AlecrimCoreData.podspec | 2 +- Source/AlecrimCoreData.xcodeproj/project.pbxproj | 4 ++-- Source/AlecrimCoreData/Info.plist | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AlecrimCoreData.podspec b/AlecrimCoreData.podspec index f3c6b68..bb18ec9 100644 --- a/AlecrimCoreData.podspec +++ b/AlecrimCoreData.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "AlecrimCoreData" - s.version = "4.2.4" + s.version = "4.2.5" s.summary = "A powerful and simple Core Data wrapper framework written in Swift." s.homepage = "https://github.com/Alecrim/AlecrimCoreData" diff --git a/Source/AlecrimCoreData.xcodeproj/project.pbxproj b/Source/AlecrimCoreData.xcodeproj/project.pbxproj index 8c05d33..3645deb 100644 --- a/Source/AlecrimCoreData.xcodeproj/project.pbxproj +++ b/Source/AlecrimCoreData.xcodeproj/project.pbxproj @@ -415,7 +415,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 581; + CURRENT_PROJECT_VERSION = 583; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -439,7 +439,7 @@ APPLICATION_EXTENSION_API_ONLY = YES; CLANG_ENABLE_MODULES = YES; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 581; + CURRENT_PROJECT_VERSION = 583; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; diff --git a/Source/AlecrimCoreData/Info.plist b/Source/AlecrimCoreData/Info.plist index 9c043a8..41b5841 100644 --- a/Source/AlecrimCoreData/Info.plist +++ b/Source/AlecrimCoreData/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.2.4 + 4.2.5 CFBundleSignature ???? CFBundleVersion From 971a82b08212d16cc85903182bad32d2fb7005b0 Mon Sep 17 00:00:00 2001 From: Vanderlei Martinelli Date: Thu, 6 Oct 2016 18:19:43 -0300 Subject: [PATCH 4/4] Updated README --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e9db0cc..912c3fe 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ ![AlecrimCoreData](https://raw.githubusercontent.com/Alecrim/AlecrimCoreData/master/AlecrimCoreData.png) -[![Language: Swift](https://img.shields.io/badge/lang-Swift-orange.svg?style=flat)](https://developer.apple.com/swift/) +[![Language: Swift](https://img.shields.io/badge/lang-Swift 2.3-orange.svg?style=flat)](https://developer.apple.com/swift/) +[![Platform](https://img.shields.io/cocoapods/p/AlecrimCoreData.svg?style=flat)](http://cocoadocs.org/docsets/AlecrimCoreData) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/Alecrim/AlecrimCoreData/develop/LICENSE) [![CocoaPods](https://img.shields.io/cocoapods/v/AlecrimCoreData.svg?style=flat)](http://cocoapods.org) -[![Forks](https://img.shields.io/github/forks/Alecrim/AlecrimCoreData.svg?style=flat)](https://github.com/Alecrim/AlecrimCoreData/network) -[![Stars](https://img.shields.io/github/stars/Alecrim/AlecrimCoreData.svg?style=flat)](https://github.com/Alecrim/AlecrimCoreData/stargazers) +[![Apps](https://img.shields.io/cocoapods/at/AlecrimCoreData.svg?style=flat)](http://cocoadocs.org/docsets/AlecrimCoreData) +[![Twitter](https://img.shields.io/badge/twitter-@vmartinelli-blue.svg?style=flat)](https://twitter.com/vmartinelli) A powerful and simple Core Data wrapper framework written in Swift. @@ -297,7 +298,7 @@ Since **AlecrimCoreData** version 4 the `DataContext` is an `NSManagedObjectCont - Swift 2.3 - Xcode 8 -- OS X 10.9 / iOS 8.0 / watchOS 2.0 +- OS X 10.10 / iOS 8.0 / tvOS 9.0 / watchOS 2.0 ### Installation @@ -314,11 +315,12 @@ $ gem install cocoapods To integrate AlecrimCoreData into your Xcode project using CocoaPods, specify it in your `Podfile`: ```ruby -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '8.0' +platform :ios, '9.0' use_frameworks! -pod 'AlecrimCoreData' +target '' do + pod 'AlecrimCoreData', '4.2.5' +end ``` Then, run the following command: