Skip to content

Commit

Permalink
Merge pull request #201 from wordpress-mobile/task/support-swift-5
Browse files Browse the repository at this point in the history
Support Swift 5
  • Loading branch information
mindgraffiti authored Apr 26, 2019
2 parents 90594ce + dfdc490 commit 54b4961
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 59 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ version: 2.1

orbs:
# This uses the iOS Orb located at https://github.com/wordpress-mobile/circleci-orbs
ios: wordpress-mobile/[email protected].24
ios: wordpress-mobile/[email protected].25

workflows:
test_and_validate:
jobs:
- ios/test:
name: Test
xcode-version: "10.1.0"
xcode-version: "10.2.0"
workspace: WordPressShared.xcworkspace
scheme: WordPressShared
device: iPhone XS
ios-version: "12.1"
ios-version: "12.2"
- ios/validate-podspec:
name: Validate Podspec
xcode-version: "10.1.0"
xcode-version: "10.2.0"
podspec-path: WordPressShared.podspec
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ target 'WordPressSharedTests' do

wordpress_shared_pods

pod 'OHHTTPStubs', '6.1.0'
pod 'OHHTTPStubs/Swift', '6.1.0'
pod 'OHHTTPStubs', '~> 8'
pod 'OHHTTPStubs/Swift', '~> 8'
pod 'OCMock', '~> 3.4'
pod 'Specta', '1.0.7'
pod 'Expecta', '1.0.6'
Expand Down
39 changes: 18 additions & 21 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
PODS:
- CocoaLumberjack (3.4.1):
- CocoaLumberjack/Default (= 3.4.1)
- CocoaLumberjack/Extensions (= 3.4.1)
- CocoaLumberjack/Default (3.4.1)
- CocoaLumberjack/Extensions (3.4.1):
- CocoaLumberjack/Default
- CocoaLumberjack (3.5.3):
- CocoaLumberjack/Core (= 3.5.3)
- CocoaLumberjack/Core (3.5.3)
- Expecta (1.0.6)
- FormatterKit/Resources (1.8.2)
- FormatterKit/TimeIntervalFormatter (1.8.2):
- FormatterKit/Resources
- OCMock (3.4.1)
- OHHTTPStubs (6.1.0):
- OHHTTPStubs/Default (= 6.1.0)
- OHHTTPStubs/Core (6.1.0)
- OHHTTPStubs/Default (6.1.0):
- OCMock (3.4.3)
- OHHTTPStubs (8.0.0):
- OHHTTPStubs/Default (= 8.0.0)
- OHHTTPStubs/Core (8.0.0)
- OHHTTPStubs/Default (8.0.0):
- OHHTTPStubs/Core
- OHHTTPStubs/JSON
- OHHTTPStubs/NSURLSession
- OHHTTPStubs/OHPathHelpers
- OHHTTPStubs/JSON (6.1.0):
- OHHTTPStubs/JSON (8.0.0):
- OHHTTPStubs/Core
- OHHTTPStubs/NSURLSession (6.1.0):
- OHHTTPStubs/NSURLSession (8.0.0):
- OHHTTPStubs/Core
- OHHTTPStubs/OHPathHelpers (6.1.0)
- OHHTTPStubs/Swift (6.1.0):
- OHHTTPStubs/OHPathHelpers (8.0.0)
- OHHTTPStubs/Swift (8.0.0):
- OHHTTPStubs/Default
- Specta (1.0.7)

Expand All @@ -32,8 +29,8 @@ DEPENDENCIES:
- Expecta (= 1.0.6)
- FormatterKit/TimeIntervalFormatter (= 1.8.2)
- OCMock (~> 3.4)
- OHHTTPStubs (= 6.1.0)
- OHHTTPStubs/Swift (= 6.1.0)
- OHHTTPStubs (~> 8)
- OHHTTPStubs/Swift (~> 8)
- Specta (= 1.0.7)

SPEC REPOS:
Expand All @@ -46,13 +43,13 @@ SPEC REPOS:
- Specta

