Skip to content

Commit

Permalink
Section is now renamed to ArraySection
Browse files Browse the repository at this point in the history
  • Loading branch information
ra1028 committed Aug 21, 2018
1 parent 470ea34 commit e6fe3c0
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 147 deletions.
20 changes: 10 additions & 10 deletions DifferenceKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
6B2DF878210E2C12004D2D40 /* DifferenceKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B2DF86E210E2C12004D2D40 /* DifferenceKit.framework */; };
6B5B409C211066BF00A931DB /* AlgorithmTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B4093211066BF00A931DB /* AlgorithmTest.swift */; };
6B5B409D211066BF00A931DB /* SectionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B4094211066BF00A931DB /* SectionTest.swift */; };
6B5B409D211066BF00A931DB /* ArraySectionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B4094211066BF00A931DB /* ArraySectionTest.swift */; };
6B5B409E211066BF00A931DB /* StagedChangesetTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B4095211066BF00A931DB /* StagedChangesetTest.swift */; };
6B5B409F211066BF00A931DB /* AnyDifferentiableTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B4096211066BF00A931DB /* AnyDifferentiableTest.swift */; };
6B5B40A0211066BF00A931DB /* ElementPathTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B4097211066BF00A931DB /* ElementPathTest.swift */; };
Expand All @@ -21,7 +21,7 @@
6B5B40A7211066EA00A931DB /* DifferentiableSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B408E211066B300A931DB /* DifferentiableSection.swift */; };
6B5B40A8211066EA00A931DB /* Changeset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B408F211066B300A931DB /* Changeset.swift */; };
6B5B40A9211066EA00A931DB /* StagedChangeset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B408C211066B300A931DB /* StagedChangeset.swift */; };
6B5B40AA211066EA00A931DB /* Section.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B408A211066B300A931DB /* Section.swift */; };
6B5B40AA211066EA00A931DB /* ArraySection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B408A211066B300A931DB /* ArraySection.swift */; };
6B5B40AB211066EA00A931DB /* AnyDifferentiable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B408B211066B300A931DB /* AnyDifferentiable.swift */; };
6B5B40AC211066EA00A931DB /* ElementPath.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B408D211066B300A931DB /* ElementPath.swift */; };
6B956B762110B25300DE3D29 /* UIKitExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5B4088211066B300A931DB /* UIKitExtension.swift */; };
Expand All @@ -43,7 +43,7 @@
6B2DF88A210E39A8004D2D40 /* DifferenceKit.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DifferenceKit.xcconfig; sourceTree = "<group>"; };
6B5B4086211066B300A931DB /* Algorithm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Algorithm.swift; sourceTree = "<group>"; };
6B5B4088211066B300A931DB /* UIKitExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIKitExtension.swift; sourceTree = "<group>"; };
6B5B408A211066B300A931DB /* Section.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Section.swift; sourceTree = "<group>"; };
6B5B408A211066B300A931DB /* ArraySection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArraySection.swift; sourceTree = "<group>"; };
6B5B408B211066B300A931DB /* AnyDifferentiable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyDifferentiable.swift; sourceTree = "<group>"; };
6B5B408C211066B300A931DB /* StagedChangeset.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StagedChangeset.swift; sourceTree = "<group>"; };
6B5B408D211066B300A931DB /* ElementPath.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementPath.swift; sourceTree = "<group>"; };
Expand All @@ -52,7 +52,7 @@
6B5B4090211066B300A931DB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6B5B4091211066B300A931DB /* Differentiable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Differentiable.swift; sourceTree = "<group>"; };
6B5B4093211066BF00A931DB /* AlgorithmTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlgorithmTest.swift; sourceTree = "<group>"; };
6B5B4094211066BF00A931DB /* SectionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SectionTest.swift; sourceTree = "<group>"; };
6B5B4094211066BF00A931DB /* ArraySectionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArraySectionTest.swift; sourceTree = "<group>"; };
6B5B4095211066BF00A931DB /* StagedChangesetTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StagedChangesetTest.swift; sourceTree = "<group>"; };
6B5B4096211066BF00A931DB /* AnyDifferentiableTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyDifferentiableTest.swift; sourceTree = "<group>"; };
6B5B4097211066BF00A931DB /* ElementPathTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ElementPathTest.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -113,12 +113,12 @@
children = (
6B5B4087211066B300A931DB /* UIExtensions */,
6B5B4086211066B300A931DB /* Algorithm.swift */,
6B5B4091211066B300A931DB /* Differentiable.swift */,
6B5B408E211066B300A931DB /* DifferentiableSection.swift */,
6B5B408F211066B300A931DB /* Changeset.swift */,
6B5B408C211066B300A931DB /* StagedChangeset.swift */,
6B5B408A211066B300A931DB /* Section.swift */,
6B5B4091211066B300A931DB /* Differentiable.swift */,
6B5B408E211066B300A931DB /* DifferentiableSection.swift */,
6B5B408B211066B300A931DB /* AnyDifferentiable.swift */,
6B5B408A211066B300A931DB /* ArraySection.swift */,
6B5B408D211066B300A931DB /* ElementPath.swift */,
6B5B4090211066B300A931DB /* Info.plist */,
);
Expand All @@ -137,7 +137,7 @@
isa = PBXGroup;
children = (
6B5B4093211066BF00A931DB /* AlgorithmTest.swift */,
6B5B4094211066BF00A931DB /* SectionTest.swift */,
6B5B4094211066BF00A931DB /* ArraySectionTest.swift */,
6B5B4095211066BF00A931DB /* StagedChangesetTest.swift */,
6B5B4096211066BF00A931DB /* AnyDifferentiableTest.swift */,
6B5B4097211066BF00A931DB /* ElementPathTest.swift */,
Expand Down Expand Up @@ -264,7 +264,7 @@
6B5B40A5211066EA00A931DB /* Algorithm.swift in Sources */,
6B5B40AC211066EA00A931DB /* ElementPath.swift in Sources */,
6B5B40A6211066EA00A931DB /* Differentiable.swift in Sources */,
6B5B40AA211066EA00A931DB /* Section.swift in Sources */,
6B5B40AA211066EA00A931DB /* ArraySection.swift in Sources */,
6B5B40A9211066EA00A931DB /* StagedChangeset.swift in Sources */,
6B5B40A7211066EA00A931DB /* DifferentiableSection.swift in Sources */,
);
Expand All @@ -279,7 +279,7 @@
6B5B40A0211066BF00A931DB /* ElementPathTest.swift in Sources */,
6B5B40A4211066BF00A931DB /* TestTools.swift in Sources */,
6B5B40A2211066BF00A931DB /* MeasurementTest.swift in Sources */,
6B5B409D211066BF00A931DB /* SectionTest.swift in Sources */,
6B5B409D211066BF00A931DB /* ArraySectionTest.swift in Sources */,
6B5B409F211066BF00A931DB /* AnyDifferentiableTest.swift in Sources */,
6B5B409E211066BF00A931DB /* StagedChangesetTest.swift in Sources */,
);
Expand Down
16 changes: 8 additions & 8 deletions Sources/Section.swift → Sources/ArraySection.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// A generic differentiable section.
/// A differentiable section with model and array of elements.
///
/// Arrays are can not be identify each one and comparing whether has updated from other one.
/// Section is a generic wrapper to hold a model and elements to allow it.
public struct Section<Model: Differentiable, Element: Differentiable>: DifferentiableSection {
/// ArraySection is a generic wrapper to hold a model to allow it.
public struct ArraySection<Model: Differentiable, Element: Differentiable>: DifferentiableSection {
/// The model of section for differentiated with other section.
public var model: Model
/// The array of element in the section.
Expand All @@ -28,7 +28,7 @@ public struct Section<Model: Differentiable, Element: Differentiable>: Different
/// - Parameters:
/// - source: A source section to reproduce.
/// - elements: The collection of elements for the new section.
public init<C: Collection>(source: Section, elements: C) where C.Element == Element {
public init<C: Collection>(source: ArraySection, elements: C) where C.Element == Element {
self.init(model: source.model, elements: elements)
}

Expand All @@ -42,18 +42,18 @@ public struct Section<Model: Differentiable, Element: Differentiable>: Different
///
/// - Returns: A Boolean value indicating whether the content of `self` is equals
/// to the content of the given source section.
public func isContentEqual(to source: Section) -> Bool {
public func isContentEqual(to source: ArraySection) -> Bool {
return model.isContentEqual(to: source.model)
}
}

extension Section: Equatable where Model: Equatable, Element: Equatable {
public static func == (lhs: Section, rhs: Section) -> Bool {
extension ArraySection: Equatable where Model: Equatable, Element: Equatable {
public static func == (lhs: ArraySection, rhs: ArraySection) -> Bool {
return lhs.model == rhs.model && lhs.elements == rhs.elements
}
}

extension Section: CustomDebugStringConvertible {
extension ArraySection: CustomDebugStringConvertible {
public var debugDescription: String {
guard !elements.isEmpty else {
return "Section(model: \(model), elements: [])"
Expand Down
Loading

0 comments on commit e6fe3c0

Please sign in to comment.