Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Commit 81dacb1

Browse files
committed
Updates for Xcode 8 beta 6
1 parent a039751 commit 81dacb1

6 files changed

+39
-22
lines changed

Diff for: Library/Core/Validatable.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ extension Validatable {
3535
assert( theRealAssert() )
3636
}
3737

38-
private static func theRealAssert() -> Bool {
38+
fileprivate static func theRealAssert() -> Bool {
3939
do {
4040
try validate()
4141
} catch {
42-
assertionFailure("Validation of \(self.dynamicType) failed with error: \(error)")
42+
assertionFailure("Validation of \(type(of: self)) failed with error: \(error)")
4343
}
4444

4545
return true

Diff for: Library/UIKit/NibResource+UIKit.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public extension NibResourceType {
1818

1919
- returns: An array containing the top-level objects from the NIB
2020
*/
21-
public func instantiate(withOwner ownerOrNil: AnyObject?, options optionsOrNil: [NSObject : AnyObject]? = [:]) -> [AnyObject] {
21+
public func instantiate(withOwner ownerOrNil: Any?, options optionsOrNil: [AnyHashable : Any]? = [:]) -> [Any] {
2222
return UINib(resource: self).instantiate(withOwner: ownerOrNil, options: optionsOrNil)
2323
}
2424
}

Diff for: Library/UIKit/TypedStoryboardSegueInfo+UIStoryboardSegue.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ extension TypedStoryboardSegueInfo {
1515

1616
- returns: A newly initialized TypedStoryboardSegueInfo object or nil.
1717
*/
18-
public init?<SegueIdentifier: StoryboardSegueIdentifierType where SegueIdentifier.SegueType == Segue, SegueIdentifier.SourceType == Source, SegueIdentifier.DestinationType == Destination>(segueIdentifier: SegueIdentifier, segue: UIStoryboardSegue)
18+
public init?<SegueIdentifier: StoryboardSegueIdentifierType>(segueIdentifier: SegueIdentifier, segue: UIStoryboardSegue)
19+
where SegueIdentifier.SegueType == Segue, SegueIdentifier.SourceType == Source, SegueIdentifier.DestinationType == Destination
1920
{
2021
guard let identifier = segue.identifier,
2122
let source = segue.source as? SegueIdentifier.SourceType,

Diff for: Library/UIKit/UICollectionView+ReuseIdentifierProtocol.swift

+18-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ public extension UICollectionView {
1818

1919
- returns: A subclass of UICollectionReusableView or nil if the cast fails.
2020
*/
21-
public func dequeueReusableCell<Identifier: ReuseIdentifierType where Identifier.ReusableType: UICollectionReusableView>(withReuseIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType? {
21+
public func dequeueReusableCell<Identifier: ReuseIdentifierType>(withReuseIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType?
22+
where Identifier.ReusableType: UICollectionReusableView
23+
{
2224
return dequeueReusableCell(withReuseIdentifier: identifier.identifier, for: indexPath) as? Identifier.ReusableType
2325
}
2426

@@ -31,7 +33,9 @@ public extension UICollectionView {
3133

3234
- returns: A subclass of UICollectionReusableView or nil if the cast fails.
3335
*/
34-
public func dequeueReusableSupplementaryView<Identifier: ReuseIdentifierType where Identifier.ReusableType: UICollectionReusableView>(ofKind elementKind: String, withReuseIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType? {
36+
public func dequeueReusableSupplementaryView<Identifier: ReuseIdentifierType>(ofKind elementKind: String, withReuseIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType?
37+
where Identifier.ReusableType: UICollectionReusableView
38+
{
3539
return dequeueReusableSupplementaryView(ofKind: elementKind, withReuseIdentifier: identifier.identifier, for: indexPath) as? Identifier.ReusableType
3640
}
3741

@@ -40,7 +44,9 @@ public extension UICollectionView {
4044

4145
- parameter nibResources: An array of nib resources (R.nib.*) each containing a object of type UICollectionViewCell that has a reuse identifier
4246
*/
43-
public func register<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionViewCell>(_ nibResources: [Resource]) {
47+
public func register<Resource: NibResourceType>(_ nibResources: [Resource])
48+
where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionViewCell
49+
{
4450
nibResources.forEach(register)
4551
}
4652

@@ -49,7 +55,9 @@ public extension UICollectionView {
4955

5056
- parameter nibResource: A nib resource (R.nib.*) containing a object of type UICollectionViewCell that has a reuse identifier
5157
*/
52-
public func register<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionViewCell>(_ nibResource: Resource) {
58+
public func register<Resource: NibResourceType>(_ nibResource: Resource)
59+
where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionViewCell
60+
{
5361
register(UINib(resource: nibResource), forCellWithReuseIdentifier: nibResource.identifier)
5462
}
5563

@@ -58,7 +66,9 @@ public extension UICollectionView {
5866

5967
- parameter nibResources: An array of nib resources (R.nib.*) each containing a object of type UICollectionReusableView. that has a reuse identifier
6068
*/
61-
public func register<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView>(_ nibResources: [Resource], forSupplementaryViewOfKind kind: String) {
69+
public func register<Resource: NibResourceType>(_ nibResources: [Resource], forSupplementaryViewOfKind kind: String)
70+
where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView
71+
{
6272
nibResources.forEach { self.register($0, forSupplementaryViewOfKind: kind) }
6373
}
6474

@@ -67,7 +77,9 @@ public extension UICollectionView {
6777

6878
- parameter nibResource: A nib resource (R.nib.*) containing a object of type UICollectionReusableView. that has a reuse identifier
6979
*/
70-
public func register<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView>(_ nibResource: Resource, forSupplementaryViewOfKind kind: String) {
80+
public func register<Resource: NibResourceType>(_ nibResource: Resource, forSupplementaryViewOfKind kind: String)
81+
where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView
82+
{
7183
register(UINib(resource: nibResource), forSupplementaryViewOfKind: kind, withReuseIdentifier: nibResource.identifier)
7284
}
7385
}

Diff for: Library/UIKit/UITableView+ReuseIdentifierProtocol.swift

+12-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ public extension UITableView {
2020

2121
- precondition: You must register a class or nib file using the registerNib: or registerClass:forCellReuseIdentifier: method before calling this method.
2222
*/
23-
public func dequeueReusableCell<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(withIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType? {
23+
public func dequeueReusableCell<Identifier: ReuseIdentifierType>(withIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType?
24+
where Identifier.ReusableType: UITableViewCell
25+
{
2426
return dequeueReusableCell(withIdentifier: identifier.identifier, for: indexPath) as? Identifier.ReusableType
2527
}
2628

@@ -33,7 +35,9 @@ public extension UITableView {
3335

3436
- precondition: You must register a class or nib file using the registerNib: or registerClass:forCellReuseIdentifier: method before calling this method.
3537
*/
36-
public func dequeueReusableCell<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(withIdentifier identifier: Identifier) -> Identifier.ReusableType? {
38+
public func dequeueReusableCell<Identifier: ReuseIdentifierType>(withIdentifier identifier: Identifier) -> Identifier.ReusableType?
39+
where Identifier.ReusableType: UITableViewCell
40+
{
3741
return dequeueReusableCell(withIdentifier: identifier.identifier) as? Identifier.ReusableType
3842
}
3943

@@ -44,7 +48,9 @@ public extension UITableView {
4448

4549
- returns: A UITableViewHeaderFooterView object with the associated identifier or nil if no such object exists in the reusable view queue or if it couldn't be cast correctly.
4650
*/
47-
public func dequeueReusableHeaderFooterView<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewHeaderFooterView>(withIdentifier identifier: Identifier) -> Identifier.ReusableType? {
51+
public func dequeueReusableHeaderFooterView<Identifier: ReuseIdentifierType>(withIdentifier identifier: Identifier) -> Identifier.ReusableType?
52+
where Identifier.ReusableType: UITableViewHeaderFooterView
53+
{
4854
return dequeueReusableHeaderFooterView(withIdentifier: identifier.identifier) as? Identifier.ReusableType
4955
}
5056

@@ -53,7 +59,7 @@ public extension UITableView {
5359

5460
- parameter nibResources: Array of nib resources (R.nib.*) each containing a table view cell that has a reuse identifier
5561
*/
56-
public func register<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell>(_ nibResources: [Resource]) {
62+
public func register<Resource: NibResourceType>(_ nibResources: [Resource]) where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell {
5763
nibResources.forEach(register)
5864
}
5965

@@ -62,7 +68,7 @@ public extension UITableView {
6268

6369
- parameter nibResource: A nib resource (R.nib.*) containing a table view cell that has a reuse identifier
6470
*/
65-
public func register<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell>(_ nibResource: Resource) {
71+
public func register<Resource: NibResourceType>(_ nibResource: Resource) where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell {
6672
register(UINib(resource: nibResource), forCellReuseIdentifier: nibResource.identifier)
6773
}
6874

@@ -71,7 +77,7 @@ public extension UITableView {
7177

7278
- parameter nibResource: A nib resource (R.nib.*) containing a view that has a reuse identifier
7379
*/
74-
public func registerHeaderFooterView<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UIView>(_ nibResource: Resource) {
80+
public func registerHeaderFooterView<Resource: NibResourceType>(_ nibResource: Resource) where Resource: ReuseIdentifierType, Resource.ReusableType: UIView {
7581
register(UINib(resource: nibResource), forHeaderFooterViewReuseIdentifier: nibResource.identifier)
7682
}
7783
}

Diff for: Library/UIKit/UIViewController+StoryboardSegueIdentifierProtocol.swift

+4-6
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import Foundation
1010
import UIKit
1111

1212
public protocol SeguePerformerType {
13-
func performSegue(withIdentifier identifier: String, sender: AnyObject?)
13+
func performSegue(withIdentifier identifier: String, sender: Any?)
1414
}
1515

16-
extension UIViewController: SeguePerformerType { }
16+
extension UIViewController: SeguePerformerType {}
1717

1818
public extension SeguePerformerType {
1919
/**
@@ -22,9 +22,7 @@ public extension SeguePerformerType {
2222
- parameter sender: The object that you want to use to initiate the segue. This object is made available for informational purposes during the actual segue.
2323
- SeeAlso: Library for typed block based segues: [tomlokhorst/SegueManager](https://github.com/tomlokhorst/SegueManager)
2424
*/
25-
public func performSegue<Segue, Destination>(
26-
withIdentifier identifier: StoryboardSegueIdentifier<Segue, Self, Destination>,
27-
sender: AnyObject?) {
25+
public func performSegue<Segue, Destination>(withIdentifier identifier: StoryboardSegueIdentifier<Segue, Self, Destination>, sender: Any?) {
2826
performSegue(withIdentifier: identifier.identifier, sender: sender)
2927
}
3028
}
@@ -34,7 +32,7 @@ public extension StoryboardSegue where Source : UIViewController {
3432
Performs this segue on the source view controller
3533
- parameter sender: The object that you want to use to initiate the segue. This object is made available for informational purposes during the actual segue.
3634
*/
37-
public func performSegue(sender: AnyObject? = nil) {
35+
public func performSegue(sender: Any? = nil) {
3836
source.performSegue(withIdentifier: identifier.identifier, sender: sender)
3937
}
4038
}

0 commit comments

Comments
 (0)