Skip to content

Commit 03609ce

Browse files
authored
Release Identifier 1.1.0
2 parents 8205e96 + 2367635 commit 03609ce

File tree

12 files changed

+152
-18
lines changed

12 files changed

+152
-18
lines changed

Cartfile.private

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Configuration for Carthage (https://github.com/Carthage/Carthage)
22

3-
github "jspahrsummers/xcconfigs"
3+
github "jspahrsummers/xcconfigs" ~> 1.0
44
github "Quick/Nimble" ~> 8.0

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
github "Quick/Nimble" "v8.0.1"
2-
github "jspahrsummers/xcconfigs" "0.12"
2+
github "jspahrsummers/xcconfigs" "1.0"

Carthage/Checkouts/xcconfigs

Identifier.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = "Identifier"
3-
spec.version = "1.0.0"
3+
spec.version = "1.1.0"
44
spec.summary = "Unique, strongly-typed identifiers in Swift."
55
spec.description = "`Identifier` is a generic struct backed by a UUID, which can be specialized for the model type it identifies and provides unique, decentralized identity in a value type. It is Equatable, Hashable, and Codable, serializing to a simple UUID string."
66
spec.homepage = "https://github.com/mattrubin/Identifier"

Identifier.xcodeproj/project.pbxproj

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@
66
objectVersion = 50;
77
objects = {
88

9+
/* Begin PBXAggregateTarget section */
10+
C9425DEB227555DC00EF93BD /* Lint Identifier */ = {
11+
isa = PBXAggregateTarget;
12+
buildConfigurationList = C9425DEE227555DD00EF93BD /* Build configuration list for PBXAggregateTarget "Lint Identifier" */;
13+
buildPhases = (
14+
C9425DEF227555EA00EF93BD /* Run SwiftLint */,
15+
);
16+
dependencies = (
17+
);
18+
name = "Lint Identifier";
19+
productName = "Lint Identifier";
20+
};
21+
/* End PBXAggregateTarget section */
22+
923
/* Begin PBXBuildFile section */
1024
C97980FE224FE68800132BEC /* Identifier.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C97980F4224FE68800132BEC /* Identifier.framework */; };
1125
C9798103224FE68800132BEC /* IdentifierTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9798102224FE68800132BEC /* IdentifierTests.swift */; };
@@ -151,6 +165,9 @@
151165
LastUpgradeCheck = 1020;
152166
ORGANIZATIONNAME = "Matt Rubin";
153167
TargetAttributes = {
168+
C9425DEB227555DC00EF93BD = {
169+
CreatedOnToolsVersion = 10.2.1;
170+
};
154171
C97980F3224FE68800132BEC = {
155172
CreatedOnToolsVersion = 10.2;
156173
};
@@ -173,10 +190,32 @@
173190
targets = (
174191
C97980F3224FE68800132BEC /* Identifier */,
175192
C97980FC224FE68800132BEC /* IdentifierTests */,
193+
C9425DEB227555DC00EF93BD /* Lint Identifier */,
176194
);
177195
};
178196
/* End PBXProject section */
179197

