From 9d4b2bbdd995652107760b9e0b2b5ef3949bd3a1 Mon Sep 17 00:00:00 2001 From: Dmitry Simkin Date: Fri, 5 Apr 2019 15:15:47 +0300 Subject: [PATCH 1/5] Update to swift 4.2 --- NGRValidator.xcodeproj/project.pbxproj | 96 +++++++++---------- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++ .../Demo/NGRSwiftViewController.swift | 4 +- NGRValidator/NGRValidator/NGRRuntime.swift | 2 +- Podfile.lock | 9 +- 5 files changed, 66 insertions(+), 53 deletions(-) create mode 100644 NGRValidator.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/NGRValidator.xcodeproj/project.pbxproj b/NGRValidator.xcodeproj/project.pbxproj index 1af4e1a..663fad5 100644 --- a/NGRValidator.xcodeproj/project.pbxproj +++ b/NGRValidator.xcodeproj/project.pbxproj @@ -1204,7 +1204,6 @@ 022228371E85061300CE4399 /* Frameworks */, 022228381E85061300CE4399 /* Resources */, AF5558FC46B842826F129969 /* [CP] Embed Pods Frameworks */, - 3CD078A403537712C21E98ED /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -1245,7 +1244,6 @@ 5E5C0A051A498164002D3E72 /* Frameworks */, 5E5C0A061A498164002D3E72 /* Resources */, F8EBD14E051812362FFBBB34 /* [CP] Embed Pods Frameworks */, - EB22D3D5F363FF44F150E789 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -1267,7 +1265,8 @@ TargetAttributes = { 020A96B91E82D29100DF6E12 = { CreatedOnToolsVersion = 8.2.1; - LastSwiftMigration = 0820; + DevelopmentTeam = WCB4RRJ4WD; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; }; 022227AB1E85046A00CE4399 = { @@ -1281,12 +1280,11 @@ }; 5E5C09EE1A498164002D3E72 = { CreatedOnToolsVersion = 6.1; - DevelopmentTeam = SK8PDF7SG9; - LastSwiftMigration = 0820; + DevelopmentTeam = WCB4RRJ4WD; + LastSwiftMigration = 1010; }; 5E5C0A071A498164002D3E72 = { CreatedOnToolsVersion = 6.1; - DevelopmentTeam = SK8PDF7SG9; LastSwiftMigration = 0820; }; }; @@ -1423,34 +1421,28 @@ shellPath = /bin/sh; shellScript = ./Scripts/generate_emojis.sh; }; - 3CD078A403537712C21E98ED /* [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-NGRValidatorTests-MacOS/Pods-NGRValidatorTests-MacOS-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; AF5558FC46B842826F129969 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-NGRValidatorTests-MacOS/Pods-NGRValidatorTests-MacOS-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Expecta-macOS/Expecta.framework", + "${BUILT_PRODUCTS_DIR}/Nimble-macOS/Nimble.framework", + "${BUILT_PRODUCTS_DIR}/Quick-macOS/Quick.framework", + "${BUILT_PRODUCTS_DIR}/Specta-macOS/Specta.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Expecta.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Nimble.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Quick.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Specta.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-NGRValidatorTests-MacOS/Pods-NGRValidatorTests-MacOS-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NGRValidatorTests-MacOS/Pods-NGRValidatorTests-MacOS-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; C1017983269E679841E91375 /* [CP] Check Pods Manifest.lock */ = { @@ -1459,13 +1451,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-NGRValidatorTests-iOS-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; D3727EEA42D1670738BB7901 /* [CP] Check Pods Manifest.lock */ = { @@ -1474,28 +1469,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-NGRValidatorTests-MacOS-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - EB22D3D5F363FF44F150E789 /* [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-NGRValidatorTests-iOS/Pods-NGRValidatorTests-iOS-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; F8EBD14E051812362FFBBB34 /* [CP] Embed Pods Frameworks */ = { @@ -1504,13 +1487,22 @@ files = ( ); inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-NGRValidatorTests-iOS/Pods-NGRValidatorTests-iOS-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Expecta-iOS/Expecta.framework", + "${BUILT_PRODUCTS_DIR}/Nimble-iOS/Nimble.framework", + "${BUILT_PRODUCTS_DIR}/Quick-iOS/Quick.framework", + "${BUILT_PRODUCTS_DIR}/Specta-iOS/Specta.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Expecta.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Nimble.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Quick.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Specta.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-NGRValidatorTests-iOS/Pods-NGRValidatorTests-iOS-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-NGRValidatorTests-iOS/Pods-NGRValidatorTests-iOS-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -1729,7 +1721,7 @@ CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = WCB4RRJ4WD; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1743,7 +1735,8 @@ SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_INSTALL_OBJC_HEADER = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.2; VALID_ARCHS = "arm64 armv7 armv7s"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1762,7 +1755,7 @@ CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = WCB4RRJ4WD; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; @@ -1775,7 +1768,8 @@ SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.2; VALID_ARCHS = "arm64 armv7 armv7s"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1788,7 +1782,7 @@ CLANG_ANALYZER_NONNULL = YES; CLANG_ENABLE_MODULES = YES; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "Mac Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; @@ -2010,6 +2004,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = WCB4RRJ4WD; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = NGRValidator/NGRValidator.pch; INFOPLIST_FILE = "$(SRCROOT)/NGRValidator/Demo/Info.plist"; @@ -2020,7 +2015,8 @@ PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "NGRValidator/NGRValidatorDemo-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 1; }; name = Debug; @@ -2035,6 +2031,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = WCB4RRJ4WD; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = NGRValidator/NGRValidator.pch; INFOPLIST_FILE = "$(SRCROOT)/NGRValidator/Demo/Info.plist"; @@ -2044,7 +2041,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; SWIFT_OBJC_BRIDGING_HEADER = "NGRValidator/NGRValidatorDemo-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 1; }; name = Release; @@ -2057,7 +2055,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DEVELOPMENT_TEAM = SK8PDF7SG9; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -2091,7 +2089,7 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; - DEVELOPMENT_TEAM = SK8PDF7SG9; + DEVELOPMENT_TEAM = ""; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", diff --git a/NGRValidator.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/NGRValidator.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/NGRValidator.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/NGRValidator/Demo/NGRSwiftViewController.swift b/NGRValidator/Demo/NGRSwiftViewController.swift index 6324696..13ed496 100644 --- a/NGRValidator/Demo/NGRSwiftViewController.swift +++ b/NGRValidator/Demo/NGRSwiftViewController.swift @@ -62,7 +62,7 @@ final class NGRSwiftViewController: UIViewController { validateButton.addTarget(self, action: #selector(validateAction), for: .touchUpInside) } - func validateAction() { + @objc func validateAction() { let user = User(name: nameTextField.text!, password: passwordTextField.text!) @@ -74,7 +74,7 @@ final class NGRSwiftViewController: UIViewController { NGRPropertyValidator(property: "nonExistent")?.is.required().to.have.minLength(5).msgTooShort("should have at least 5 signs"), NGRPropertyValidator(property: "birthDate")?.to.be.earlierThan(Date()).msgNotEarlierThan("should happen in the past"), NGRPropertyValidator(property: "attachment")?.is.required().to.be.image().msgTooShort("should have at least 5 signs").when({ false }), - ].flatMap { $0 } + ].compactMap { $0 } } guard let errors = validationErrors, !errors.isEmpty else { return } diff --git a/NGRValidator/NGRValidator/NGRRuntime.swift b/NGRValidator/NGRValidator/NGRRuntime.swift index e3b7aa4..5c2c06e 100644 --- a/NGRValidator/NGRValidator/NGRRuntime.swift +++ b/NGRValidator/NGRValidator/NGRRuntime.swift @@ -45,7 +45,7 @@ fileprivate extension Mirror { } func properties() -> [String] { - let childProperties = children.flatMap { $0.label } + let childProperties = children.compactMap { $0.label } let superProperties = superclassMirror?.properties() ?? [] return [childProperties, superProperties].flatMap { $0 } diff --git a/Podfile.lock b/Podfile.lock index 35f2681..2e433b3 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -10,6 +10,13 @@ DEPENDENCIES: - Quick (= 1.1.0) - Specta (= 1.0.5) +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - Expecta + - Nimble + - Quick + - Specta + SPEC CHECKSUMS: Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe Nimble: c53e6903fee94041b90ded74f135820437d8bf59 @@ -18,4 +25,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 891f44c3a75b3f20a9cabc88aca84394d180f380 -COCOAPODS: 1.2.1 +COCOAPODS: 1.6.1 From bcb9af28db0187f17a89ef80734c4c2348d838cf Mon Sep 17 00:00:00 2001 From: Dmitry Simkin Date: Fri, 5 Apr 2019 15:16:10 +0300 Subject: [PATCH 2/5] Update test dependencies --- Podfile | 4 ++-- Podfile.lock | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Podfile b/Podfile index bb941f7..9d67549 100644 --- a/Podfile +++ b/Podfile @@ -12,8 +12,8 @@ inhibit_all_warnings! def testing_pods pod 'Expecta', '1.0.5' pod 'Specta', '1.0.5' - pod 'Quick', '1.1.0' - pod 'Nimble', '6.1.0' + pod 'Quick' + pod 'Nimble' end target 'NGRValidatorTests-iOS' do diff --git a/Podfile.lock b/Podfile.lock index 2e433b3..b2f8cc4 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,13 +1,13 @@ PODS: - Expecta (1.0.5) - - Nimble (6.1.0) - - Quick (1.1.0) + - Nimble (8.0.1) + - Quick (2.0.0) - Specta (1.0.5) DEPENDENCIES: - Expecta (= 1.0.5) - - Nimble (= 6.1.0) - - Quick (= 1.1.0) + - Nimble + - Quick - Specta (= 1.0.5) SPEC REPOS: @@ -19,10 +19,10 @@ SPEC REPOS: SPEC CHECKSUMS: Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe - Nimble: c53e6903fee94041b90ded74f135820437d8bf59 - Quick: dafc587e21eed9f4cab3249b9f9015b0b7a7f71d + Nimble: 45f786ae66faa9a709624227fae502db55a8bdd0 + Quick: ce1276c7c27ba2da3cb2fd0cde053c3648b3b22d Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2 -PODFILE CHECKSUM: 891f44c3a75b3f20a9cabc88aca84394d180f380 +PODFILE CHECKSUM: 3560942f263370be59dd53e8d2eceac1154c3d2d COCOAPODS: 1.6.1 From 8bde12a72483a5292fdf830631f7511280a977ce Mon Sep 17 00:00:00 2001 From: Dmitry Simkin Date: Fri, 5 Apr 2019 15:24:13 +0300 Subject: [PATCH 3/5] Update all targets to swift 4.2 --- NGRValidator.xcodeproj/project.pbxproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/NGRValidator.xcodeproj/project.pbxproj b/NGRValidator.xcodeproj/project.pbxproj index 663fad5..b888b56 100644 --- a/NGRValidator.xcodeproj/project.pbxproj +++ b/NGRValidator.xcodeproj/project.pbxproj @@ -1803,7 +1803,7 @@ SUPPORTED_PLATFORMS = macosx; SWIFT_INSTALL_OBJC_HEADER = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; VALID_ARCHS = "x86_64 i386"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1837,7 +1837,7 @@ SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = macosx; SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; VALID_ARCHS = "x86_64 i386"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1869,7 +1869,7 @@ SDKROOT = macosx; SWIFT_OBJC_BRIDGING_HEADER = "NGRValidatorTests/NGRValidatorTests-MacOS-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -1898,7 +1898,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; SWIFT_OBJC_BRIDGING_HEADER = "NGRValidatorTests/NGRValidatorTests-MacOS-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -2078,7 +2078,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "NGRValidatorTests/NGRValidatorTests-iOS-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -2107,7 +2107,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.netguru.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "NGRValidatorTests/NGRValidatorTests-iOS-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Release; }; From 9e7ea052a7df4b9ce5f999da37831a85a6660a4d Mon Sep 17 00:00:00 2001 From: Dmitry Simkin Date: Fri, 5 Apr 2019 15:27:14 +0300 Subject: [PATCH 4/5] Update to swift 5 --- NGRValidator.xcodeproj/project.pbxproj | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/NGRValidator.xcodeproj/project.pbxproj b/NGRValidator.xcodeproj/project.pbxproj index b888b56..3a3f032 100644 --- a/NGRValidator.xcodeproj/project.pbxproj +++ b/NGRValidator.xcodeproj/project.pbxproj @@ -1266,7 +1266,7 @@ 020A96B91E82D29100DF6E12 = { CreatedOnToolsVersion = 8.2.1; DevelopmentTeam = WCB4RRJ4WD; - LastSwiftMigration = 1010; + LastSwiftMigration = 1020; ProvisioningStyle = Automatic; }; 022227AB1E85046A00CE4399 = { @@ -1285,7 +1285,7 @@ }; 5E5C0A071A498164002D3E72 = { CreatedOnToolsVersion = 6.1; - LastSwiftMigration = 0820; + LastSwiftMigration = 1020; }; }; }; @@ -1294,6 +1294,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -1735,8 +1736,7 @@ SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_INSTALL_OBJC_HEADER = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VALID_ARCHS = "arm64 armv7 armv7s"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1768,8 +1768,7 @@ SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VALID_ARCHS = "arm64 armv7 armv7s"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -2078,7 +2077,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "NGRValidatorTests/NGRValidatorTests-iOS-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -2107,7 +2106,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.netguru.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "NGRValidatorTests/NGRValidatorTests-iOS-Bridging-Header.h"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; From b480c7a48bb8d627b93247face12890a808f8b06 Mon Sep 17 00:00:00 2001 From: Dmitry Simkin Date: Fri, 5 Apr 2019 15:27:29 +0300 Subject: [PATCH 5/5] Removed warnings --- NGRValidator.xcodeproj/project.pbxproj | 3 +-- NGRValidator/NGRValidator/NGRValidator+Swift.swift | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/NGRValidator.xcodeproj/project.pbxproj b/NGRValidator.xcodeproj/project.pbxproj index 3a3f032..2136338 100644 --- a/NGRValidator.xcodeproj/project.pbxproj +++ b/NGRValidator.xcodeproj/project.pbxproj @@ -1291,10 +1291,9 @@ }; buildConfigurationList = 5E5C09EA1A498164002D3E72 /* Build configuration list for PBXProject "NGRValidator" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( - English, en, Base, ); diff --git a/NGRValidator/NGRValidator/NGRValidator+Swift.swift b/NGRValidator/NGRValidator/NGRValidator+Swift.swift index ccda3c4..73325fa 100644 --- a/NGRValidator/NGRValidator/NGRValidator+Swift.swift +++ b/NGRValidator/NGRValidator/NGRValidator+Swift.swift @@ -16,7 +16,7 @@ public extension NGRValidator { * **/ - public static func validate(model: Any, tillFirstError: Bool = false, delegate: NGRMessaging? = nil, scenario: String? = nil, rules: NGRRules) -> [Error]? { + static func validate(model: Any, tillFirstError: Bool = false, delegate: NGRMessaging? = nil, scenario: String? = nil, rules: NGRRules) -> [Error]? { guard let validators = rules()?.sorted(by: { $0.priority > $1.priority }) else { print("Lack of validation rules in \(model) model. Validation couldn't be processed.") @@ -56,7 +56,7 @@ public extension NGRValidator { return tillFirstError ? nil : errors } - public static func validate(value: Any, named: String, rules: @escaping (NGRPropertyValidator?) -> Void) -> Error? { + static func validate(value: Any, named: String, rules: @escaping (NGRPropertyValidator?) -> Void) -> Error? { let inspector = NGRRuntimeInspector(model: value) guard inspector.isClassOrStruct() else { fatalError("Validation is supported only for Structs or Classes")