Skip to content

Commit b9fa7f0

Browse files
committed
Extends primitive types with IdentifiableType.
1 parent 0d683e0 commit b9fa7f0

File tree

5 files changed

+133
-8
lines changed

5 files changed

+133
-8
lines changed

Example/Example1_CustomizationUsingTableViewDelegate.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ extension MySection : AnimatableSectionModelType {
3030
}
3131
}
3232

33-
extension Int : IdentifiableType {
34-
public typealias Identity = Int
35-
36-
public var identity : Int {
37-
return self
38-
}
39-
}
40-
4133
class CustomizationUsingTableViewDelegate : UIViewController {
4234
@IBOutlet var tableView: UITableView!
4335

RxDataSources.xcodeproj/project.pbxproj

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,17 @@
3636
9FF3014B1C4AA6D1007376BD /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FF301491C4AA6D1007376BD /* RxSwift.framework */; };
3737
9FF3014E1C4AA6DA007376BD /* RxCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FF3014C1C4AA6DA007376BD /* RxCocoa.framework */; };
3838
9FF301501C4AA6DA007376BD /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FF3014D1C4AA6DA007376BD /* RxSwift.framework */; };
39+
C814E8F51D29DB4F00837FE1 /* String+IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C814E8F41D29DB4F00837FE1 /* String+IdentifiableType.swift */; };
40+
C814E8F61D29DB4F00837FE1 /* String+IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C814E8F41D29DB4F00837FE1 /* String+IdentifiableType.swift */; };
41+
C814E8F71D29DB4F00837FE1 /* String+IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C814E8F41D29DB4F00837FE1 /* String+IdentifiableType.swift */; };
3942
C8153A501CC6C2F40050C990 /* Example1_CustomizationUsingTableViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8153A4F1CC6C2F40050C990 /* Example1_CustomizationUsingTableViewDelegate.swift */; };
4043
C8153A511CC6C2F70050C990 /* Example1_CustomizationUsingTableViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8153A4F1CC6C2F40050C990 /* Example1_CustomizationUsingTableViewDelegate.swift */; };
44+
C8477FB91D29DBC90074454A /* IntegerType+IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8477FB81D29DBC90074454A /* IntegerType+IdentifiableType.swift */; };
45+
C8477FBA1D29DBC90074454A /* IntegerType+IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8477FB81D29DBC90074454A /* IntegerType+IdentifiableType.swift */; };
46+
C8477FBB1D29DBC90074454A /* IntegerType+IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8477FB81D29DBC90074454A /* IntegerType+IdentifiableType.swift */; };
47+
C8477FBD1D29DCE20074454A /* FloatingPointType+IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8477FBC1D29DCE20074454A /* FloatingPointType+IdentifiableType.swift */; };
48+
C8477FBE1D29DCE20074454A /* FloatingPointType+IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8477FBC1D29DCE20074454A /* FloatingPointType+IdentifiableType.swift */; };
49+
C8477FBF1D29DCE20074454A /* FloatingPointType+IdentifiableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C8477FBC1D29DCE20074454A /* FloatingPointType+IdentifiableType.swift */; };
4150
C85EE5571C36F1FC0090614D /* Changeset.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85EE5481C36F1FC0090614D /* Changeset.swift */; };
4251
C85EE5581C36F1FC0090614D /* CollectionViewSectionedDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85EE5491C36F1FC0090614D /* CollectionViewSectionedDataSource.swift */; };
4352
C85EE55A1C36F1FC0090614D /* Differentiator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C85EE54B1C36F1FC0090614D /* Differentiator.swift */; };
@@ -191,7 +200,10 @@
191200
9FF3014D1C4AA6DA007376BD /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = Carthage/Build/iOS/RxSwift.framework; sourceTree = "<group>"; };
192201
A66428182C504F0369D6A3F2 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; };
193202
B472785F652B32605A7A6838 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = "<group>"; };
203+
C814E8F41D29DB4F00837FE1 /* String+IdentifiableType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+IdentifiableType.swift"; sourceTree = "<group>"; };
194204
C8153A4F1CC6C2F40050C990 /* Example1_CustomizationUsingTableViewDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Example1_CustomizationUsingTableViewDelegate.swift; sourceTree = "<group>"; };
205+
C8477FB81D29DBC90074454A /* IntegerType+IdentifiableType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "IntegerType+IdentifiableType.swift"; sourceTree = "<group>"; };
206+
C8477FBC1D29DCE20074454A /* FloatingPointType+IdentifiableType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FloatingPointType+IdentifiableType.swift"; sourceTree = "<group>"; };
195207
C85EE5481C36F1FC0090614D /* Changeset.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Changeset.swift; sourceTree = "<group>"; };
196208
C85EE5491C36F1FC0090614D /* CollectionViewSectionedDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewSectionedDataSource.swift; sourceTree = "<group>"; };
197209
C85EE54B1C36F1FC0090614D /* Differentiator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Differentiator.swift; sourceTree = "<group>"; };
@@ -381,6 +393,9 @@
381393
C85EE54F1C36F1FC0090614D /* TableViewSectionedDataSource.swift */,
382394
C8BB762B1C4C3CDF002B21C8 /* UI+SectionedViewType.swift */,
383395
C8CC634C1CCF8492006AE8CE /* Array+Extensions.swift */,
396+
C814E8F41D29DB4F00837FE1 /* String+IdentifiableType.swift */,
397+
C8477FB81D29DBC90074454A /* IntegerType+IdentifiableType.swift */,
398+
C8477FBC1D29DCE20074454A /* FloatingPointType+IdentifiableType.swift */,
384399
);
385400
path = DataSources;
386401
sourceTree = "<group>";
@@ -799,6 +814,7 @@
799814
9FCDA1761C3AF4A2000F5F94 /* RxTableViewSectionedAnimatedDataSource.swift in Sources */,
800815
C8BB76391C4C3CDF002B21C8 /* ItemPath.swift in Sources */,
801816
C8BB76311C4C3CDF002B21C8 /* AnimatableSectionModelType+ItemPath.swift in Sources */,
817+
C8477FBF1D29DCE20074454A /* FloatingPointType+IdentifiableType.swift in Sources */,
802818
C8CC634F1CCF8492006AE8CE /* Array+Extensions.swift in Sources */,
803819
9FCDA1751C3AF4A2000F5F94 /* RxCollectionViewSectionedReloadDataSource.swift in Sources */,
804820
C8BB76351C4C3CDF002B21C8 /* IdentifiableType.swift in Sources */,
@@ -808,6 +824,7 @@
808824
C8BB762F1C4C3CDF002B21C8 /* AnimatableSectionModelType.swift in Sources */,
809825
9FCDA16E1C3AF4A2000F5F94 /* Differentiator.swift in Sources */,
810826
9FCDA1781C3AF4A2000F5F94 /* UISectionedViewType+RxAnimatedDataSource.swift in Sources */,
827+
C8477FBB1D29DBC90074454A /* IntegerType+IdentifiableType.swift in Sources */,
811828
9FCDA1771C3AF4A2000F5F94 /* RxTableViewSectionedReloadDataSource.swift in Sources */,
812829
9FCDA16C1C3AF4A2000F5F94 /* CollectionViewSectionedDataSource.swift in Sources */,
813830
9FCDA1721C3AF4A2000F5F94 /* TableViewSectionedDataSource.swift in Sources */,
@@ -818,6 +835,7 @@
818835
9FCDA16B1C3AF4A2000F5F94 /* Changeset.swift in Sources */,
819836
9FCDA1701C3AF4A2000F5F94 /* SectionModel.swift in Sources */,
820837
C8BB763D1C4C3CDF002B21C8 /* UI+SectionedViewType.swift in Sources */,
838+
C814E8F71D29DB4F00837FE1 /* String+IdentifiableType.swift in Sources */,
821839
);
822840
runOnlyForDeploymentPostprocessing = 0;
823841
};
@@ -828,6 +846,7 @@
828846
C85EE5621C36F1FC0090614D /* RxTableViewSectionedAnimatedDataSource.swift in Sources */,
829847
C8BB76381C4C3CDF002B21C8 /* ItemPath.swift in Sources */,
830848
C8BB76301C4C3CDF002B21C8 /* AnimatableSectionModelType+ItemPath.swift in Sources */,
849+
C8477FBE1D29DCE20074454A /* FloatingPointType+IdentifiableType.swift in Sources */,
831850
C8CC634E1CCF8492006AE8CE /* Array+Extensions.swift in Sources */,
832851
C85EE5611C36F1FC0090614D /* RxCollectionViewSectionedReloadDataSource.swift in Sources */,
833852
C8BB76341C4C3CDF002B21C8 /* IdentifiableType.swift in Sources */,
@@ -837,6 +856,7 @@
837856
C8BB762E1C4C3CDF002B21C8 /* AnimatableSectionModelType.swift in Sources */,
838857
C85EE55A1C36F1FC0090614D /* Differentiator.swift in Sources */,
839858
C85EE5641C36F1FC0090614D /* UISectionedViewType+RxAnimatedDataSource.swift in Sources */,
859+
C8477FBA1D29DBC90074454A /* IntegerType+IdentifiableType.swift in Sources */,
840860
C85EE5631C36F1FC0090614D /* RxTableViewSectionedReloadDataSource.swift in Sources */,
841861
C85EE5581C36F1FC0090614D /* CollectionViewSectionedDataSource.swift in Sources */,
842862
C85EE55E1C36F1FC0090614D /* TableViewSectionedDataSource.swift in Sources */,
@@ -847,6 +867,7 @@
847867
C85EE5571C36F1FC0090614D /* Changeset.swift in Sources */,
848868
C85EE55C1C36F1FC0090614D /* SectionModel.swift in Sources */,
849869
C8BB763C1C4C3CDF002B21C8 /* UI+SectionedViewType.swift in Sources */,
870+
C814E8F61D29DB4F00837FE1 /* String+IdentifiableType.swift in Sources */,
850871
);
851872
runOnlyForDeploymentPostprocessing = 0;
852873
};
@@ -901,6 +922,7 @@
901922
C8BB76601C4C3E53002B21C8 /* RxTableViewSectionedAnimatedDataSource.swift in Sources */,
902923
C8BB76611C4C3E53002B21C8 /* ItemPath.swift in Sources */,
903924
C8BB76621C4C3E53002B21C8 /* AnimatableSectionModelType+ItemPath.swift in Sources */,
925+
C8477FBD1D29DCE20074454A /* FloatingPointType+IdentifiableType.swift in Sources */,
904926
C8CC634D1CCF8492006AE8CE /* Array+Extensions.swift in Sources */,
905927
C8BB76631C4C3E53002B21C8 /* RxCollectionViewSectionedReloadDataSource.swift in Sources */,
906928
C8BB76641C4C3E53002B21C8 /* IdentifiableType.swift in Sources */,
@@ -910,6 +932,7 @@
910932
C8BB76671C4C3E53002B21C8 /* AnimatableSectionModelType.swift in Sources */,
911933
C8BB76691C4C3E53002B21C8 /* Differentiator.swift in Sources */,
912934
C8BB766A1C4C3E53002B21C8 /* UISectionedViewType+RxAnimatedDataSource.swift in Sources */,
935+
C8477FB91D29DBC90074454A /* IntegerType+IdentifiableType.swift in Sources */,
913936
C8BB766C1C4C3E53002B21C8 /* RxTableViewSectionedReloadDataSource.swift in Sources */,
914937
C8BB766D1C4C3E53002B21C8 /* CollectionViewSectionedDataSource.swift in Sources */,
915938
C8BB766E1C4C3E53002B21C8 /* TableViewSectionedDataSource.swift in Sources */,
@@ -920,6 +943,7 @@
920943
C8BB76731C4C3E53002B21C8 /* Changeset.swift in Sources */,
921944
C8BB76741C4C3E53002B21C8 /* SectionModel.swift in Sources */,
922945
C8BB76751C4C3E53002B21C8 /* UI+SectionedViewType.swift in Sources */,
946+
C814E8F51D29DB4F00837FE1 /* String+IdentifiableType.swift in Sources */,
923947
);
924948
runOnlyForDeploymentPostprocessing = 0;
925949
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// FloatingPointType+IdentifiableType.swift
3+
// RxDataSources
4+
//
5+
// Created by Krunoslav Zaher on 7/4/16.
6+
// Copyright © 2016 kzaher. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
extension FloatingPointType {
12+
typealias identity = Self
13+
14+
public var identity: Self {
15+
return self
16+
}
17+
}
18+
19+
extension Float : IdentifiableType {
20+
21+
}
22+
23+
extension Double : IdentifiableType {
24+
25+
}
26+
27+
extension Float80 : IdentifiableType {
28+
typealias identity = Float80
29+
30+
public var identity: Float80 {
31+
return self
32+
}
33+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//
2+
// IntegerType+IdentifiableType.swift
3+
// RxDataSources
4+
//
5+
// Created by Krunoslav Zaher on 7/4/16.
6+
// Copyright © 2016 kzaher. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
extension IntegerType {
12+
typealias identity = Self
13+
14+
public var identity: Self {
15+
return self
16+
}
17+
}
18+
19+
extension Int : IdentifiableType {
20+
21+
}
22+
23+
extension Int8 : IdentifiableType {
24+
25+
}
26+
27+
extension Int16 : IdentifiableType {
28+
29+
}
30+
31+
extension Int32 : IdentifiableType {
32+
33+
}
34+
35+
extension Int64 : IdentifiableType {
36+
37+
}
38+
39+
40+
extension UInt : IdentifiableType {
41+
42+
}
43+
44+
extension UInt8 : IdentifiableType {
45+
46+
}
47+
48+
extension UInt16 : IdentifiableType {
49+
50+
}
51+
52+
extension UInt32 : IdentifiableType {
53+
54+
}
55+
56+
extension UInt64 : IdentifiableType {
57+
58+
}
59+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// String+IdentifiableType.swift
3+
// RxDataSources
4+
//
5+
// Created by Krunoslav Zaher on 7/4/16.
6+
// Copyright © 2016 kzaher. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
extension String : IdentifiableType {
12+
public typealias Identity = String
13+
14+
public var identity: String {
15+
return self
16+
}
17+
}

0 commit comments

Comments
 (0)