198+
/* Begin PBXShellScriptBuildPhase section */
199+
C9425DEF227555EA00EF93BD /* Run SwiftLint */ = {
200+
isa = PBXShellScriptBuildPhase;
201+
buildActionMask = 2147483647;
202+
files = (
203+
);
204+
inputFileListPaths = (
205+
);
206+
inputPaths = (
207+
);
208+
name = "Run SwiftLint";
209+
outputFileListPaths = (
210+
);
211+
outputPaths = (
212+
);
213+
runOnlyForDeploymentPostprocessing = 0;
214+
shellPath = /bin/sh;
215+
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint is not installed. (https://github.com/realm/SwiftLint)\"\nfi\n";
216+
};
217+
/* End PBXShellScriptBuildPhase section */
218+
180219
/* Begin PBXSourcesBuildPhase section */
181220
C97980F0224FE68800132BEC /* Sources */ = {
182221
isa = PBXSourcesBuildPhase;
@@ -205,18 +244,26 @@
205244
/* End PBXTargetDependency section */
206245

207246
/* Begin XCBuildConfiguration section */
247+
C9425DEC227555DD00EF93BD /* Debug */ = {
248+
isa = XCBuildConfiguration;
249+
buildSettings = {
250+
};
251+
name = Debug;
252+
};
253+
C9425DED227555DD00EF93BD /* Release */ = {
254+
isa = XCBuildConfiguration;
255+
buildSettings = {
256+
};
257+
name = Release;
258+
};
208259
C9798106224FE68800132BEC /* Debug */ = {
209260
isa = XCBuildConfiguration;
210261
baseConfigurationReference = C979812C224FF07C00132BEC /* Debug.xcconfig */;
211262
buildSettings = {
212-
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
213263
CLANG_ENABLE_OBJC_WEAK = YES;
214-
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
215-
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
216264
CURRENT_PROJECT_VERSION = 1;
217265
DEBUG_INFORMATION_FORMAT = dwarf;
218266
GCC_DYNAMIC_NO_PIC = NO;
219-
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
220267
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
221268
MACOSX_DEPLOYMENT_TARGET = 10.10;
222269
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator";
@@ -232,14 +279,9 @@
232279
isa = XCBuildConfiguration;
233280
baseConfigurationReference = C979812D224FF07C00132BEC /* Release.xcconfig */;
234281
buildSettings = {
235-
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
236282
CLANG_ENABLE_OBJC_WEAK = YES;
237-
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
238-
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
239283
COPY_PHASE_STRIP = NO;
240284
CURRENT_PROJECT_VERSION = 1;
241-
ENABLE_NS_ASSERTIONS = NO;
242-
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
243285
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
244286
MACOSX_DEPLOYMENT_TARGET = 10.10;
245287
SUPPORTED_PLATFORMS = "macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator";
@@ -294,6 +336,15 @@
294336
/* End XCBuildConfiguration section */
295337

296338
/* Begin XCConfigurationList section */
339+
C9425DEE227555DD00EF93BD /* Build configuration list for PBXAggregateTarget "Lint Identifier" */ = {
340+
isa = XCConfigurationList;
341+
buildConfigurations = (
342+
C9425DEC227555DD00EF93BD /* Debug */,
343+
C9425DED227555DD00EF93BD /* Release */,
344+
);
345+
defaultConfigurationIsVisible = 0;
346+
defaultConfigurationName = Release;
347+
};
297348
C97980EE224FE68800132BEC /* Build configuration list for PBXProject "Identifier" */ = {
298349
isa = XCConfigurationList;
299350
buildConfigurations = (

Identifier.xcodeproj/xcshareddata/xcschemes/Identifier.xcscheme

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@
2020
ReferencedContainer = "container:Identifier.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "YES"
26+
buildForProfiling = "YES"
27+
buildForArchiving = "YES"
28+
buildForAnalyzing = "YES">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "C9425DEB227555DC00EF93BD"
32+
BuildableName = "Lint Identifier"
33+
BlueprintName = "Lint Identifier"
34+
ReferencedContainer = "container:Identifier.xcodeproj">
35+
</BuildableReference>
36+
</BuildActionEntry>
2337
</BuildActionEntries>
2438
</BuildAction>
2539
<TestAction

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct Comment: Equatable, Codable {
3737
Add the following line to your [Cartfile][]:
3838

3939
````config
40-
github "mattrubin/Identifier" ~> 1.0
40+
github "mattrubin/Identifier" ~> 1.1
4141
````
4242

4343
Then run `carthage update Identifier` to install the latest version of the framework.
@@ -53,7 +53,7 @@ Be sure to check the Carthage README file for the latest instructions on [adding
5353
Add the following line to your [Podfile][]:
5454

5555
````ruby
56-
pod 'Identifier', '~> 1.0'
56+
pod 'Identifier', '~> 1.1'
5757
````
5858

5959
Identifier, like all pods written in Swift, can only be integrated as a framework. Make sure to add the line `use_frameworks!` to your Podfile or target to opt into frameworks instead of static libraries.
@@ -68,7 +68,7 @@ Then run `pod install` to install the latest version of the framework.
6868
Add the following line to the dependencies section of your [package manifest][Package.swift]:
6969

7070
```swift
71-
.package(url: "https://github.com/mattrubin/Identifier.git", from: "1.0.0"),
71+
.package(url: "https://github.com/mattrubin/Identifier.git", from: "1.1.0"),
7272
```
7373

7474
Then add `"Identifier"` to the dependencies array of any target which should be linked with this library

Sources/Identifier/Identifier.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,30 @@ public struct Identifier<T>: Equatable, Hashable {
1212
}
1313
}
1414

15+
// MARK: - String Convertible
16+
17+
extension Identifier: LosslessStringConvertible {
18+
/// Instantiates an identifier from a string representation.
19+
public init?(_ description: String) {
20+
guard let uuid = UUID(uuidString: description) else {
21+
return nil
22+
}
23+
self.init(uuid: uuid)
24+
}
25+
26+
/// A string representation of this identifier.
27+
public var description: String {
28+
return uuid.uuidString
29+
}
30+
}
31+
32+
extension Identifier: CustomDebugStringConvertible {
33+
/// A detailed string representation of this identifier, for use in debugging.
34+
public var debugDescription: String {
35+
return "Identifier<\(T.self)>(uuid: \(uuid))"
36+
}
37+
}
38+
1539
// MARK: - Codable
1640

1741
extension Identifier: Codable {

Sources/Identifier/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.0.0</string>
18+
<string>1.1.0</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
</dict>

Tests/IdentifierTests/IdentifierTests.swift

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,48 @@ final class IdentifierTests: XCTestCase {
3939
XCTAssertNotEqual(third, fourth)
4040
}
4141

42+
// MARK: - String Convertible
43+
44+
func testInitWithDescription() {
45+
let firstFromUUID = Identifier<Int>(uuid: firstUUID)
46+
let firstDescription = "B9212942-B5B9-4547-A994-375921769411"
47+
let firstFromDescription = Identifier<Int>(firstDescription)
48+
XCTAssertEqual(firstFromDescription, firstFromUUID)
49+
50+
let secondRandom = Identifier<String>.random()
51+
let secondDescription = secondRandom.uuid.uuidString
52+
let secondFromDescription = Identifier<String>(secondDescription)
53+
XCTAssertEqual(secondFromDescription, secondRandom)
54+
55+
let validDescription = UUID().uuidString
56+
let validIdentifier = Identifier<Float>(validDescription)
57+
XCTAssertNotNil(validIdentifier)
58+
59+
let invalidDescription = "12345"
60+
let invalidIdentifier = Identifier<Float>(invalidDescription)
61+
XCTAssertNil(invalidIdentifier)
62+
}
63+
64+
func testDescription() {
65+
let first = Identifier<Int>(uuid: firstUUID)
66+
let firstExpectedDebugDescription = "B9212942-B5B9-4547-A994-375921769411"
67+
XCTAssertEqual(first.description, firstExpectedDebugDescription)
68+
69+
let second = Identifier<String>.random()
70+
let secondExpectedDebugDescription = second.uuid.uuidString
71+
XCTAssertEqual(second.description, secondExpectedDebugDescription)
72+
}
73+
74+
func testDebugDescription() {
75+
let first = Identifier<Int>(uuid: firstUUID)
76+
let firstExpectedDebugDescription = "Identifier<Int>(uuid: B9212942-B5B9-4547-A994-375921769411)"
77+
XCTAssertEqual(first.debugDescription, firstExpectedDebugDescription)
78+
79+
let second = Identifier<String>.random()
80+
let secondExpectedDebugDescription = "Identifier<String>(uuid: " + second.uuid.uuidString + ")"
81+
XCTAssertEqual(second.debugDescription, secondExpectedDebugDescription)
82+
}
83+
4284
// MARK: - Codable
4385

4486
func testEncode() {

Tests/IdentifierTests/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.0.0</string>
18+
<string>1.1.0</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
</dict>

Tests/IdentifierTests/XCTestManifests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ extension IdentifierTests {
66
// `swift test --generate-linuxmain`
77
// to regenerate.
88
static let __allTests__IdentifierTests = [
9+
("testDebugDescription", testDebugDescription),
910
("testDecode", testDecode),
11+
("testDescription", testDescription),
1012
("testEncode", testEncode),
1113
("testEquality", testEquality),
14+
("testInitWithDescription", testInitWithDescription),
1215
("testInitWithUUID", testInitWithUUID),
1316
("testRandomIdentifier", testRandomIdentifier),
1417
]

0 commit comments

Comments
 (0)