diff --git a/NGRValidator.xcodeproj/project.pbxproj b/NGRValidator.xcodeproj/project.pbxproj index 1af4e1a..2136338 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 = 1020; ProvisioningStyle = Automatic; }; 022227AB1E85046A00CE4399 = { @@ -1281,19 +1280,18 @@ }; 5E5C09EE1A498164002D3E72 = { CreatedOnToolsVersion = 6.1; - DevelopmentTeam = SK8PDF7SG9; - LastSwiftMigration = 0820; + DevelopmentTeam = WCB4RRJ4WD; + LastSwiftMigration = 1010; }; 5E5C0A071A498164002D3E72 = { CreatedOnToolsVersion = 6.1; - DevelopmentTeam = SK8PDF7SG9; - LastSwiftMigration = 0820; + LastSwiftMigration = 1020; }; }; }; buildConfigurationList = 5E5C09EA1A498164002D3E72 /* Build configuration list for PBXProject "NGRValidator" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -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,7 @@ SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_INSTALL_OBJC_HEADER = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; VALID_ARCHS = "arm64 armv7 armv7s"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1762,7 +1754,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 +1767,7 @@ SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; SWIFT_INSTALL_OBJC_HEADER = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; VALID_ARCHS = "arm64 armv7 armv7s"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1788,7 +1780,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; @@ -1809,7 +1801,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 = ""; @@ -1843,7 +1835,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 = ""; @@ -1875,7 +1867,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; }; @@ -1904,7 +1896,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; }; @@ -2010,6 +2002,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 +2013,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 +2029,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 +2039,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 +2053,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)", @@ -2080,7 +2076,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 = 5.0; }; name = Debug; }; @@ -2091,7 +2087,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)", @@ -2109,7 +2105,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 = 5.0; }; name = Release; }; 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/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") 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 35f2681..b2f8cc4 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,21 +1,28 @@ 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: + https://github.com/cocoapods/specs.git: + - Expecta + - Nimble + - Quick + - Specta + SPEC CHECKSUMS: Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe - Nimble: c53e6903fee94041b90ded74f135820437d8bf59 - Quick: dafc587e21eed9f4cab3249b9f9015b0b7a7f71d + Nimble: 45f786ae66faa9a709624227fae502db55a8bdd0 + Quick: ce1276c7c27ba2da3cb2fd0cde053c3648b3b22d Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2 -PODFILE CHECKSUM: 891f44c3a75b3f20a9cabc88aca84394d180f380 +PODFILE CHECKSUM: 3560942f263370be59dd53e8d2eceac1154c3d2d -COCOAPODS: 1.2.1 +COCOAPODS: 1.6.1