diff --git a/.swift-version b/.swift-version deleted file mode 100644 index 819e07a..0000000 --- a/.swift-version +++ /dev/null @@ -1 +0,0 @@ -5.0 diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/SwiftCronExample.xcodeproj/project.pbxproj b/Example/SwiftCronExample.xcodeproj/project.pbxproj index dee58cc..3c125e5 100644 --- a/Example/SwiftCronExample.xcodeproj/project.pbxproj +++ b/Example/SwiftCronExample.xcodeproj/project.pbxproj @@ -499,7 +499,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -548,7 +548,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -564,7 +564,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.Rush42.SwiftCronExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -579,7 +579,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.Rush42.SwiftCronExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Release; }; @@ -597,7 +597,7 @@ SWIFT_OBJC_BRIDGING_HEADER = "SwiftCronExampleTests/SwiftCronExampleTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftCronExample.app/SwiftCronExample"; }; name = Debug; @@ -615,7 +615,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "SwiftCronExampleTests/SwiftCronExampleTests-Bridging-Header.h"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftCronExample.app/SwiftCronExample"; }; name = Release; diff --git a/Example/SwiftCronExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/SwiftCronExample/Assets.xcassets/AppIcon.appiconset/Contents.json index 118c98f..8121323 100644 --- a/Example/SwiftCronExample/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/SwiftCronExample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -2,37 +2,52 @@ "images" : [ { "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" + "scale" : "2x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" + "scale" : "3x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" + "scale" : "2x", + "size" : "29x29" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" + "scale" : "3x", + "size" : "29x29" }, { "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" + "scale" : "2x", + "size" : "40x40" }, { "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Example/SwiftCronExampleTests/SwiftCronExampleTests.swift b/Example/SwiftCronExampleTests/SwiftCronExampleTests.swift index c2fbd88..2dbf8dc 100644 --- a/Example/SwiftCronExampleTests/SwiftCronExampleTests.swift +++ b/Example/SwiftCronExampleTests/SwiftCronExampleTests.swift @@ -28,7 +28,7 @@ class SwiftCronExampleTests: XCTestCase { func testPerformanceExample() { // This is an example of a performance test case. - self.measureBlock { + measure { // Put the code you want to measure the time of here. } } diff --git a/Example/SwiftCronExampleTests/Tests.swift b/Example/SwiftCronExampleTests/Tests.swift index 6d81526..746778a 100644 --- a/Example/SwiftCronExampleTests/Tests.swift +++ b/Example/SwiftCronExampleTests/Tests.swift @@ -33,16 +33,16 @@ class TableOfContentsSpec: QuickSpec { it("will eventually pass") { var time = "passing" - dispatch_async(dispatch_get_main_queue()) { - time = "done" - } + DispatchQueue.main.async { + time = "done" + } - waitUntil { done in - NSThread.sleepForTimeInterval(0.5) - expect(time) == "done" + waitUntil { done in + Thread.sleep(forTimeInterval: 0.5) + expect(time) == "done" - done() - } + done() + } } } } diff --git a/Package.swift b/Package.swift index 6cff420..cd99706 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.0 +// swift-tools-version:6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -11,5 +11,5 @@ let package = Package( targets: [ .target(name: "SwiftCron", dependencies: [], path: "Sources/") ], - swiftLanguageVersions: [.v5] + swiftLanguageModes: [.v5, .v6] ) diff --git a/Sources/CronRepresentation.swift b/Sources/CronRepresentation.swift index 75eac1a..2e55644 100644 --- a/Sources/CronRepresentation.swift +++ b/Sources/CronRepresentation.swift @@ -9,8 +9,10 @@ import Foundation enum CronField: Int { - case minute, hour, day, month, weekday, year - private static let fieldCheckers: Array = [MinutesField(), HoursField(), DayOfMonthField(), MonthField(), DayOfWeekField(), YearField()] + case minute, hour, day, month, weekday, year + private static var fieldCheckers: [FieldCheckerInterface] { + [MinutesField(), HoursField(), DayOfMonthField(), MonthField(), DayOfWeekField(), YearField()] + } func getFieldChecker() -> FieldCheckerInterface { return CronField.fieldCheckers[rawValue] diff --git a/Sources/StringValidator.swift b/Sources/StringValidator.swift index bbb8e49..84a9cef 100644 --- a/Sources/StringValidator.swift +++ b/Sources/StringValidator.swift @@ -23,12 +23,7 @@ struct StringValidator { } private static func validate(_ value: String, regex: String) -> Bool { - #if os(Linux) - typealias Regex = RegularExpression - #else - typealias Regex = NSRegularExpression - #endif - + typealias Regex = NSRegularExpression guard let regex = try? Regex(pattern: regex, options: []) else { return false } return regex.numberOfMatches(in: value, options: [], range: NSMakeRange(0, value.count)) > 0 } diff --git a/SwiftCron.podspec b/SwiftCron.podspec index 22b9b2d..8675fb2 100644 --- a/SwiftCron.podspec +++ b/SwiftCron.podspec @@ -13,8 +13,9 @@ A cron expression parser written in Swift that can take a cron string and give y s.author = { "Keegan Rush" => "thecodedself@gmail.com" } s.source = { :git => "https://github.com/TheCodedSelf/SwiftCron.git", :tag => "#{s.version}" } s.social_media_url = 'https://twitter.com/RushKeegan' + s.swift_versions = ['6.0'] - s.ios.deployment_target = '9.0' + s.ios.deployment_target = '13.0' s.source_files = 'Sources/**/*' end diff --git a/SwiftCron.xcodeproj/project.pbxproj b/SwiftCron.xcodeproj/project.pbxproj index 6837b48..30c0c2d 100644 --- a/SwiftCron.xcodeproj/project.pbxproj +++ b/SwiftCron.xcodeproj/project.pbxproj @@ -265,14 +265,14 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -322,12 +322,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -352,7 +352,7 @@ SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -372,7 +372,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Release; };