SPEC CHECKSUMS:
CocoaLumberjack: 2e258a064cacc8eb9a2aca318e24d02a0a7fd56d
CocoaLumberjack: 2f44e60eb91c176d471fdba43b9e3eae6a721947
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
FormatterKit: 4b8f29acc9b872d5d12a63efb560661e8f2e1b98
OCMock: 2cd0716969bab32a2283ff3a46fd26a8c8b4c5e3
OHHTTPStubs: 1e21c7d2c084b8153fc53d48400d8919d2d432d0
OCMock: 43565190abc78977ad44a61c0d20d7f0784d35ab
OHHTTPStubs: 9cbce6364bec557cc3439aa6bb7514670d780881
Specta: 3e1bd89c3517421982dc4d1c992503e48bd5fe66

PODFILE CHECKSUM: b36a5bbbbea55b426f8ec1497b35819126dfa30e
PODFILE CHECKSUM: 78ffa790590cc0b0c49546903906facf935d9ae5

COCOAPODS: 1.6.1
4 changes: 2 additions & 2 deletions WordPressShared.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "WordPressShared"
s.version = "1.7.5-beta.1"
s.version = "1.7.5-beta.2"
s.summary = "Shared components used in building the WordPress iOS apps and other library components."

s.description = <<-DESC
Expand All @@ -13,7 +13,7 @@ Pod::Spec.new do |s|
s.license = "GPLv2"
s.author = { "WordPress" => "[email protected]" }
s.platform = :ios, "10.0"
s.swift_version = '4.2'
s.swift_version = '5.0'
s.source = { :git => "https://github.com/wordpress-mobile/WordPress-iOS-Shared.git", :tag => s.version.to_s }
s.source_files = 'WordPressShared/**/*.{h,m,swift}'
s.private_header_files = "WordPressShared/Private/*.h"
Expand Down
34 changes: 19 additions & 15 deletions WordPressShared.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -507,16 +507,16 @@
829DD1351EC9EED200AB8C12 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1020;
TargetAttributes = {
829DD13D1EC9EED200AB8C12 = {
CreatedOnToolsVersion = 8.3;
LastSwiftMigration = 0910;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
829DD1461EC9EED200AB8C12 = {
CreatedOnToolsVersion = 8.3;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -712,6 +712,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
Expand Down Expand Up @@ -756,7 +757,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -784,7 +785,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.WordPressShared;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = "Release-Internal";
};
Expand All @@ -800,14 +801,15 @@
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.WordPressSharedTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "WordPressSharedTests/WordPressSharedTests-Bridging-Header.h";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = "Release-Internal";
};
82706F9B1ECA2D9E00155CBF /* Release-Alpha */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
Expand Down Expand Up @@ -852,7 +854,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -880,7 +882,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.WordPressShared;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = "Release-Alpha";
};
Expand All @@ -896,14 +898,15 @@
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.WordPressSharedTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "WordPressSharedTests/WordPressSharedTests-Bridging-Header.h";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = "Release-Alpha";
};
829DD1501EC9EED200AB8C12 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
Expand Down Expand Up @@ -954,7 +957,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_VERSION = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -965,6 +968,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
Expand Down Expand Up @@ -1009,7 +1013,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -1038,7 +1042,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -1062,7 +1066,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.WordPressShared;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -1079,7 +1083,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "WordPressSharedTests/WordPressSharedTests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -1095,7 +1099,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.WordPressSharedTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "WordPressSharedTests/WordPressSharedTests-Bridging-Header.h";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
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 = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
10 changes: 5 additions & 5 deletions WordPressShared/Core/Logging/CocoaLumberjack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,23 @@ public func _DDLogMessage(_ message: @autoclosure () -> String, level: DDLogLeve
}

