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

Commit 1dd6380

Browse files
committed
Extensions with unavailable/rename annotations for Swift 2 to Swift 3 update
1 parent 02c5fae commit 1dd6380

File tree

4 files changed

+219
-0
lines changed

4 files changed

+219
-0
lines changed

Diff for: Library/Core/Core+Migration.swift

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// Core+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 Foundation
10+
11+
// Renames from Swift 2 to Swift 3
12+
13+
public extension StoryboardSegueIdentifier {
14+
15+
@available(*, unavailable, renamed: "storyboardSegue(withSource:)")
16+
public func storyboardSegueWithSource(_ sourceViewController: Source)
17+
-> StoryboardSegue<Segue, Source, Destination>
18+
{
19+
fatalError()
20+
}
21+
}
22+
23+
public extension TypedStoryboardSegueInfo {
24+
25+
@available(*, unavailable, renamed: "destination")
26+
public var destinationViewController: Destination { fatalError() }
27+
28+
@available(*, unavailable, renamed: "source")
29+
public var sourceViewController: Source { fatalError() }
30+
}
31+
32+
public extension StoryboardSegue {
33+
34+
@available(*, unavailable, renamed: "source")
35+
public var sourceViewController: Source { fatalError() }
36+
37+
@available(*, unavailable, renamed: "init(identifier:source:)")
38+
public init(identifier: StoryboardSegueIdentifier<Segue, Source, Destination>, sourceViewController: Source) {
39+
fatalError()
40+
}
41+
}

Diff for: Library/Foundation/Foundation+Migration.swift

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// Foundation+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 Foundation
10+
11+
// Renames from Swift 2 to Swift 3
12+
13+
public extension Bundle {
14+
15+
@available(*, unavailable, renamed: "url(forResource:)")
16+
public func URLForResource(_ resource: FileResourceType) -> URL? {
17+
fatalError()
18+
}
19+
20+
21+
@available(*, unavailable, renamed: "path(forResource:)")
22+
public func pathForResource(_ resource: FileResourceType) -> String? {
23+
fatalError()
24+
}
25+
}

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

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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+
}

Diff for: R.swift.Library.xcodeproj/project.pbxproj

+12
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
E250BE951CCBF58200CC71DE /* ColorResource+UIKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E250BE931CCBCEB100CC71DE /* ColorResource+UIKit.swift */; };
6868
E250BE971CCBF60300CC71DE /* StringResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E250BE961CCBF60300CC71DE /* StringResource.swift */; };
6969
E250BE991CCBF7E900CC71DE /* StringResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E250BE961CCBF60300CC71DE /* StringResource.swift */; };
70+
E2B0AF361D8142A400A7196C /* Core+Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2B0AF351D8142A400A7196C /* Core+Migration.swift */; };
71+
E2B0AF381D8142BF00A7196C /* UIKit+Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2B0AF371D8142BF00A7196C /* UIKit+Migration.swift */; };
72+
E2B0AF3A1D81483900A7196C /* Foundation+Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2B0AF391D81483900A7196C /* Foundation+Migration.swift */; };
7073
/* End PBXBuildFile section */
7174

7275
/* Begin PBXContainerItemProxy section */
@@ -122,6 +125,9 @@
122125
E22D43661C95EEA100692FFF /* ColorResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorResource.swift; sourceTree = "<group>"; };
123126
E250BE931CCBCEB100CC71DE /* ColorResource+UIKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ColorResource+UIKit.swift"; sourceTree = "<group>"; };
124127
E250BE961CCBF60300CC71DE /* StringResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringResource.swift; sourceTree = "<group>"; };
128+
E2B0AF351D8142A400A7196C /* Core+Migration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Core+Migration.swift"; sourceTree = "<group>"; };
129+
E2B0AF371D8142BF00A7196C /* UIKit+Migration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIKit+Migration.swift"; sourceTree = "<group>"; };
130+
E2B0AF391D81483900A7196C /* Foundation+Migration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Foundation+Migration.swift"; sourceTree = "<group>"; };
125131
/* End PBXFileReference section */
126132

127133
/* Begin PBXFrameworksBuildPhase section */
@@ -174,6 +180,7 @@
174180
D543F9C31C1498FB00D16A0C /* UITableView+ReuseIdentifierProtocol.swift */,
175181
D543F9C71C14995800D16A0C /* UIViewController+NibResource.swift */,
176182
D543F9C91C14998800D16A0C /* UIViewController+StoryboardSegueIdentifierProtocol.swift */,
183+
E2B0AF371D8142BF00A7196C /* UIKit+Migration.swift */,
177184
);
178185
path = UIKit;
179186
sourceTree = "<group>";
@@ -193,6 +200,7 @@
193200
D51335261C959DF20014C9D4 /* StoryboardViewControllerResource.swift */,
194201
E250BE961CCBF60300CC71DE /* StringResource.swift */,
195202
D53F19231C229D7200AE2FAD /* Validatable.swift */,
203+
E2B0AF351D8142A400A7196C /* Core+Migration.swift */,
196204
);
197205
path = Core;
198206
sourceTree = "<group>";
@@ -202,6 +210,7 @@
202210
children = (
203211
D56DC7721C42B65C00623437 /* Bundle+FileResource.swift */,
204212
E20F34A61C92B44100338F81 /* Data+FileResource.swift */,
213+
E2B0AF391D81483900A7196C /* Foundation+Migration.swift */,
205214
);
206215
path = Foundation;
207216
sourceTree = "<group>";
@@ -481,6 +490,7 @@
481490
D543F9BD1C14980600D16A0C /* ReuseIdentifierProtocol.swift in Sources */,
482491
D543F9C11C14984300D16A0C /* NibResource.swift in Sources */,
483492
D553F5851C44157000885232 /* ImageResource.swift in Sources */,
493+
E2B0AF381D8142BF00A7196C /* UIKit+Migration.swift in Sources */,
484494
E20F34A71C92B44100338F81 /* Data+FileResource.swift in Sources */,
485495
D57E1EB51C3D774000DDA68F /* UIFont+FontResource.swift in Sources */,
486496
D5588CAB1C3F9DBE00912F97 /* UINib+NibResource.swift in Sources */,
@@ -490,7 +500,9 @@
490500
D543F9C61C14992000D16A0C /* UICollectionView+ReuseIdentifierProtocol.swift in Sources */,
491501
D543F9BF1C14983100D16A0C /* StoryboardSegueIdentifierProtocol.swift in Sources */,
492502
D543F9C81C14995800D16A0C /* UIViewController+NibResource.swift in Sources */,
503+
E2B0AF3A1D81483900A7196C /* Foundation+Migration.swift in Sources */,
493504
D5E435A91C3CFB460091090C /* NibResource+UIKit.swift in Sources */,
505+
E2B0AF361D8142A400A7196C /* Core+Migration.swift in Sources */,
494506
E250BE971CCBF60300CC71DE /* StringResource.swift in Sources */,
495507
D543F9CF1C149C0A00D16A0C /* TypedStoryboardSegueInfo+UIStoryboardSegue.swift in Sources */,
496508
E250BE941CCBCEB100CC71DE /* ColorResource+UIKit.swift in Sources */,

0 commit comments

Comments
 (0)