Skip to content

Commit ffd43d9

Browse files
committed
Converted to Swift 3 and made some iOS 10 bugfixes
1 parent 9956ccd commit ffd43d9

File tree

9 files changed

+113
-67
lines changed

9 files changed

+113
-67
lines changed

Example/BSGridCollectionViewLayout.xcodeproj/project.pbxproj

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,16 @@
219219
isa = PBXProject;
220220
attributes = {
221221
LastSwiftUpdateCheck = 0710;
222-
LastUpgradeCheck = 0710;
222+
LastUpgradeCheck = 0800;
223223
ORGANIZATIONNAME = CocoaPods;
224224
TargetAttributes = {
225225
607FACCF1AFB9204008FA782 = {
226226
CreatedOnToolsVersion = 6.3.1;
227+
LastSwiftMigration = 0800;
227228
};
228229
607FACE41AFB9204008FA782 = {
229230
CreatedOnToolsVersion = 6.3.1;
231+
LastSwiftMigration = 0800;
230232
};
231233
};
232234
};
@@ -499,34 +501,40 @@
499501
isa = XCBuildConfiguration;
500502
baseConfigurationReference = BA5C906E5223E03FBDBBF0C9 /* Pods-BSGridCollectionViewLayout_Example.debug.xcconfig */;
501503
buildSettings = {
504+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
502505
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
503506
INFOPLIST_FILE = BSGridCollectionViewLayout/Info.plist;
504507
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
505508
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
506509
MODULE_NAME = ExampleApp;
507510
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
508511
PRODUCT_NAME = "$(TARGET_NAME)";
512+
SWIFT_VERSION = 3.0;
509513
};
510514
name = Debug;
511515
};
512516
607FACF11AFB9204008FA782 /* Release */ = {
513517
isa = XCBuildConfiguration;
514518
baseConfigurationReference = FE75FEF4ECD19E3E17826E56 /* Pods-BSGridCollectionViewLayout_Example.release.xcconfig */;
515519
buildSettings = {
520+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
516521
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
517522
INFOPLIST_FILE = BSGridCollectionViewLayout/Info.plist;
518523
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
519524
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
520525
MODULE_NAME = ExampleApp;
521526
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
522527
PRODUCT_NAME = "$(TARGET_NAME)";
528+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
529+
SWIFT_VERSION = 3.0;
523530
};
524531
name = Release;
525532
};
526533
607FACF31AFB9204008FA782 /* Debug */ = {
527534
isa = XCBuildConfiguration;
528535
baseConfigurationReference = F04D8B05088B4DF749D43009 /* Pods-BSGridCollectionViewLayout_Tests.debug.xcconfig */;
529536
buildSettings = {
537+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
530538
GCC_PREPROCESSOR_DEFINITIONS = (
531539
"DEBUG=1",
532540
"$(inherited)",
@@ -535,17 +543,21 @@
535543
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
536544
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
537545
PRODUCT_NAME = "$(TARGET_NAME)";
546+
SWIFT_VERSION = 3.0;
538547
};
539548
name = Debug;
540549
};
541550
607FACF41AFB9204008FA782 /* Release */ = {
542551
isa = XCBuildConfiguration;
543552
baseConfigurationReference = 4DD8060D12E59B1B67378F47 /* Pods-BSGridCollectionViewLayout_Tests.release.xcconfig */;
544553
buildSettings = {
554+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
545555
INFOPLIST_FILE = Tests/Info.plist;
546556
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
547557
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
548558
PRODUCT_NAME = "$(TARGET_NAME)";
559+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
560+
SWIFT_VERSION = 3.0;
549561
};
550562
name = Release;
551563
};

Example/BSGridCollectionViewLayout.xcodeproj/xcshareddata/xcschemes/BSGridCollectionViewLayout-Example.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Example/BSGridCollectionViewLayout/AppDelegate.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2727

2828
var window: UIWindow?
2929

30-
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
31-
// Override point for customization after application launch.
30+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
3231
return true
3332
}
3433
}

Example/BSGridCollectionViewLayout/ViewController.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ViewController: UICollectionViewController {
2727
override func viewDidLoad() {
2828
super.viewDidLoad()
2929

30-
collectionView?.backgroundColor = UIColor.whiteColor()
30+
collectionView?.backgroundColor = UIColor.white
3131

3232
let layout = GridCollectionViewLayout()
3333
layout.itemsPerRow = 3
@@ -36,28 +36,28 @@ class ViewController: UICollectionViewController {
3636

3737
collectionView?.collectionViewLayout = layout
3838

39-
collectionView?.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: "cell")
39+
collectionView?.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "cell")
4040
}
4141

4242
// MARK: Data source
43-
override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
43+
override func numberOfSections(in collectionView: UICollectionView) -> Int {
4444
return 2
4545
}
4646

47-
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
47+
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
4848
if section == 0 {
4949
return 11
5050
} else {
5151
return 18
5252
}
5353
}
5454

55-
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
56-
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath)
57-
if indexPath.section == 0 {
58-
cell.backgroundColor = UIColor.blueColor()
55+
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
56+
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)
57+
if (indexPath as NSIndexPath).section == 0 {
58+
cell.backgroundColor = UIColor.blue
5959
} else {
60-
cell.backgroundColor = UIColor.redColor()
60+
cell.backgroundColor = UIColor.red
6161
}
6262

6363
return cell

Example/Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 37 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/BSGridCollectionViewLayout.xcscheme

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Tests/FirstRowTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import XCTest
2727
class FirstRowTests: XCTestCase {
2828

2929
func testFirstRowInZeroRect() {
30-
let firstRow = GridCollectionViewLayout.firstRowInRect(CGRectZero, withRowHeight: 100.0)
30+
let firstRow = GridCollectionViewLayout.firstRowInRect(CGRect.zero, withRowHeight: 100.0)
3131
XCTAssertEqual(firstRow, 0)
3232
}
3333

Example/Tests/LastRowTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import XCTest
2626
class LastRowTests: XCTestCase {
2727

2828
func testLastRowInZeroRect() {
29-
let lastRow = GridCollectionViewLayout.lastRowInRect(CGRectZero, withRowHeight: 100, max: 3)
29+
let lastRow = GridCollectionViewLayout.lastRowInRect(CGRect.zero, withRowHeight: 100, max: 3)
3030
XCTAssertEqual(lastRow, 0)
3131
}
3232

0 commit comments

Comments
 (0)