Skip to content

Commit

Permalink
Update to Swift 5 (#21)
Browse files Browse the repository at this point in the history
* Update to Swift 5

* Update to v0.4.0

* Update Travis to 10.2

... and hope it is available already?

* Run pod install

* Update changelog
  • Loading branch information
BasThomas authored Mar 27, 2019
1 parent 5dd35fd commit 551727e
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 99 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: swift
osx_image: xcode10
osx_image: xcode10.2

script:
- cd Example/
- pod install
- cd ..
- xcodebuild clean test -scheme Analysis_Tests -workspace Example/Analysis.xcworkspace -destination "platform=iOS Simulator,name=iPhone X,OS=12.0"
- xcodebuild clean test -scheme Analysis_Tests -workspace Example/Analysis.xcworkspace -destination "platform=iOS Simulator,name=iPhone X,OS=12.2"
4 changes: 2 additions & 2 deletions Analysis.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Analysis"
s.version = "0.3.0"
s.version = "0.4.0"
s.summary = "Analyse your strings."

s.description = <<-DESC
Expand All @@ -14,7 +14,7 @@ Analysis analyses strings, checking word count, sentence count, frequency of wor
s.social_media_url = "https://twitter.com/basthomas"

s.ios.deployment_target = "8.0"
s.swift_version = "4.2"
s.swift_version = "5.0"

s.source_files = "Analysis/Classes/**/*"

Expand Down
18 changes: 1 addition & 17 deletions Analysis/Classes/Analysis.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

/// An analysis of a `String`.
public struct Analysis {
public struct Analysis: Hashable {

/// The option to use when calculating average length.
/// This is either `.word` or `.sentence`.
Expand Down Expand Up @@ -235,22 +235,6 @@ public struct Analysis {
}
}

extension Analysis: Hashable {

/// The `Analysis`’s hash value.
///
/// Hash values are not guaranteed to be equal across
/// different executions of your program.
/// Do not save hash values to use during a future execution.
public var hashValue: Int {
return input.hashValue
}

public static func ==(lhs: Analysis, rhs: Analysis) -> Bool {
return lhs.input == rhs.input
}
}

extension Analysis: Comparable {

public static func <(lhs: Analysis, rhs: Analysis) -> Bool {
Expand Down
2 changes: 1 addition & 1 deletion Analysis/Classes/String+Analysis.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public extension String {
extension String {

/// Returns an analysis of `self`.
public func analysed() -> Analysis {
Expand Down
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# next

# [0.4.0](https://github.com/BasThomas/Analysis/releases/tag/0.4.0)

- **Breaking**: Nested `LengthOption` under the `Analysis` namespace. If it is accessed without type inference,
such as like `LengthOption.word`, you'll need to use `Analysis.LengthOption.word` going forward. Type inference will continue
to work as expected, allowing you to use `.word` or `.sentence`.
- **Breaking**: Updated to Swift 5.

# [0.3.0](https://github.com/BasThomas/Analysis/releases/tag/0.3.0)

Expand Down
72 changes: 9 additions & 63 deletions Example/Analysis.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@
607FACCD1AFB9204008FA782 /* Frameworks */,
607FACCE1AFB9204008FA782 /* Resources */,
B726F347928269BC02F4A2CC /* [CP] Embed Pods Frameworks */,
71C6F005735D46D3A55E6B0F /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -202,8 +201,6 @@
607FACE11AFB9204008FA782 /* Sources */,
607FACE21AFB9204008FA782 /* Frameworks */,
607FACE31AFB9204008FA782 /* Resources */,
E847351D50B07BDA4BD2D5C9 /* [CP] Embed Pods Frameworks */,
B916C3D6C7965EA0E63FF363 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -227,18 +224,18 @@
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
};
607FACE41AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
TestTargetID = 607FACCF1AFB9204008FA782;
};
};
};
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "Analysis" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -277,21 +274,6 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
71C6F005735D46D3A55E6B0F /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Analysis_Example/Pods-Analysis_Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
8E99E9A2B4D2FE8196C886FC /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -334,7 +316,7 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Analysis_Example/Pods-Analysis_Example-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-Analysis_Example/Pods-Analysis_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Analysis/Analysis.framework",
);
name = "[CP] Embed Pods Frameworks";
Expand All @@ -343,37 +325,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Analysis_Example/Pods-Analysis_Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
B916C3D6C7965EA0E63FF363 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Analysis_Tests/Pods-Analysis_Tests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
E847351D50B07BDA4BD2D5C9 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Analysis_Tests/Pods-Analysis_Tests-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Analysis_Example/Pods-Analysis_Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -536,31 +488,27 @@
isa = XCBuildConfiguration;
baseConfigurationReference = E2191E54DA43E7984AA43E68 /* Pods-Analysis_Example.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = Analysis/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
607FACF11AFB9204008FA782 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = DE84EF1912913AEE64540651 /* Pods-Analysis_Example.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = Analysis/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -580,8 +528,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Analysis_Example.app/Analysis_Example";
};
name = Debug;
Expand All @@ -598,8 +545,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Analysis_Example.app/Analysis_Example";
};
name = Release;
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 = "1000"
LastUpgradeVersion = "1020"
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 = "1000"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
2 changes: 2 additions & 0 deletions Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
platform :ios, '8.0'

use_frameworks!

target 'Analysis_Example' do
Expand Down
10 changes: 5 additions & 5 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PODS:
- Analysis (0.3.0)
- Analysis (0.4.0)

DEPENDENCIES:
- Analysis (from `../`)

EXTERNAL SOURCES:
Analysis:
:path: ../
:path: "../"

SPEC CHECKSUMS:
Analysis: 556a6d4d9ddee23fb7c4bb5fd8f5c882b7958050
Analysis: faa09d680f722f4111f2f4dc69492cfc228f0ee4

PODFILE CHECKSUM: 8aa19244f257b8174d0051e41788d104857daad3
PODFILE CHECKSUM: d91e06da3cd073207837737c6c65ef37d1dfd49f

COCOAPODS: 1.4.0
COCOAPODS: 1.6.1
7 changes: 0 additions & 7 deletions Example/Tests/AnalysisTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,6 @@ class AnalysisTests: XCTestCase {
XCTAssertEqual(z.debugDescription, dump(z.description))
}

func testHashValue() {
XCTAssertEqual(helloWorld1.hashValue, helloWorld1.input.hashValue)
XCTAssertEqual(helloWorld2.hashValue, helloWorld2.input.hashValue)
XCTAssertEqual(a.hashValue, a.input.hashValue)
XCTAssertEqual(z.hashValue, z.input.hashValue)
}

func testExpressibleByStringLiteral() {
XCTAssertEqual(literal, nonLiteral)
}
Expand Down

0 comments on commit 551727e

Please sign in to comment.