Skip to content

Commit

Permalink
remove swift-algorithms package in favor of manully importing needed …
Browse files Browse the repository at this point in the history
…functions
  • Loading branch information
pmairoldi committed Jun 8, 2023
1 parent 51468ce commit 796f785
Show file tree
Hide file tree
Showing 15 changed files with 178 additions and 79 deletions.
40 changes: 19 additions & 21 deletions Charts.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 53;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -14,6 +14,8 @@
05253AFC448C107DEF54C2FE /* CombinedChartRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52265C1B343CCC41AF2300E3 /* CombinedChartRenderer.swift */; };
0529DD51622C8769C1121F90 /* CrossShapeRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 823F7DB281C6C6F069A69605 /* CrossShapeRenderer.swift */; };
0577C2B38BCE4C871F262714 /* AnimatedZoomViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C2EA58CB336967198D30D20 /* AnimatedZoomViewJob.swift */; };
063093AC2A323CE500216FFB /* Indexed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 063093AB2A323CE400216FFB /* Indexed.swift */; };
063093AE2A323E5E00216FFB /* Partition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 063093AD2A323E5E00216FFB /* Partition.swift */; };
064989461F5C99C7006E8BB3 /* Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 064989451F5C99C7006E8BB3 /* Utilities.swift */; };
06AB297F20FA726600BAD505 /* Highlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06AB297E20FA726500BAD505 /* Highlighter.swift */; };
0A772AEC08246FEC480673E5 /* PieRadarChartViewBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A6C9631C69B2D772BBD9232 /* PieRadarChartViewBase.swift */; };
Expand All @@ -29,7 +31,6 @@
221CA2922588FCBC00C2DD1E /* Sequence+KeyPath.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221CA2912588FCBC00C2DD1E /* Sequence+KeyPath.swift */; };
2243BBFD1FF156EC00B49D0B /* EquatableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2243BBFB1FF156D000B49D0B /* EquatableTests.swift */; };
22786E8525CD96620051335B /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 22786E8325CD96620051335B /* Media.xcassets */; };
228D56232554F27A00BEE75E /* Algorithms in Frameworks */ = {isa = PBXBuildFile; productRef = 228D56222554F27A00BEE75E /* Algorithms */; };
22BBDA0825CC4C2F00435670 /* SnapshotTesting in Frameworks */ = {isa = PBXBuildFile; productRef = 22BBDA0725CC4C2F00435670 /* SnapshotTesting */; };
23649EFC635A76022F07FFA6 /* PieChartDataEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD02157CF8CEE1189BF681DA /* PieChartDataEntry.swift */; };
23FA50B2730D8C7ACA091C4F /* BarChartRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75F279974FE650E57A061B09 /* BarChartRenderer.swift */; };
Expand Down Expand Up @@ -179,6 +180,8 @@
0216EDC6A1FE272F4EB19FCF /* DataRenderer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DataRenderer.swift; path = Source/Charts/Renderers/DataRenderer.swift; sourceTree = "<group>"; };
04F7B9DF1F2D66E7279771D4 /* PieRadarHighlighter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PieRadarHighlighter.swift; path = Source/Charts/Highlight/PieRadarHighlighter.swift; sourceTree = "<group>"; };
0619A877C69A95ECCC440A44 /* LineChartView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LineChartView.swift; path = Source/Charts/Charts/LineChartView.swift; sourceTree = "<group>"; };
063093AB2A323CE400216FFB /* Indexed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Indexed.swift; sourceTree = "<group>"; };
063093AD2A323E5E00216FFB /* Partition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Partition.swift; sourceTree = "<group>"; };
064989451F5C99C7006E8BB3 /* Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utilities.swift; sourceTree = "<group>"; };
06AB297E20FA726500BAD505 /* Highlighter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Highlighter.swift; path = Source/Charts/Highlight/Highlighter.swift; sourceTree = "<group>"; };
0BD9DF16AF59680A3BB49452 /* AxisValueFormatter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AxisValueFormatter.swift; path = Source/Charts/Formatters/AxisValueFormatter.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -347,7 +350,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
228D56232554F27A00BEE75E /* Algorithms in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -659,6 +661,8 @@
FF475B9593B9898853814340 /* Transformer.swift */,
324C9127B53A8D39C8B49277 /* TransformerHorizontalBarChart.swift */,
72EAEBB7CF73E33565FC2896 /* ViewPortHandler.swift */,
063093AB2A323CE400216FFB /* Indexed.swift */,
063093AD2A323E5E00216FFB /* Partition.swift */,
);
name = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -754,7 +758,6 @@
);
name = DGCharts;
packageProductDependencies = (
228D56222554F27A00BEE75E /* Algorithms */,
);
productName = Charts;
productReference = 65AD9E95D9ED4DC0BD73A743 /* DGCharts.framework */;
Expand Down Expand Up @@ -787,8 +790,9 @@
193FC8DF32D250560C5F5D77 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 1400;
LastUpgradeCheck = 1430;
TargetAttributes = {
A58A4ED274A941CA248EA921 = {
LastSwiftMigration = 1150;
Expand All @@ -808,7 +812,6 @@
);
mainGroup = 865A1CF149F52850CAB7F177;
packageReferences = (
228D56212554F27A00BEE75E /* XCRemoteSwiftPackageReference "swift-algorithms" */,
22BBDA0625CC4C2F00435670 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */,
);
productRefGroup = AB2D554102718F209377399E /* Products */;
Expand Down Expand Up @@ -864,6 +867,7 @@
DBC9DB402CC9BB84B76968C4 /* Description.swift in Sources */,
03960E8148C6AEDACE4B77CC /* Marker.swift in Sources */,
ECE7EAE7179A7F57CE9BBD8F /* Legend.swift in Sources */,
063093AE2A323E5E00216FFB /* Partition.swift in Sources */,
C9F3DC272355F791000C3215 /* Platform+Gestures.swift in Sources */,
C20A62D8CB9120523D5FB650 /* LegendEntry.swift in Sources */,
369DEB23452CB436A3A1A644 /* MarkerImage.swift in Sources */,
Expand Down Expand Up @@ -913,6 +917,7 @@
FAAD9FF6565DED2652188584 /* PieChartDataSetProtocol.swift in Sources */,
83BBAF3EDC31FD452F8BF1DB /* RadarChartDataSetProtocol.swift in Sources */,
50476F8E6662CAFC1EFE0723 /* ScatterChartDataSetProtocol.swift in Sources */,
063093AC2A323CE500216FFB /* Indexed.swift in Sources */,
97E033CC0ABEF0F448DAFA8E /* DataApproximator.swift in Sources */,
779B46E9F13A087BFA47D539 /* DefaultAxisValueFormatter.swift in Sources */,
F744C510DA9B85C228BBB335 /* DefaultFillFormatter.swift in Sources */,
Expand Down Expand Up @@ -1029,6 +1034,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_VERSION = A;
GCC_NO_COMMON_BLOCKS = YES;
Expand All @@ -1040,8 +1046,10 @@
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
MARKETING_VERSION = 4.1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.dcg.Charts;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1219,6 +1227,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_VERSION = A;
GCC_NO_COMMON_BLOCKS = YES;
Expand All @@ -1230,8 +1239,10 @@
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
MARKETING_VERSION = 4.1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.dcg.Charts;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -1312,14 +1323,6 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
228D56212554F27A00BEE75E /* XCRemoteSwiftPackageReference "swift-algorithms" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/apple/swift-algorithms";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
};
};
22BBDA0625CC4C2F00435670 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/pointfreeco/swift-snapshot-testing";
Expand All @@ -1331,11 +1334,6 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
228D56222554F27A00BEE75E /* Algorithms */ = {
isa = XCSwiftPackageProductDependency;
package = 228D56212554F27A00BEE75E /* XCRemoteSwiftPackageReference "swift-algorithms" */;
productName = Algorithms;
};
22BBDA0725CC4C2F00435670 /* SnapshotTesting */ = {
isa = XCSwiftPackageProductDependency;
package = 22BBDA0625CC4C2F00435670 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */;
Expand Down
2 changes: 1 addition & 1 deletion Charts.xcodeproj/xcshareddata/xcschemes/DGCharts.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
22 changes: 2 additions & 20 deletions Charts.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,30 +1,12 @@
{
"pins" : [
{
"identity" : "swift-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-algorithms",
"state" : {
"revision" : "b14b7f4c528c942f121c8b860b9410b2bf57825e",
"version" : "1.0.0"
}
},
{
"identity" : "swift-numerics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-numerics",
"state" : {
"revision" : "0a5bc04095a675662cf24757cc0640aa2204253b",
"version" : "1.0.2"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "f8a9c997c3c1dab4e216a8ec9014e23144cbab37",
"version" : "1.9.0"
"revision" : "cef5b3f6f11781dd4591bdd1dd0a3d22bd609334",
"version" : "1.11.0"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
1 change: 0 additions & 1 deletion DGCharts.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ Pod::Spec.new do |s|

s.subspec "Core" do |ss|
ss.source_files = "Source/Charts/**/*.swift"
ss.dependency 'SwiftAlgorithms', '~> 1.0'
end
end
101 changes: 101 additions & 0 deletions Indexed.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Algorithms open source project
//
// Copyright (c) 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//

/// A collection wrapper that iterates over the indices and elements of a
/// collection together.
struct IndexedCollection<Base: Collection> {
/// The base collection.
let base: Base

init(base: Base) {
self.base = base
}
}

extension IndexedCollection: Collection {
/// The element type for an `IndexedCollection` collection.
typealias Element = (index: Base.Index, element: Base.Element)

var startIndex: Base.Index {
base.startIndex
}

var endIndex: Base.Index {
base.endIndex
}

subscript(position: Base.Index) -> Element {
(index: position, element: base[position])
}

func index(after i: Base.Index) -> Base.Index {
base.index(after: i)
}

func index(_ i: Base.Index, offsetBy distance: Int) -> Base.Index {
base.index(i, offsetBy: distance)
}

func index(
_ i: Base.Index,
offsetBy distance: Int,
limitedBy limit: Base.Index
) -> Base.Index? {
base.index(i, offsetBy: distance, limitedBy: limit)
}

func distance(from start: Base.Index, to end: Base.Index) -> Int {
base.distance(from: start, to: end)
}

var indices: Base.Indices {
base.indices
}
}

//extension IndexedCollection: BidirectionalCollection
// where Base: BidirectionalCollection
//{
// func index(before i: Base.Index) -> Base.Index {
// base.index(before: i)
// }
//}
//
//extension IndexedCollection: RandomAccessCollection
// where Base: RandomAccessCollection {}
//
//extension IndexedCollection: LazySequenceProtocol, LazyCollectionProtocol
// where Base: LazySequenceProtocol {}

//===----------------------------------------------------------------------===//
// indexed()
//===----------------------------------------------------------------------===//

extension Collection {
/// Returns a collection of pairs *(i, x)*, where *i* represents an index of
/// the collection, and *x* represents an element.
///
/// This example iterates over the indices and elements of a set, building an
/// array consisting of indices of names with five or fewer letters.
///
/// let names: Set = ["Sofia", "Camilla", "Martina", "Mateo", "Nicolás"]
/// var shorterIndices: [Set<String>.Index] = []
/// for (i, name) in names.indexed() {
/// if name.count <= 5 {
/// shorterIndices.append(i)
/// }
/// }
///
/// Returns: A collection of paired indices and elements of this collection.
func indexed() -> IndexedCollection<Self> {
IndexedCollection(base: self)
}
}
25 changes: 0 additions & 25 deletions Package.resolved

This file was deleted.

4 changes: 0 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@ let package = Package(
type: .dynamic,
targets: ["DGCharts"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-algorithms", from: "1.0.0")
],
targets: [
.target(
name: "DGCharts",
dependencies: [.product(name: "Algorithms", package: "swift-algorithms")],
path: "Source/Charts"
)
],
Expand Down
Loading

0 comments on commit 796f785

Please sign in to comment.