diff --git a/AKPFlowLayout.xcodeproj/project.pbxproj b/AKPFlowLayout.xcodeproj/project.pbxproj index 7df416c..e69856a 100644 --- a/AKPFlowLayout.xcodeproj/project.pbxproj +++ b/AKPFlowLayout.xcodeproj/project.pbxproj @@ -171,7 +171,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Arseniy Kuznetsov"; TargetAttributes = { 57FA3EB51D0D877E00EFD324 = { @@ -188,10 +188,11 @@ }; buildConfigurationList = 57FA3EB01D0D877E00EFD324 /* Build configuration list for PBXProject "AKPFlowLayout" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 57FA3EAC1D0D877E00EFD324; productRefGroup = 57FA3EB71D0D877E00EFD324 /* Products */; @@ -256,19 +257,28 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 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; @@ -307,19 +317,28 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 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; @@ -366,7 +385,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -387,7 +406,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.akpw.AKPFlowLayout; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/AKPFlowLayout.xcodeproj/xcshareddata/xcschemes/AKPFlowLayout.xcscheme b/AKPFlowLayout.xcodeproj/xcshareddata/xcschemes/AKPFlowLayout.xcscheme index 3dbfaa1..0b48542 100644 --- a/AKPFlowLayout.xcodeproj/xcshareddata/xcschemes/AKPFlowLayout.xcscheme +++ b/AKPFlowLayout.xcodeproj/xcshareddata/xcschemes/AKPFlowLayout.xcscheme @@ -1,6 +1,6 @@ + + + + IDEDidComputeMac32BitWarning + + + diff --git a/AKPFlowLayout/AKPFlowLayout.swift b/AKPFlowLayout/AKPFlowLayout.swift index 9f88c54..0789bf1 100644 --- a/AKPFlowLayout/AKPFlowLayout.swift +++ b/AKPFlowLayout/AKPFlowLayout.swift @@ -59,14 +59,14 @@ public final class AKPFlowLayout: UICollectionViewFlowLayout { for idx in customSectionHeadersIdxs { let indexPath = IndexPath(item: 0, section: idx) if let attributes = super.layoutAttributesForSupplementaryView( - ofKind: UICollectionElementKindSectionHeader, + ofKind: UICollectionView.elementKindSectionHeader, at: indexPath) as? AKPFlowLayoutAttributes { layoutAttributes.append(attributes) } } // for section headers, need to adjust their attributes for attributes in layoutAttributes where - attributes.representedElementKind == UICollectionElementKindSectionHeader { + attributes.representedElementKind == UICollectionView.elementKindSectionHeader { (attributes.frame, attributes.zIndex) = adjustLayoutAttributes(forSectionAttributes: attributes) } return layoutAttributes @@ -118,7 +118,7 @@ public final class AKPFlowLayout: UICollectionViewFlowLayout { // then invalidate let invalidatedIdxPaths = sectionIdxPaths.map { IndexPath(item: 0, section: $0) } invalidationContext.invalidateSupplementaryElements( - ofKind: UICollectionElementKindSectionHeader, at: invalidatedIdxPaths ) + ofKind: UICollectionView.elementKindSectionHeader, at: invalidatedIdxPaths ) } return invalidationContext } @@ -169,7 +169,7 @@ extension AKPFlowLayout { // remove the sections that should already be taken care of by UICollectionViewFlowLayout for attributes in layoutAttributes - where attributes.representedElementKind == UICollectionElementKindSectionHeader { + where attributes.representedElementKind == UICollectionView.elementKindSectionHeader { sectionIdxs.remove((attributes.indexPath as NSIndexPath).section) } return sectionIdxs @@ -207,7 +207,7 @@ extension AKPFlowLayout { // Stretchy header if firstSectionHeight - offset < firsSectionMaximumStretchHeight { sectionFrame.size.height = firstSectionHeight - offset - sectionHeadersLayoutAttributes.stretchFactor = fabs(offset) + sectionHeadersLayoutAttributes.stretchFactor = abs(offset) previousStretchFactor = sectionHeadersLayoutAttributes.stretchFactor } else { // need to limit the stretch @@ -297,7 +297,7 @@ extension AKPFlowLayout { private extension AKPFlowLayoutAttributes { // Determines if element is a section, or is a cell in a section with custom header func visibleSectionHeader(_ sectionsShouldPin: Bool) -> Bool { - let isHeader = representedElementKind == UICollectionElementKindSectionHeader + let isHeader = representedElementKind == UICollectionView.elementKindSectionHeader let isCellInPinnedSection = sectionsShouldPin && ( representedElementCategory == .cell ) return isCellInPinnedSection || isHeader }