Skip to content

Commit

Permalink
Migration to Swift 4.2 to support Xcode 10 (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilchandelier authored and Antondomashnev committed Oct 29, 2018
1 parent 5201e2d commit 9a37635
Show file tree
Hide file tree
Showing 374 changed files with 21,263 additions and 7,907 deletions.
2 changes: 1 addition & 1 deletion .swift-version
@@ -1 +1 @@
3.2
4.2
4 changes: 3 additions & 1 deletion ADMozaicCollectionViewLayout.podspec
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'ADMozaicCollectionViewLayout'
s.version = '4.0.4'
s.version = '4.1.0'
s.summary = "Custom mozaic style collection view layout"

s.description = <<-DESC
Expand All @@ -18,4 +18,6 @@ Pod::Spec.new do |s|
s.source_files = 'ADMozaikCollectionViewLayout/**/*.swift'
s.frameworks = 'UIKit'

s.swift_version = '4.2'

end
22 changes: 13 additions & 9 deletions ADMozaikCollectionViewLayout.xcodeproj/project.pbxproj
Expand Up @@ -286,16 +286,16 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Anton Domashnev";
TargetAttributes = {
6D7BE5B01CEA148400A41445 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 1000;
};
6D7BE5BA1CEA148400A41445 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 1000;
};
};
};
Expand Down Expand Up @@ -464,12 +464,14 @@
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;
Expand Down Expand Up @@ -502,7 +504,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -522,12 +524,14 @@
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;
Expand All @@ -553,7 +557,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -580,7 +584,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -602,7 +606,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.antondomashnev.ADMozaikCollectionViewLayout;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -620,7 +624,7 @@
SWIFT_INSTALL_OBJC_HEADER = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -637,7 +641,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_INSTALL_OBJC_HEADER = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,8 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down
Expand Up @@ -88,7 +88,7 @@ class ADMozaikLayoutAttributes {
let layoutGeometry = layoutGeometries[section]
let layoutMatrix = layoutMatrixes[section]

if let attributes = buildLayoutAttributesForSupplementaryView(of: UICollectionElementKindSectionHeader, in: section, geometry: layoutGeometry, additionalOffsetY: layoutSectionGeometryOffsetY) {
if let attributes = buildLayoutAttributesForSupplementaryView(of: UICollectionView.elementKindSectionHeader, in: section, geometry: layoutGeometry, additionalOffsetY: layoutSectionGeometryOffsetY) {
allAttributes.append(attributes)
}

Expand All @@ -103,7 +103,7 @@ class ADMozaikLayoutAttributes {
}
}

if let attributes = buildLayoutAttributesForSupplementaryView(of: UICollectionElementKindSectionFooter, in: section, geometry: layoutGeometry, additionalOffsetY: layoutSectionGeometryOffsetY) {
if let attributes = buildLayoutAttributesForSupplementaryView(of: UICollectionView.elementKindSectionFooter, in: section, geometry: layoutGeometry, additionalOffsetY: layoutSectionGeometryOffsetY) {
allAttributes.append(attributes)
}

Expand Down
Expand Up @@ -71,10 +71,10 @@ class ADMozaikLayoutSectionGeometry {
///
/// - Returns: frame for the view, nil in case of no presense of the supplementary view of given kind
func frameForSupplementaryView(of kind: String) -> CGRect? {
if kind == UICollectionElementKindSectionFooter {
if kind == UICollectionView.elementKindSectionFooter {
return geometryInfo.footerHeight > 0 ? CGRect(x: geometryInfo.sectionInset.left, y: contentHeight - geometryInfo.sectionInset.bottom, width: contentWidth, height: geometryInfo.footerHeight) : nil
}
else if kind == UICollectionElementKindSectionHeader {
else if kind == UICollectionView.elementKindSectionHeader {
return geometryInfo.headerHeight > 0 ? CGRect(x: geometryInfo.sectionInset.left, y: geometryInfo.sectionInset.top, width: contentWidth, height: geometryInfo.headerHeight) : nil
}
fatalError("Unknown supplementary view kind: \(kind)")
Expand Down
2 changes: 1 addition & 1 deletion ADMozaikCollectionViewLayout/Public/ADMozaikLayout.swift
Expand Up @@ -153,7 +153,7 @@ open class ADMozaikLayout: UICollectionViewFlowLayout {

fileprivate func createSectionInformations() {
guard let cache = self.layoutCache, let delegate = self.delegate, let collectionView = self.collectionView else {
fatalError("createLayoutGeometries internal parameters don't satisfy requirenments: cache: \(String(describing: self.layoutCache)), delegate: \(self.delegate), collectionView = \(String(describing: self.collectionView)))")
fatalError("createLayoutGeometries internal parameters don't satisfy requirenments: cache: \(String(describing: self.layoutCache)), delegate: \(String(describing: self.delegate)), collectionView = \(String(describing: self.collectionView)))")
}
var buildingLayoutGeometries: [ADMozaikLayoutSectionGeometry] = []
var buildingLayoutMatrixes: [ADMozaikLayoutSectionMatrix] = []
Expand Down
@@ -1,4 +1,4 @@
// Generated using Sourcery 0.6.1 — https://github.com/krzysztofzablocki/Sourcery
// Generated using Sourcery 0.15.0 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT

// swiftlint:disable file_length
Expand Down
@@ -1,4 +1,4 @@
// Generated using Sourcery 0.6.1 — https://github.com/krzysztofzablocki/Sourcery
// Generated using Sourcery 0.15.0 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT

// swiftlint:disable file_length
Expand Down
Expand Up @@ -56,21 +56,21 @@ class ADMozaikLayoutGeometryTests: XCTestCase {
func testThatFrameForSupplementaryViewShouldReturnNilForFooterWithZeroHeight() {
layoutGeometry = buildLayoutGeometryWith(header: true, footer: false)

expect(self.layoutGeometry.frameForSupplementaryView(of: UICollectionElementKindSectionFooter)).to(beNil())
expect(self.layoutGeometry.frameForSupplementaryView(of: UICollectionView.elementKindSectionFooter)).to(beNil())
}

func testThatFrameForSupplementaryViewShouldReturnNilForHeaderWithZeroHeight() {
layoutGeometry = buildLayoutGeometryWith(header: false, footer: true)

expect(self.layoutGeometry.frameForSupplementaryView(of: UICollectionElementKindSectionHeader)).to(beNil())
expect(self.layoutGeometry.frameForSupplementaryView(of: UICollectionView.elementKindSectionHeader)).to(beNil())
}

func testThatFrameForSupplementaryViewShouldReturnCorrectFrameForHeaderWithNonZeroHeight() {
layoutGeometry = buildLayoutGeometryWith(header: true, footer: true)
layoutGeometry.registerElement(with: CGRect(x: 0, y: 45, width: 212, height: 212))

let expectedFrame = CGRect(x: 1, y: 3, width: 318, height: 44)
expect(self.layoutGeometry.frameForSupplementaryView(of: UICollectionElementKindSectionHeader)).to(equal(expectedFrame))
expect(self.layoutGeometry.frameForSupplementaryView(of: UICollectionView.elementKindSectionHeader)).to(equal(expectedFrame))
}

func testThatFrameForSupplementaryViewShouldReturnCorrectFrameForFooterWithNonZeroHeight() {
Expand All @@ -80,7 +80,7 @@ class ADMozaikLayoutGeometryTests: XCTestCase {
layoutGeometry.registerElement(with: CGRect(x: 214, y: 154, width: 105, height: 212))

let expectedFrame = CGRect(x: 1, y: 366, width: 318, height: 88)
expect(self.layoutGeometry.frameForSupplementaryView(of: UICollectionElementKindSectionFooter)).to(equal(expectedFrame))
expect(self.layoutGeometry.frameForSupplementaryView(of: UICollectionView.elementKindSectionFooter)).to(equal(expectedFrame))
}

func testThatRegisterElementShouldCalculateContentHeightCorrectly() {
Expand Down
6 changes: 3 additions & 3 deletions ADMozaikCollectionViewLayoutTests/ADMozaikLayoutTests.swift
Expand Up @@ -370,8 +370,8 @@ class ADMozaikLayoutTestsViewController: UIViewController, ADMozaikLayoutDelegat
self.view.addSubview(self.collectionView)
self.collectionView.dataSource = self
self.collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "ADMozaikLayoutCell")
self.collectionView.register(ADMozaikLayoutFooter.self, forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, withReuseIdentifier: "ADMozaikLayoutFooter")
self.collectionView.register(ADMozaikLayoutHeader.self, forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "ADMozaikLayoutHeader")
self.collectionView.register(ADMozaikLayoutFooter.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "ADMozaikLayoutFooter")
self.collectionView.register(ADMozaikLayoutHeader.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "ADMozaikLayoutHeader")
}

//MARK: - ADMozaikLayoutDelegate
Expand Down Expand Up @@ -405,7 +405,7 @@ class ADMozaikLayoutTestsViewController: UIViewController, ADMozaikLayoutDelegat
}

func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
if kind == UICollectionElementKindSectionHeader {
if kind == UICollectionView.elementKindSectionHeader {
let view = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "ADMozaikLayoutHeader", for: indexPath)
return view
}
Expand Down
12 changes: 8 additions & 4 deletions Example/Example.xcodeproj/project.pbxproj
Expand Up @@ -139,12 +139,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Anton Domashnev";
TargetAttributes = {
6DC978001CFE211A00B7679E = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0800;
LastSwiftMigration = 1000;
};
};
};
Expand Down Expand Up @@ -259,12 +259,14 @@
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;
Expand Down Expand Up @@ -312,12 +314,14 @@
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;
Expand Down Expand Up @@ -353,7 +357,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.antondomashnev.admozaikcollectionviewlayout.example.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -366,7 +370,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.antondomashnev.admozaikcollectionviewlayout.example.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/AppDelegate.swift
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/InitFromCodeExampleViewController.swift
Expand Up @@ -92,7 +92,7 @@ class InitFromCodeExampleViewController: UIViewController, ADMozaikLayoutDelegat
//MARK: - UICollectionViewDelegate

func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
if kind == UICollectionElementKindSectionHeader {
if kind == UICollectionView.elementKindSectionHeader {
return collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "ADMozaikLayoutHeader", for: indexPath)
}
else {
Expand Down
6 changes: 3 additions & 3 deletions Example/Example/InitFromStoryboardExampleViewController.swift
Expand Up @@ -20,8 +20,8 @@ class InitFromStoryboardExampleViewController: UIViewController, ADMozaikLayoutD
super.viewDidLoad()
self.automaticallyAdjustsScrollViewInsets = false
mozaikLayout.delegate = self
collectionView.register(UINib.init(nibName: "ReusableSupplementaryHeaderView", bundle: Bundle.main), forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "ADMozaikLayoutHeader")
collectionView.register(UINib.init(nibName: "ReusableSupplementaryFooterView", bundle: Bundle.main), forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, withReuseIdentifier: "ADMozaikLayoutFooter")
collectionView.register(UINib.init(nibName: "ReusableSupplementaryHeaderView", bundle: Bundle.main), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "ADMozaikLayoutHeader")
collectionView.register(UINib.init(nibName: "ReusableSupplementaryFooterView", bundle: Bundle.main), forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "ADMozaikLayoutFooter")
}

//MARK: - ADMozaikLayoutDelegate
Expand Down Expand Up @@ -59,7 +59,7 @@ class InitFromStoryboardExampleViewController: UIViewController, ADMozaikLayoutD
//MARK: - UICollectionViewDelegate

func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
if kind == UICollectionElementKindSectionHeader {
if kind == UICollectionView.elementKindSectionHeader {
return collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "ADMozaikLayoutHeader", for: indexPath)
}
else {
Expand Down
14 changes: 7 additions & 7 deletions Podfile.lock
Expand Up @@ -4,8 +4,8 @@ PODS:
- FBSnapshotTestCase/Core (2.1.4)
- FBSnapshotTestCase/SwiftSupport (2.1.4):
- FBSnapshotTestCase/Core
- Nimble (7.0.1)
- Sourcery (0.6.1)
- Nimble (7.3.1)
- Sourcery (0.15.0)

DEPENDENCIES:
- FBSnapshotTestCase (from `https://github.com/facebook/ios-snapshot-test-case.git`, branch `master`)
Expand All @@ -26,16 +26,16 @@ EXTERNAL SOURCES:

CHECKOUT OPTIONS:
FBSnapshotTestCase:
:commit: d9ec82be11d473576258f107489f7013ee321771
:commit: 3efc829601128f7d9306e8e58db04d32594b62ce
:git: https://github.com/facebook/ios-snapshot-test-case.git
Nimble:
:commit: 39b67002306fda9de4c9fd1290a6295f97edd09e
:commit: c68f5fd88997ab93a53cab07434349621882c817
:git: https://github.com/Quick/Nimble.git

SPEC CHECKSUMS:
FBSnapshotTestCase: 094f9f314decbabe373b87cc339bea235a63e07a
Nimble: f8cda7a16ec2180b57905dd50b28127220f66a17
Sourcery: 1426fbb5fe2d53f1e03845e989a89b6b67ce4e33
FBSnapshotTestCase: a8e5a33928796ea13ebb3e9ea58e0187270d3eff
Nimble: 6e4123b6d882a0f8c7f950236a3251d678cf12a2
Sourcery: 5895672cae353cdbfa95f3f4aaeb75a664d76f6a

PODFILE CHECKSUM: 5a889c6e436cf4d5b0caff8446311ea6b3d7a040

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9a37635

Please sign in to comment.