From cdbd6fd818e3d95f94d6042ccbab4f88ce671443 Mon Sep 17 00:00:00 2001 From: saltzmanjoelh Date: Tue, 17 Jul 2018 15:49:09 -0700 Subject: [PATCH 01/14] Updated TableViewDiffCalculator to run processChanges on main thread --- Dwifft/Dwifft+AppKit.swift | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Dwifft/Dwifft+AppKit.swift b/Dwifft/Dwifft+AppKit.swift index a3831a1..cc76df9 100644 --- a/Dwifft/Dwifft+AppKit.swift +++ b/Dwifft/Dwifft+AppKit.swift @@ -51,16 +51,26 @@ public final class TableViewDiffCalculator: AbstractDiffCalcul override internal func processChanges(newState: SectionedValues, diff: [SectionedDiffStep]) { guard let tableView = self.tableView else { return } - tableView.beginUpdates() - self._sectionedValues = newState - for result in diff { - switch result { - case let .delete(_, row, _): tableView.removeRows(at: [row], withAnimation: self.deletionAnimation) - case let .insert(_, row, _): tableView.insertRows(at: [row], withAnimation: self.insertionAnimation) - default: fatalError("NSTableViews do not have sections") + let updateAction = { + tableView.beginUpdates() + self._sectionedValues = newState + for result in diff { + switch result { + case let .delete(_, row, _): tableView.removeRows(at: [row], withAnimation: self.deletionAnimation) + case let .insert(_, row, _): tableView.insertRows(at: [row], withAnimation: self.insertionAnimation) + default: fatalError("NSTableViews do not have sections") + } + } + tableView.endUpdates() + } + if Thread.current.isMainThread { + updateAction() + } else { + DispatchQueue.main.sync { + updateAction() } } - tableView.endUpdates() + } } From f807f95f041e214f17c0c66cfbe58c1eba95ee66 Mon Sep 17 00:00:00 2001 From: saltzmanjoelh Date: Thu, 26 Jul 2018 09:39:28 -0700 Subject: [PATCH 02/14] Fixed build errors regarding --- Dwifft/Dwifft+AppKit.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dwifft/Dwifft+AppKit.swift b/Dwifft/Dwifft+AppKit.swift index cc76df9..6114100 100644 --- a/Dwifft/Dwifft+AppKit.swift +++ b/Dwifft/Dwifft+AppKit.swift @@ -79,6 +79,7 @@ public final class TableViewDiffCalculator: AbstractDiffCalcul /// use a `SingleSectionCollectionViewDiffCalculator`. Note that this approach is not highly recommended, and you should /// do so only if it *really* doesn't make sense to just power your whole view with a `CollectionViewDiffCalculator`. /// You'll be less likely to mess up the index math :P +@available(OSX 10.11, *) public final class SingleSectionCollectionViewDiffCalculator { /// The collection view to be managed @@ -119,6 +120,7 @@ public final class SingleSectionCollectionViewDiffCalculator { /// This class manages a `NSCollectionView`'s items and sections. It will make the necessary /// calls to the collection view to ensure that its UI is kept in sync with the contents /// of the `sectionedValues` property. +@available(OSX 10.11, *) public final class CollectionViewDiffCalculator : AbstractDiffCalculator { /// The collection view to be managed. @@ -164,6 +166,7 @@ public final class CollectionViewDiffCalculator #endif From 7f56728868e1ba5b78adad0f37c6ade384c8ffa0 Mon Sep 17 00:00:00 2001 From: Joel Saltzman Date: Tue, 18 Sep 2018 18:09:13 -0700 Subject: [PATCH 03/14] Project update --- Dwifft.xcodeproj/project.pbxproj | 14 +++++++++----- .../xcshareddata/xcschemes/Dwifft-macOS.xcscheme | 4 +--- .../xcshareddata/xcschemes/Dwifft-tvOS.xcscheme | 4 +--- .../xcshareddata/xcschemes/Dwifft.xcscheme | 8 +++----- .../DwifftExample.xcodeproj/project.pbxproj | 6 +++++- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Dwifft.xcodeproj/project.pbxproj b/Dwifft.xcodeproj/project.pbxproj index 6542a34..590ead8 100644 --- a/Dwifft.xcodeproj/project.pbxproj +++ b/Dwifft.xcodeproj/project.pbxproj @@ -359,7 +359,7 @@ attributes = { LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1000; ORGANIZATIONNAME = jflinter; TargetAttributes = { 041EBB911B89679200E113B3 = { @@ -536,12 +536,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -594,12 +596,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -732,7 +736,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "com.jflinter.Dwifft-macOS"; PRODUCT_NAME = Dwifft; - SDKROOT = macosx10.13; + SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -767,7 +771,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = "com.jflinter.Dwifft-macOS"; PRODUCT_NAME = Dwifft; - SDKROOT = macosx10.13; + SDKROOT = macosx; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.0; @@ -789,7 +793,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.jflinter.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx10.13; + SDKROOT = macosx; SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 4.0; }; @@ -806,7 +810,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.jflinter.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx10.13; + SDKROOT = macosx; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 4.0; diff --git a/Dwifft.xcodeproj/xcshareddata/xcschemes/Dwifft-macOS.xcscheme b/Dwifft.xcodeproj/xcshareddata/xcschemes/Dwifft-macOS.xcscheme index f1717bf..6de1915 100644 --- a/Dwifft.xcodeproj/xcshareddata/xcschemes/Dwifft-macOS.xcscheme +++ b/Dwifft.xcodeproj/xcshareddata/xcschemes/Dwifft-macOS.xcscheme @@ -1,6 +1,6 @@ @@ -37,7 +36,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Dwifft.xcodeproj/xcshareddata/xcschemes/Dwifft.xcscheme b/Dwifft.xcodeproj/xcshareddata/xcschemes/Dwifft.xcscheme index 28b227b..62b4488 100644 --- a/Dwifft.xcodeproj/xcshareddata/xcschemes/Dwifft.xcscheme +++ b/Dwifft.xcodeproj/xcshareddata/xcschemes/Dwifft.xcscheme @@ -1,6 +1,6 @@ + codeCoverageEnabled = "YES" + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -71,7 +70,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/DwifftExample/DwifftExample.xcodeproj/project.pbxproj b/DwifftExample/DwifftExample.xcodeproj/project.pbxproj index a1c0d9f..36f5762 100644 --- a/DwifftExample/DwifftExample.xcodeproj/project.pbxproj +++ b/DwifftExample/DwifftExample.xcodeproj/project.pbxproj @@ -296,7 +296,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0910; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1000; ORGANIZATIONNAME = jflinter; TargetAttributes = { 045501F21B898C3200F5614D = { @@ -481,12 +481,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -534,12 +536,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; From 1a614c6ddd9dfcf985e9d770e8f280224347faa5 Mon Sep 17 00:00:00 2001 From: Joel Saltzman Date: Tue, 18 Sep 2018 18:16:06 -0700 Subject: [PATCH 04/14] swift 4.2 --- Package.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Package.swift b/Package.swift index d0d14aa..9f8ddce 100644 --- a/Package.swift +++ b/Package.swift @@ -1,3 +1,4 @@ +// swift-tools-version:4.2 import PackageDescription let package = Package( From dae8bf13e78339db9e225ee52bd26c11cf04ba33 Mon Sep 17 00:00:00 2001 From: Joel Saltzman Date: Tue, 18 Sep 2018 18:27:23 -0700 Subject: [PATCH 05/14] Updated package --- Package.swift | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/Package.swift b/Package.swift index 9f8ddce..2abce65 100644 --- a/Package.swift +++ b/Package.swift @@ -1,15 +1,39 @@ // swift-tools-version:4.2 +// The swift-tools-version declares the minimum version of Swift required to build this package. + import PackageDescription let package = Package( name: "Dwifft", - dependencies : [], - exclude: [ - "Carthage", - "DwifftTests", - "DwifftExample", - "docs", - "Dwifft.xcworkspace", - "scripts", - ] +// exclude: [ +// "Carthage", +// "DwifftTests", +// "DwifftExample", +// "docs", +// "Dwifft.xcworkspace", +// "scripts", +// ], + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "Dwifft", + targets: ["Dwifft"] + ) + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "Dwifft", + dependencies: [], + path: "Dwifft"), + .testTarget( + name: "DwifftTests", + dependencies: ["Dwifft"], + path: "DwifftTests"), + ] ) From 55306cc7f3a31db68b4a54df04ddf54c14532577 Mon Sep 17 00:00:00 2001 From: saltzmanjoelh Date: Mon, 15 Oct 2018 15:23:23 -0700 Subject: [PATCH 06/14] Added handler for reloading rows without insert animation --- Dwifft/AbstractDiffCalculator.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dwifft/AbstractDiffCalculator.swift b/Dwifft/AbstractDiffCalculator.swift index 9db51ca..9ff8cce 100644 --- a/Dwifft/AbstractDiffCalculator.swift +++ b/Dwifft/AbstractDiffCalculator.swift @@ -76,6 +76,10 @@ public class AbstractDiffCalculator { let diff = Dwifft.diff(lhs: oldSectionedValues, rhs: newSectionedValues) if (diff.count > 0) { self.processChanges(newState: newSectionedValues, diff: diff) + } else { + //There might be rows that need to be reloaded but we don't want to display a .insert animation for them. + //Update the internal _sectionedValues so that when we access the rows property, we get the updated rows + self._sectionedValues = newSectionedValues } } } From 3a601de231aab435604c36c0a9a524f3f4e9d437 Mon Sep 17 00:00:00 2001 From: saltzmanjoelh Date: Mon, 14 Jan 2019 07:36:23 -0800 Subject: [PATCH 07/14] Update Dwifft+AppKit.swift Switched update action on main thread to be async instead of sync --- Dwifft/Dwifft+AppKit.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dwifft/Dwifft+AppKit.swift b/Dwifft/Dwifft+AppKit.swift index 6114100..e1eaa8e 100644 --- a/Dwifft/Dwifft+AppKit.swift +++ b/Dwifft/Dwifft+AppKit.swift @@ -66,7 +66,7 @@ public final class TableViewDiffCalculator: AbstractDiffCalcul if Thread.current.isMainThread { updateAction() } else { - DispatchQueue.main.sync { + DispatchQueue.main.async { updateAction() } } From 9f24bda25c9799d4eb0ee0b3557c7327cea4a040 Mon Sep 17 00:00:00 2001 From: saltzmanjoelh Date: Mon, 14 Jan 2019 12:47:49 -0800 Subject: [PATCH 08/14] Update Dwifft+AppKit.swift Fixed a synchronization issue where UI internal _sectionedValues aren't in sync --- Dwifft/Dwifft+AppKit.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dwifft/Dwifft+AppKit.swift b/Dwifft/Dwifft+AppKit.swift index e1eaa8e..3fab8cb 100644 --- a/Dwifft/Dwifft+AppKit.swift +++ b/Dwifft/Dwifft+AppKit.swift @@ -50,10 +50,10 @@ public final class TableViewDiffCalculator: AbstractDiffCalcul } override internal func processChanges(newState: SectionedValues, diff: [SectionedDiffStep]) { + self._sectionedValues = newState guard let tableView = self.tableView else { return } let updateAction = { tableView.beginUpdates() - self._sectionedValues = newState for result in diff { switch result { case let .delete(_, row, _): tableView.removeRows(at: [row], withAnimation: self.deletionAnimation) From 3e867837d86b7d2b0e81af15e2debaa405ecf9ac Mon Sep 17 00:00:00 2001 From: saltzmanjoelh Date: Fri, 18 Jan 2019 08:05:59 -0800 Subject: [PATCH 09/14] Update Dwifft+AppKit.swift --- Dwifft/Dwifft+AppKit.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dwifft/Dwifft+AppKit.swift b/Dwifft/Dwifft+AppKit.swift index 3fab8cb..b829bcb 100644 --- a/Dwifft/Dwifft+AppKit.swift +++ b/Dwifft/Dwifft+AppKit.swift @@ -66,7 +66,7 @@ public final class TableViewDiffCalculator: AbstractDiffCalcul if Thread.current.isMainThread { updateAction() } else { - DispatchQueue.main.async { + DispatchQueue.main.sync { updateAction() } } From 4382768e8e815d03f2a2eadf95fd008d34caf256 Mon Sep 17 00:00:00 2001 From: saltzmanjoelh Date: Wed, 21 Aug 2019 11:37:21 -0700 Subject: [PATCH 10/14] Update AbstractDiffCalculator.swift --- Dwifft/AbstractDiffCalculator.swift | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Dwifft/AbstractDiffCalculator.swift b/Dwifft/AbstractDiffCalculator.swift index 9ff8cce..9fdfbe0 100644 --- a/Dwifft/AbstractDiffCalculator.swift +++ b/Dwifft/AbstractDiffCalculator.swift @@ -74,13 +74,7 @@ public class AbstractDiffCalculator { let oldSectionedValues = sectionedValues let newSectionedValues = newValue let diff = Dwifft.diff(lhs: oldSectionedValues, rhs: newSectionedValues) - if (diff.count > 0) { - self.processChanges(newState: newSectionedValues, diff: diff) - } else { - //There might be rows that need to be reloaded but we don't want to display a .insert animation for them. - //Update the internal _sectionedValues so that when we access the rows property, we get the updated rows - self._sectionedValues = newSectionedValues - } + self.processChanges(newState: newSectionedValues, diff: diff) } } From e91baa184955598be9a6d39000060babc803dec0 Mon Sep 17 00:00:00 2001 From: saltzmanjoelh Date: Wed, 21 Aug 2019 11:37:56 -0700 Subject: [PATCH 11/14] Update Dwifft+AppKit.swift --- Dwifft/Dwifft+AppKit.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dwifft/Dwifft+AppKit.swift b/Dwifft/Dwifft+AppKit.swift index b829bcb..5e446b6 100644 --- a/Dwifft/Dwifft+AppKit.swift +++ b/Dwifft/Dwifft+AppKit.swift @@ -52,7 +52,7 @@ public final class TableViewDiffCalculator: AbstractDiffCalcul override internal func processChanges(newState: SectionedValues, diff: [SectionedDiffStep]) { self._sectionedValues = newState guard let tableView = self.tableView else { return } - let updateAction = { + var updateAction = { tableView.beginUpdates() for result in diff { switch result { @@ -63,6 +63,11 @@ public final class TableViewDiffCalculator: AbstractDiffCalcul } tableView.endUpdates() } + if diff.count == 0 { + //There might be rows that need to be reloaded but we don't want to display a .insert animation for them. + //Update the internal _sectionedValues so that when we access the rows property, we get the updated rows + updateAction = { tableView.reloadData() } + } if Thread.current.isMainThread { updateAction() } else { From 40df82736ab21be282ea6cc6b1121d6c8f0202e1 Mon Sep 17 00:00:00 2001 From: Joel Saltzman Date: Tue, 18 Aug 2020 15:30:04 -0700 Subject: [PATCH 12/14] Swift 5.3 updates --- Dwifft.xcodeproj/project.pbxproj | 31 ++++++++++++++----- .../xcschemes/Dwifft-macOS.xcscheme | 15 +-------- .../xcschemes/Dwifft-tvOS.xcscheme | 6 +--- .../xcshareddata/xcschemes/Dwifft.xcscheme | 19 ++---------- Dwifft/Dwifft+UIKit.swift | 6 ++-- Dwifft/Dwifft.swift | 12 +++---- Dwifft/SectionedValues.swift | 2 +- .../DwifftExample.xcodeproj/project.pbxproj | 16 ++++++---- Package.swift | 10 +++--- 9 files changed, 53 insertions(+), 64 deletions(-) diff --git a/Dwifft.xcodeproj/project.pbxproj b/Dwifft.xcodeproj/project.pbxproj index 590ead8..b6e66a8 100644 --- a/Dwifft.xcodeproj/project.pbxproj +++ b/Dwifft.xcodeproj/project.pbxproj @@ -359,7 +359,7 @@ attributes = { LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 1000; + LastUpgradeCheck = 1200; ORGANIZATIONNAME = jflinter; TargetAttributes = { 041EBB911B89679200E113B3 = { @@ -374,6 +374,8 @@ CreatedOnToolsVersion = 9.0; LastSwiftMigration = 0900; }; + 38E5B5D21F7BDB5400F33285 = { + }; 94783CAC1EFBA21900841579 = { CreatedOnToolsVersion = 9.0; LastSwiftMigration = 0910; @@ -382,10 +384,11 @@ }; buildConfigurationList = 041EBB8C1B89679200E113B3 /* Build configuration list for PBXProject "Dwifft" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 041EBB881B89679200E113B3; productRefGroup = 041EBB931B89679200E113B3 /* Products */; @@ -528,6 +531,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -546,6 +550,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -572,7 +577,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -588,6 +593,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -606,6 +612,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -625,7 +632,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_VERSION = 3.0.1; @@ -639,7 +646,9 @@ 041EBBA91B89679200E113B3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -657,7 +666,9 @@ 041EBBAA1B89679200E113B3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; @@ -676,6 +687,7 @@ 041EBBAC1B89679200E113B3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/iOS", @@ -695,6 +707,7 @@ 041EBBAD1B89679200E113B3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/iOS", @@ -717,7 +730,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_IDENTITY = "Apple Development"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; @@ -753,7 +766,7 @@ CLANG_ENABLE_MODULES = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_IDENTITY = "Apple Development"; COMBINE_HIDPI_IMAGES = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -781,6 +794,7 @@ 38E5B5E01F7BDB5400F33285 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/Mac", @@ -802,6 +816,7 @@ 38E5B5E11F7BDB5400F33285 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_IDENTITY = "Apple Development"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Carthage/Build/Mac", @@ -847,7 +862,7 @@ SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.0; + TVOS_DEPLOYMENT_TARGET = 12.0; }; name = Debug; }; @@ -880,7 +895,7 @@ SWIFT_SWIFT3_OBJC_INFERENCE = Default; SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.0; + TVOS_DEPLOYMENT_TARGET = 12.0; }; name = Release; }; diff --git a/Dwifft.xcodeproj/xcshareddata/xcschemes/Dwifft-macOS.xcscheme b/Dwifft.xcodeproj/xcshareddata/xcschemes/Dwifft-macOS.xcscheme index 6de1915..f3b5c11 100644 --- a/Dwifft.xcodeproj/xcshareddata/xcschemes/Dwifft-macOS.xcscheme +++ b/Dwifft.xcodeproj/xcshareddata/xcschemes/Dwifft-macOS.xcscheme @@ -1,6 +1,6 @@ - - - - - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> @@ -54,17 +54,6 @@ - - - - - - - - /// You can change insertion/deletion animations like this! Fade works well. /// So does Top/Bottom. Left/Right/Middle are a little weird, but hey, do your thing. - public var insertionAnimation = UITableViewRowAnimation.automatic, deletionAnimation = UITableViewRowAnimation.automatic + public var insertionAnimation = UITableView.RowAnimation.automatic, deletionAnimation = UITableView.RowAnimation.automatic override internal func processChanges(newState: SectionedValues, diff: [SectionedDiffStep]) { guard let tableView = self.tableView else { return } @@ -106,13 +106,13 @@ public final class SingleSectionTableViewDiffCalculator { /// You can change insertion/deletion animations like this! Fade works well. /// So does Top/Bottom. Left/Right/Middle are a little weird, but hey, do your thing. - public var insertionAnimation = UITableViewRowAnimation.automatic { + public var insertionAnimation = UITableView.RowAnimation.automatic { didSet { self.internalDiffCalculator.insertionAnimation = self.insertionAnimation } } - public var deletionAnimation = UITableViewRowAnimation.automatic { + public var deletionAnimation = UITableView.RowAnimation.automatic { didSet { self.internalDiffCalculator.deletionAnimation = self.deletionAnimation } diff --git a/Dwifft/Dwifft.swift b/Dwifft/Dwifft.swift index 188d037..78e8b48 100644 --- a/Dwifft/Dwifft.swift +++ b/Dwifft/Dwifft.swift @@ -36,10 +36,10 @@ public enum DiffStep : CustomDebugStringConvertible { /// The value to be inserted or deleted. public var value: Value { switch(self) { - case let .insert(j): - return j.1 - case let .delete(j): - return j.1 + case let .insert(_, k): + return k + case let .delete(_, k): + return k } } } @@ -309,13 +309,13 @@ public extension Array where Element: Equatable { /// Deprecated in favor of `Dwifft.diff`. @available(*, deprecated) - public func diff(_ other: [Element]) -> [DiffStep] { + func diff(_ other: [Element]) -> [DiffStep] { return Dwifft.diff(self, other) } /// Deprecated in favor of `Dwifft.apply`. @available(*, deprecated) - public func apply(_ diff: [DiffStep]) -> [Element] { + func apply(_ diff: [DiffStep]) -> [Element] { return Dwifft.apply(diff: diff, toArray: self) } diff --git a/Dwifft/SectionedValues.swift b/Dwifft/SectionedValues.swift index d87eac0..0556d90 100644 --- a/Dwifft/SectionedValues.swift +++ b/Dwifft/SectionedValues.swift @@ -72,7 +72,7 @@ public extension SectionedValues where Section: Hashable { /// should be sorted before the second. Used to sort the sections in the returned `SectionedValues`. /// - sortValues: A function that compares two values, and returns true if the first /// should be sorted before the second. Used to sort the values in each section of the returned `SectionedValues`. - public init( + init( values: [Value], valueToSection: ((Value) -> Section), sortSections: ((Section, Section) -> Bool), diff --git a/DwifftExample/DwifftExample.xcodeproj/project.pbxproj b/DwifftExample/DwifftExample.xcodeproj/project.pbxproj index 36f5762..d1c6193 100644 --- a/DwifftExample/DwifftExample.xcodeproj/project.pbxproj +++ b/DwifftExample/DwifftExample.xcodeproj/project.pbxproj @@ -296,7 +296,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0910; - LastUpgradeCheck = 1000; + LastUpgradeCheck = 1200; ORGANIZATIONNAME = jflinter; TargetAttributes = { 045501F21B898C3200F5614D = { @@ -311,7 +311,7 @@ }; buildConfigurationList = 045501EE1B898C3200F5614D /* Build configuration list for PBXProject "DwifftExample" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -473,6 +473,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -491,6 +492,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -516,7 +518,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -528,6 +530,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -546,6 +549,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -564,7 +568,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -581,7 +585,7 @@ IBSC_NOTICES = NO; IBSC_WARNINGS = NO; INFOPLIST_FILE = "DwifftExample-iOS/Supporting Files/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.jflinter.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -599,7 +603,7 @@ IBSC_NOTICES = NO; IBSC_WARNINGS = NO; INFOPLIST_FILE = "DwifftExample-iOS/Supporting Files/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.jflinter.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Package.swift b/Package.swift index 2abce65..6c2ab1d 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:4.2 +// swift-tools-version:5.3 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -31,9 +31,9 @@ let package = Package( name: "Dwifft", dependencies: [], path: "Dwifft"), - .testTarget( - name: "DwifftTests", - dependencies: ["Dwifft"], - path: "DwifftTests"), +// .testTarget( +// name: "DwifftTests", +// dependencies: ["Dwifft"], +// path: "DwifftTests"), ] ) From 95758727434165554b369979a243686e63511f75 Mon Sep 17 00:00:00 2001 From: Joel Saltzman Date: Tue, 18 Aug 2020 15:33:36 -0700 Subject: [PATCH 13/14] Removed file causing cli error --- Dwifft/Info.plist | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 Dwifft/Info.plist diff --git a/Dwifft/Info.plist b/Dwifft/Info.plist deleted file mode 100644 index d3de8ee..0000000 --- a/Dwifft/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - From 7daa82944fd7218fc7af85587a1bae86ec4ca626 Mon Sep 17 00:00:00 2001 From: Joel Saltzman Date: Mon, 31 Aug 2020 09:37:34 -0700 Subject: [PATCH 14/14] Swift 5.2 --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 6c2ab1d..7fde369 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.2 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription