|
| 1 | +// |
| 2 | +// UIKit+Migration.swift |
| 3 | +// R.swift.Library |
| 4 | +// |
| 5 | +// Created by Tom Lokhorst on 2016-09-08. |
| 6 | +// Copyright © 2016 Mathijs Kadijk. All rights reserved. |
| 7 | +// |
| 8 | + |
| 9 | +import UIKit |
| 10 | + |
| 11 | +// Renames from Swift 2 to Swift 3 |
| 12 | + |
| 13 | +public extension NibResourceType { |
| 14 | + |
| 15 | + @available(*, unavailable, renamed: "instantiate(withOwner:options:)") |
| 16 | + public func instantiateWithOwner(_ ownerOrNil: AnyObject?, options optionsOrNil: [NSObject : AnyObject]? = nil) -> [AnyObject] { |
| 17 | + fatalError() |
| 18 | + } |
| 19 | +} |
| 20 | + |
| 21 | + |
| 22 | +public extension StoryboardResourceWithInitialControllerType { |
| 23 | + |
| 24 | + @available(*, unavailable, renamed: "instantiateInitialViewController") |
| 25 | + public func initialViewController() -> InitialController? { |
| 26 | + fatalError() |
| 27 | + } |
| 28 | +} |
| 29 | + |
| 30 | +public extension UICollectionView { |
| 31 | + |
| 32 | + @available(*, unavailable, renamed: "dequeueReusableCell(withReuseIdentifier:for:)") |
| 33 | + public func dequeueReusableCellWithReuseIdentifier<Identifier: ReuseIdentifierType>(_ identifier: Identifier, forIndexPath indexPath: IndexPath) -> Identifier.ReusableType? |
| 34 | + where Identifier.ReusableType: UICollectionReusableView |
| 35 | + { |
| 36 | + fatalError() |
| 37 | + } |
| 38 | + |
| 39 | + |
| 40 | + @available(*, unavailable, renamed: "dequeueReusableSupplementaryView(ofKind:withReuseIdentifier:for:)") |
| 41 | + public func dequeueReusableSupplementaryViewOfKind<Identifier: ReuseIdentifierType>(_ elementKind: String, withReuseIdentifier identifier: Identifier, forIndexPath indexPath: IndexPath) -> Identifier.ReusableType? |
| 42 | + where Identifier.ReusableType: UICollectionReusableView |
| 43 | + { |
| 44 | + fatalError() |
| 45 | + } |
| 46 | + |
| 47 | + |
| 48 | + @available(*, unavailable, renamed: "register") |
| 49 | + public func registerNibs<Resource: NibResourceType>(_ nibResources: [Resource]) |
| 50 | + where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionViewCell |
| 51 | + { |
| 52 | + fatalError() |
| 53 | + } |
| 54 | + |
| 55 | + |
| 56 | + @available(*, unavailable, renamed: "register") |
| 57 | + public func registerNib<Resource: NibResourceType>(_ nibResource: Resource) |
| 58 | + where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionViewCell |
| 59 | + { |
| 60 | + fatalError() |
| 61 | + } |
| 62 | + |
| 63 | + |
| 64 | + @available(*, unavailable, renamed: "register") |
| 65 | + public func registerNibs<Resource: NibResourceType>(_ nibResources: [Resource], forSupplementaryViewOfKind kind: String) |
| 66 | + where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView |
| 67 | + { |
| 68 | + fatalError() |
| 69 | + } |
| 70 | + |
| 71 | + @available(*, unavailable, renamed: "register") |
| 72 | + public func registerNib<Resource: NibResourceType>(_ nibResource: Resource, forSupplementaryViewOfKind kind: String) |
| 73 | + where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView |
| 74 | + { |
| 75 | + fatalError() |
| 76 | + } |
| 77 | +} |
| 78 | + |
| 79 | +public extension UITableView { |
| 80 | + |
| 81 | + |
| 82 | + @available(*, unavailable, renamed: "dequeueReusableCell(withIdentifier:for:)") |
| 83 | + public func dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierType>(_ identifier: Identifier, forIndexPath indexPath: IndexPath) -> Identifier.ReusableType? |
| 84 | + where Identifier.ReusableType: UITableViewCell |
| 85 | + { |
| 86 | + fatalError() |
| 87 | + } |
| 88 | + |
| 89 | + |
| 90 | + @available(*, unavailable, renamed: "dequeueReusableCell(withIdentifier:)") |
| 91 | + public func dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierType>(_ identifier: Identifier) -> Identifier.ReusableType? |
| 92 | + where Identifier.ReusableType: UITableViewCell |
| 93 | + { |
| 94 | + fatalError() |
| 95 | + } |
| 96 | + |
| 97 | + |
| 98 | + @available(*, unavailable, renamed: "dequeueReusableHeaderFooterView(withIdentifier:)") |
| 99 | + public func dequeueReusableHeaderFooterViewWithIdentifier<Identifier: ReuseIdentifierType>(_ identifier: Identifier) -> Identifier.ReusableType? |
| 100 | + where Identifier.ReusableType: UITableViewHeaderFooterView |
| 101 | + { |
| 102 | + fatalError() |
| 103 | + } |
| 104 | + |
| 105 | + |
| 106 | + @available(*, unavailable, renamed: "register") |
| 107 | + public func registerNibs<Resource: NibResourceType>(_ nibResources: [Resource]) where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell |
| 108 | + { |
| 109 | + fatalError() |
| 110 | + } |
| 111 | + |
| 112 | + |
| 113 | + @available(*, unavailable, renamed: "register") |
| 114 | + public func registerNib<Resource: NibResourceType>(_ nibResource: Resource) where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell |
| 115 | + { |
| 116 | + fatalError() |
| 117 | + } |
| 118 | + |
| 119 | + |
| 120 | + @available(*, unavailable, renamed: "registerHeaderFooterView") |
| 121 | + public func registerNibForHeaderFooterView<Resource: NibResourceType>(_ nibResource: Resource) where Resource: ReuseIdentifierType, Resource.ReusableType: UIView |
| 122 | + { |
| 123 | + fatalError() |
| 124 | + } |
| 125 | +} |
| 126 | + |
| 127 | +public extension SeguePerformerType { |
| 128 | + |
| 129 | + @available(*, unavailable, renamed: "performSegue(withIdentifier:sender:)") |
| 130 | + func performSegueWithIdentifier(_ identifier: String, sender: Any?) { |
| 131 | + fatalError() |
| 132 | + } |
| 133 | +} |
| 134 | + |
| 135 | +public extension SeguePerformerType { |
| 136 | + |
| 137 | + @available(*, unavailable, renamed: "performSegue(withIdentifier:sender:)") |
| 138 | + public func performSegueWithIdentifier<Segue, Destination>(_ identifier: StoryboardSegueIdentifier<Segue, Self, Destination>, sender: Any?) { |
| 139 | + fatalError() |
| 140 | + } |
| 141 | +} |
0 commit comments