From 551727ed6f0a50161597f1edb239774f69ee90a4 Mon Sep 17 00:00:00 2001 From: Bas Broek Date: Wed, 27 Mar 2019 22:49:23 +0100 Subject: [PATCH] Update to Swift 5 (#21) * 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 --- .travis.yml | 4 +- Analysis.podspec | 4 +- Analysis/Classes/Analysis.swift | 18 +---- Analysis/Classes/String+Analysis.swift | 2 +- Changelog.md | 3 + Example/Analysis.xcodeproj/project.pbxproj | 72 +++---------------- .../xcschemes/Analysis-Example.xcscheme | 2 +- .../xcschemes/Analysis_Tests.xcscheme | 2 +- .../xcshareddata/WorkspaceSettings.xcsettings | 5 ++ Example/Podfile | 2 + Example/Podfile.lock | 10 +-- Example/Tests/AnalysisTests.swift | 7 -- 12 files changed, 32 insertions(+), 99 deletions(-) create mode 100644 Example/Analysis.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/.travis.yml b/.travis.yml index c3e93d1..4f6ab46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/Analysis.podspec b/Analysis.podspec index cae2af5..3d28d8a 100644 --- a/Analysis.podspec +++ b/Analysis.podspec @@ -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 @@ -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/**/*" diff --git a/Analysis/Classes/Analysis.swift b/Analysis/Classes/Analysis.swift index 23cc195..3cd0297 100644 --- a/Analysis/Classes/Analysis.swift +++ b/Analysis/Classes/Analysis.swift @@ -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`. @@ -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 { diff --git a/Analysis/Classes/String+Analysis.swift b/Analysis/Classes/String+Analysis.swift index 9dbeddf..5417063 100644 --- a/Analysis/Classes/String+Analysis.swift +++ b/Analysis/Classes/String+Analysis.swift @@ -1,6 +1,6 @@ import Foundation -public extension String { +extension String { /// Returns an analysis of `self`. public func analysed() -> Analysis { diff --git a/Changelog.md b/Changelog.md index f27835f..2743714 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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) diff --git a/Example/Analysis.xcodeproj/project.pbxproj b/Example/Analysis.xcodeproj/project.pbxproj index cb0d138..9a8f4d0 100644 --- a/Example/Analysis.xcodeproj/project.pbxproj +++ b/Example/Analysis.xcodeproj/project.pbxproj @@ -183,7 +183,6 @@ 607FACCD1AFB9204008FA782 /* Frameworks */, 607FACCE1AFB9204008FA782 /* Resources */, B726F347928269BC02F4A2CC /* [CP] Embed Pods Frameworks */, - 71C6F005735D46D3A55E6B0F /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -202,8 +201,6 @@ 607FACE11AFB9204008FA782 /* Sources */, 607FACE21AFB9204008FA782 /* Frameworks */, 607FACE31AFB9204008FA782 /* Resources */, - E847351D50B07BDA4BD2D5C9 /* [CP] Embed Pods Frameworks */, - B916C3D6C7965EA0E63FF363 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -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, @@ -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; @@ -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"; @@ -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 */ @@ -536,15 +488,13 @@ 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; }; @@ -552,15 +502,13 @@ 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; }; @@ -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; @@ -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; diff --git a/Example/Analysis.xcodeproj/xcshareddata/xcschemes/Analysis-Example.xcscheme b/Example/Analysis.xcodeproj/xcshareddata/xcschemes/Analysis-Example.xcscheme index a11e1eb..a155e0a 100644 --- a/Example/Analysis.xcodeproj/xcshareddata/xcschemes/Analysis-Example.xcscheme +++ b/Example/Analysis.xcodeproj/xcshareddata/xcschemes/Analysis-Example.xcscheme @@ -1,6 +1,6 @@ + + + + diff --git a/Example/Podfile b/Example/Podfile index 6698a11..a47e183 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,3 +1,5 @@ +platform :ios, '8.0' + use_frameworks! target 'Analysis_Example' do diff --git a/Example/Podfile.lock b/Example/Podfile.lock index a39a563..c69d0da 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -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 diff --git a/Example/Tests/AnalysisTests.swift b/Example/Tests/AnalysisTests.swift index 226a8a6..bf4ee56 100644 --- a/Example/Tests/AnalysisTests.swift +++ b/Example/Tests/AnalysisTests.swift @@ -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) }