From 103ba18b53ede7bab1d45f61e507862271f6abee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Santana=20Ferreira?= Date: Mon, 5 Nov 2018 14:18:14 -0200 Subject: [PATCH] Conversion to swift 4.2 --- .../IOStickyHeader.xcodeproj/project.pbxproj | 89 ++++++++++--------- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++ .../xcschemes/IOStickyHeader-Example.xcscheme | 2 +- .../xcschemes/IOStickyHeader.xcscheme | 2 +- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++ Example/Podfile.lock | 8 +- IOStickyHeader.podspec | 4 +- Sources/IOStickyHeaderFlowLayout.swift | 4 +- 8 files changed, 72 insertions(+), 53 deletions(-) create mode 100644 Example/IOStickyHeader.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Example/IOStickyHeader.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Example/IOStickyHeader.xcodeproj/project.pbxproj b/Example/IOStickyHeader.xcodeproj/project.pbxproj index 67848e9..373502f 100644 --- a/Example/IOStickyHeader.xcodeproj/project.pbxproj +++ b/Example/IOStickyHeader.xcodeproj/project.pbxproj @@ -19,7 +19,6 @@ B5A103C51DE4DAC8007A0543 /* IOStickyHeader.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = B5A103BD1DE4DAC7007A0543 /* IOStickyHeader.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; B5A103CC1DE4DAF4007A0543 /* IOStickyHeaderFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A103CA1DE4DAF4007A0543 /* IOStickyHeaderFlowLayout.swift */; }; B5A103CD1DE4DAF4007A0543 /* IOStickyHeaderFlowLayoutAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5A103CB1DE4DAF4007A0543 /* IOStickyHeaderFlowLayoutAttributes.swift */; }; - B5A103CE1DE4DC29007A0543 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = B5A103C01DE4DAC8007A0543 /* Info.plist */; }; B5BBF3F71B4527530036E522 /* IOCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5BBF3F61B4527530036E522 /* IOCell.swift */; }; B5BBF3F91B45278A0036E522 /* IOSectionHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5BBF3F81B45278A0036E522 /* IOSectionHeader.swift */; }; B5BBF3FB1B4533360036E522 /* IOParallaxVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5BBF3FA1B4533360036E522 /* IOParallaxVC.swift */; }; @@ -66,7 +65,7 @@ 3A821C5AE99B2DA5F9DAE72D /* Pods-IOStickyHeader_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IOStickyHeader_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-IOStickyHeader_Example/Pods-IOStickyHeader_Example.release.xcconfig"; sourceTree = ""; }; 42CB45BE0D2D8AA9AF35EF4F /* Pods-IOStickyHeader_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IOStickyHeader_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-IOStickyHeader_Example/Pods-IOStickyHeader_Example.debug.xcconfig"; sourceTree = ""; }; 453879E8AAFF88C0851E23EC /* Pods-IOStickyHeader_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IOStickyHeader_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-IOStickyHeader_Tests/Pods-IOStickyHeader_Tests.release.xcconfig"; sourceTree = ""; }; - 4DEE4639C9130DFBCA00CA7A /* IOStickyHeader.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = IOStickyHeader.podspec; path = ../IOStickyHeader.podspec; sourceTree = ""; }; + 4DEE4639C9130DFBCA00CA7A /* IOStickyHeader.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = IOStickyHeader.podspec; path = ../IOStickyHeader.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 607FACD01AFB9204008FA782 /* IOStickyHeader_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IOStickyHeader_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -280,7 +279,6 @@ 607FACCD1AFB9204008FA782 /* Frameworks */, 607FACCE1AFB9204008FA782 /* Resources */, E690F7EFDD9AB9147E6B7291 /* [CP] Embed Pods Frameworks */, - 53901772650ED5CCD6793AE3 /* [CP] Copy Pods Resources */, B5A103C91DE4DAC8007A0543 /* Embed Frameworks */, ); buildRules = ( @@ -302,7 +300,6 @@ 607FACE21AFB9204008FA782 /* Frameworks */, 607FACE31AFB9204008FA782 /* Resources */, FC8B3611137FE200ADFC5906 /* [CP] Embed Pods Frameworks */, - 13307848A4FD7EB6D983827E /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -340,7 +337,7 @@ attributes = { CLASSPREFIX = IO; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1010; ORGANIZATIONNAME = "Benjamin Prieur"; TargetAttributes = { 607FACCF1AFB9204008FA782 = { @@ -357,6 +354,7 @@ B5A103BC1DE4DAC7007A0543 = { CreatedOnToolsVersion = 8.1; DevelopmentTeam = 59DC93254K; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; }; }; @@ -405,56 +403,28 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - B5A103CE1DE4DC29007A0543 /* Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 13307848A4FD7EB6D983827E /* [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-IOStickyHeader_Tests/Pods-IOStickyHeader_Tests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 458576CB9494E3ADDF380322 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-IOStickyHeader_Example-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../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; - }; - 53901772650ED5CCD6793AE3 /* [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-IOStickyHeader_Example/Pods-IOStickyHeader_Example-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; }; 7C6F527ACC59BC384EE6C554 /* [CP] Check Pods Manifest.lock */ = { @@ -463,13 +433,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-IOStickyHeader_Tests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../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; }; E690F7EFDD9AB9147E6B7291 /* [CP] Embed Pods Frameworks */ = { @@ -478,9 +451,12 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-IOStickyHeader_Example/Pods-IOStickyHeader_Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/IOStickyHeader/IOStickyHeader.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IOStickyHeader.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -493,9 +469,12 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-IOStickyHeader_Tests/Pods-IOStickyHeader_Tests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/IOStickyHeader/IOStickyHeader.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IOStickyHeader.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -579,13 +558,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -625,13 +614,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; @@ -650,6 +649,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_VERSION = 3.0; VALIDATE_PRODUCT = YES; }; @@ -670,7 +670,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -687,7 +688,8 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -748,7 +750,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -777,7 +780,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -821,6 +825,7 @@ B5A103C71DE4DAC8007A0543 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/Example/IOStickyHeader.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/IOStickyHeader.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/IOStickyHeader.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/IOStickyHeader.xcodeproj/xcshareddata/xcschemes/IOStickyHeader-Example.xcscheme b/Example/IOStickyHeader.xcodeproj/xcshareddata/xcschemes/IOStickyHeader-Example.xcscheme index 67dd149..13ef98b 100644 --- a/Example/IOStickyHeader.xcodeproj/xcshareddata/xcschemes/IOStickyHeader-Example.xcscheme +++ b/Example/IOStickyHeader.xcodeproj/xcshareddata/xcschemes/IOStickyHeader-Example.xcscheme @@ -1,6 +1,6 @@ + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/Podfile.lock b/Example/Podfile.lock index b193dd4..4c3858b 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,16 +1,16 @@ PODS: - - IOStickyHeader (1.0.0) + - IOStickyHeader (1.0.1) DEPENDENCIES: - IOStickyHeader (from `../`) EXTERNAL SOURCES: IOStickyHeader: - :path: ../ + :path: "../" SPEC CHECKSUMS: - IOStickyHeader: 9aef3014a0fc1ed4cbe702d7a0b574e64516f576 + IOStickyHeader: cdb4654ede0861fb6a4a83563146cbc3375c8daf PODFILE CHECKSUM: 98c07bf9f34f0cf1d9ecb9d7de1472459ceca4e2 -COCOAPODS: 1.1.0.rc.2 +COCOAPODS: 1.5.3 diff --git a/IOStickyHeader.podspec b/IOStickyHeader.podspec index 233a01e..dd14d77 100644 --- a/IOStickyHeader.podspec +++ b/IOStickyHeader.podspec @@ -22,9 +22,7 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/BenjaminPrieur/IOStickyHeader.git", :tag => s.version.to_s } # s.social_media_url = 'https://twitter.com/' - s.pod_target_xcconfig = { - 'SWIFT_VERSION' => '3.0' - } + s.swift_version = '4.2' s.platform = :ios, '9.0' s.requires_arc = true diff --git a/Sources/IOStickyHeaderFlowLayout.swift b/Sources/IOStickyHeaderFlowLayout.swift index 8e45d9a..f6f440a 100644 --- a/Sources/IOStickyHeaderFlowLayout.swift +++ b/Sources/IOStickyHeaderFlowLayout.swift @@ -69,7 +69,7 @@ open class IOStickyHeaderFlowLayout: UICollectionViewFlowLayout { attributes.frame = frame let indexPath = attributes.indexPath - if attributes.representedElementKind == UICollectionElementKindSectionHeader { + if attributes.representedElementKind == UICollectionView.elementKindSectionHeader { headers.setObject(attributes, forKey: (indexPath as NSIndexPath).section as NSCopying) } else { let currentAttribute = lastCells.object(forKey: (indexPath as IndexPath).section) @@ -131,7 +131,7 @@ open class IOStickyHeaderFlowLayout: UICollectionViewFlowLayout { var header = headers[indexPAthKey] if header == nil { - header = self.layoutAttributesForSupplementaryView(ofKind: UICollectionElementKindSectionHeader, at: IndexPath(item: 0, section: (indexPath as NSIndexPath).section)) + header = self.layoutAttributesForSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, at: IndexPath(item: 0, section: (indexPath as NSIndexPath).section)) if let header:UICollectionViewLayoutAttributes = header as? UICollectionViewLayoutAttributes { allItems.append(header) }