public func DDLogDebug(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance) {
_DDLogMessage(message, level: level, flag: .debug, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
_DDLogMessage(message(), level: level, flag: .debug, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
}

public func DDLogInfo(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance) {
_DDLogMessage(message, level: level, flag: .info, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
_DDLogMessage(message(), level: level, flag: .info, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
}

public func DDLogWarn(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance) {
_DDLogMessage(message, level: level, flag: .warning, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
_DDLogMessage(message(), level: level, flag: .warning, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
}

public func DDLogVerbose(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = true, ddlog: DDLog = DDLog.sharedInstance) {
_DDLogMessage(message, level: level, flag: .verbose, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
_DDLogMessage(message(), level: level, flag: .verbose, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
}

public func DDLogError(_ message: @autoclosure () -> String, level: DDLogLevel = defaultDebugLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = false, ddlog: DDLog = DDLog.sharedInstance) {
_DDLogMessage(message, level: level, flag: .error, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
_DDLogMessage(message(), level: level, flag: .error, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
}

/// Returns a String of the current filename, without full path or extension.
Expand Down
16 changes: 8 additions & 8 deletions WordPressShared/Core/Utility/String+Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public extension String {
/// - Parameters:
/// - prefix: A possible prefix to remove from this string.
///
public mutating func removePrefix(_ prefix: String) {
mutating func removePrefix(_ prefix: String) {
if let prefixRange = range(of: prefix), prefixRange.lowerBound == startIndex {
removeSubrange(prefixRange)
}
Expand All @@ -65,7 +65,7 @@ public extension String {
/// - Parameters:
/// - prefix: A possible prefix to remove from this string.
///
public func removingPrefix(_ prefix: String) -> String {
func removingPrefix(_ prefix: String) -> String {
var copy = self
copy.removePrefix(prefix)
return copy
Expand All @@ -81,7 +81,7 @@ public extension String {
///
/// - Throws: an error if it the pattern is not a valid regular expression.
///
public mutating func removePrefix(pattern: String, options: NSRegularExpression.Options = []) throws {
mutating func removePrefix(pattern: String, options: NSRegularExpression.Options = []) throws {
let regexp = try NSRegularExpression(pattern: "^\(pattern)", options: options)
let fullRange = NSRange(location: 0, length: (self as NSString).length)
if let match = regexp.firstMatch(in: self, options: [], range: fullRange) {
Expand All @@ -98,7 +98,7 @@ public extension String {
///
/// - Throws: an error if it the pattern is not a valid regular expression.
///
public func removingPrefix(pattern: String, options: NSRegularExpression.Options = []) throws -> String {
func removingPrefix(pattern: String, options: NSRegularExpression.Options = []) throws -> String {
var copy = self
try copy.removePrefix(pattern: pattern, options: options)
return copy
Expand All @@ -115,7 +115,7 @@ public extension String {
/// - Parameters:
/// - suffix: A possible suffix to remove from this string.
///
public mutating func removeSuffix(_ suffix: String) {
mutating func removeSuffix(_ suffix: String) {
if let suffixRange = range(of: suffix, options: [.backwards]), suffixRange.upperBound == endIndex {
removeSubrange(suffixRange)
}
Expand All @@ -126,7 +126,7 @@ public extension String {
/// - Parameters:
/// - suffix: A possible suffix to remove from this string.
///
public func removingSuffix(_ suffix: String) -> String {
func removingSuffix(_ suffix: String) -> String {
var copy = self
copy.removeSuffix(suffix)
return copy
Expand All @@ -142,7 +142,7 @@ public extension String {
///
/// - Throws: an error if it the pattern is not a valid regular expression.
///
public mutating func removeSuffix(pattern: String, options: NSRegularExpression.Options = []) throws {
mutating func removeSuffix(pattern: String, options: NSRegularExpression.Options = []) throws {
let regexp = try NSRegularExpression(pattern: "\(pattern)$", options: options)
let fullRange = NSRange(location: 0, length: (self as NSString).length)
if let match = regexp.firstMatch(in: self, options: [], range: fullRange) {
Expand All @@ -159,7 +159,7 @@ public extension String {
///
/// - Throws: an error if it the pattern is not a valid regular expression.
///
public func removingSuffix(pattern: String, options: NSRegularExpression.Options = []) throws -> String {
func removingSuffix(pattern: String, options: NSRegularExpression.Options = []) throws -> String {
var copy = self
try copy.removeSuffix(pattern: pattern, options: options)
return copy
Expand Down

0 comments on commit 54b4961

Please sign in to comment.