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

Rename annotations #20

Merged
merged 1 commit into from
Sep 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Extensions with unavailable/rename annotations for Swift 2 to Swift 3…
… update
  • Loading branch information
tomlokhorst committed Sep 8, 2016
commit 1dd63802fed7d9138e483d27785b90e893ba00a5
41 changes: 41 additions & 0 deletions Library/Core/Core+Migration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// Core+Migration.swift
// R.swift.Library
//
// Created by Tom Lokhorst on 2016-09-08.
// Copyright © 2016 Mathijs Kadijk. All rights reserved.
//

import Foundation

// Renames from Swift 2 to Swift 3

public extension StoryboardSegueIdentifier {

@available(*, unavailable, renamed: "storyboardSegue(withSource:)")
public func storyboardSegueWithSource(_ sourceViewController: Source)
-> StoryboardSegue<Segue, Source, Destination>
{
fatalError()
}
}

public extension TypedStoryboardSegueInfo {

@available(*, unavailable, renamed: "destination")
public var destinationViewController: Destination { fatalError() }

@available(*, unavailable, renamed: "source")
public var sourceViewController: Source { fatalError() }
}

public extension StoryboardSegue {

@available(*, unavailable, renamed: "source")
public var sourceViewController: Source { fatalError() }

@available(*, unavailable, renamed: "init(identifier:source:)")
public init(identifier: StoryboardSegueIdentifier<Segue, Source, Destination>, sourceViewController: Source) {
fatalError()
}
}
25 changes: 25 additions & 0 deletions Library/Foundation/Foundation+Migration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// Foundation+Migration.swift
// R.swift.Library
//
// Created by Tom Lokhorst on 2016-09-08.
// Copyright © 2016 Mathijs Kadijk. All rights reserved.
//

import Foundation

// Renames from Swift 2 to Swift 3

public extension Bundle {

@available(*, unavailable, renamed: "url(forResource:)")
public func URLForResource(_ resource: FileResourceType) -> URL? {
fatalError()
}


@available(*, unavailable, renamed: "path(forResource:)")
public func pathForResource(_ resource: FileResourceType) -> String? {
fatalError()
}
}
141 changes: 141 additions & 0 deletions Library/UIKit/UIKit+Migration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
//
// UIKit+Migration.swift
// R.swift.Library
//
// Created by Tom Lokhorst on 2016-09-08.
// Copyright © 2016 Mathijs Kadijk. All rights reserved.
//

import UIKit

// Renames from Swift 2 to Swift 3

public extension NibResourceType {

@available(*, unavailable, renamed: "instantiate(withOwner:options:)")
public func instantiateWithOwner(_ ownerOrNil: AnyObject?, options optionsOrNil: [NSObject : AnyObject]? = nil) -> [AnyObject] {
fatalError()
}
}


public extension StoryboardResourceWithInitialControllerType {

@available(*, unavailable, renamed: "instantiateInitialViewController")
public func initialViewController() -> InitialController? {
fatalError()
}
}

public extension UICollectionView {

@available(*, unavailable, renamed: "dequeueReusableCell(withReuseIdentifier:for:)")
public func dequeueReusableCellWithReuseIdentifier<Identifier: ReuseIdentifierType>(_ identifier: Identifier, forIndexPath indexPath: IndexPath) -> Identifier.ReusableType?
where Identifier.ReusableType: UICollectionReusableView
{
fatalError()
}


@available(*, unavailable, renamed: "dequeueReusableSupplementaryView(ofKind:withReuseIdentifier:for:)")
public func dequeueReusableSupplementaryViewOfKind<Identifier: ReuseIdentifierType>(_ elementKind: String, withReuseIdentifier identifier: Identifier, forIndexPath indexPath: IndexPath) -> Identifier.ReusableType?
where Identifier.ReusableType: UICollectionReusableView
{
fatalError()
}


@available(*, unavailable, renamed: "register")
public func registerNibs<Resource: NibResourceType>(_ nibResources: [Resource])
where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionViewCell
{
fatalError()
}


@available(*, unavailable, renamed: "register")
public func registerNib<Resource: NibResourceType>(_ nibResource: Resource)
where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionViewCell
{
fatalError()
}


@available(*, unavailable, renamed: "register")
public func registerNibs<Resource: NibResourceType>(_ nibResources: [Resource], forSupplementaryViewOfKind kind: String)
where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView
{
fatalError()
}

@available(*, unavailable, renamed: "register")
public func registerNib<Resource: NibResourceType>(_ nibResource: Resource, forSupplementaryViewOfKind kind: String)
where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView
{
fatalError()
}
}

public extension UITableView {


@available(*, unavailable, renamed: "dequeueReusableCell(withIdentifier:for:)")
public func dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierType>(_ identifier: Identifier, forIndexPath indexPath: IndexPath) -> Identifier.ReusableType?
where Identifier.ReusableType: UITableViewCell
{
fatalError()
}


@available(*, unavailable, renamed: "dequeueReusableCell(withIdentifier:)")
public func dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierType>(_ identifier: Identifier) -> Identifier.ReusableType?
where Identifier.ReusableType: UITableViewCell
{
fatalError()
}


@available(*, unavailable, renamed: "dequeueReusableHeaderFooterView(withIdentifier:)")
public func dequeueReusableHeaderFooterViewWithIdentifier<Identifier: ReuseIdentifierType>(_ identifier: Identifier) -> Identifier.ReusableType?
where Identifier.ReusableType: UITableViewHeaderFooterView
{
fatalError()
}


@available(*, unavailable, renamed: "register")
public func registerNibs<Resource: NibResourceType>(_ nibResources: [Resource]) where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell
{
fatalError()
}


@available(*, unavailable, renamed: "register")
public func registerNib<Resource: NibResourceType>(_ nibResource: Resource) where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell
{
fatalError()
}


@available(*, unavailable, renamed: "registerHeaderFooterView")
public func registerNibForHeaderFooterView<Resource: NibResourceType>(_ nibResource: Resource) where Resource: ReuseIdentifierType, Resource.ReusableType: UIView
{
fatalError()
}
}

public extension SeguePerformerType {

@available(*, unavailable, renamed: "performSegue(withIdentifier:sender:)")
func performSegueWithIdentifier(_ identifier: String, sender: Any?) {
fatalError()
}
}

public extension SeguePerformerType {

@available(*, unavailable, renamed: "performSegue(withIdentifier:sender:)")
public func performSegueWithIdentifier<Segue, Destination>(_ identifier: StoryboardSegueIdentifier<Segue, Self, Destination>, sender: Any?) {
fatalError()
}
}
12 changes: 12 additions & 0 deletions R.swift.Library.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -67,6 +67,9 @@
E250BE951CCBF58200CC71DE /* ColorResource+UIKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = E250BE931CCBCEB100CC71DE /* ColorResource+UIKit.swift */; };
E250BE971CCBF60300CC71DE /* StringResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E250BE961CCBF60300CC71DE /* StringResource.swift */; };
E250BE991CCBF7E900CC71DE /* StringResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E250BE961CCBF60300CC71DE /* StringResource.swift */; };
E2B0AF361D8142A400A7196C /* Core+Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2B0AF351D8142A400A7196C /* Core+Migration.swift */; };
E2B0AF381D8142BF00A7196C /* UIKit+Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2B0AF371D8142BF00A7196C /* UIKit+Migration.swift */; };
E2B0AF3A1D81483900A7196C /* Foundation+Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2B0AF391D81483900A7196C /* Foundation+Migration.swift */; };
/* End PBXBuildFile section */

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

/* Begin PBXFrameworksBuildPhase section */
@@ -174,6 +180,7 @@
D543F9C31C1498FB00D16A0C /* UITableView+ReuseIdentifierProtocol.swift */,
D543F9C71C14995800D16A0C /* UIViewController+NibResource.swift */,
D543F9C91C14998800D16A0C /* UIViewController+StoryboardSegueIdentifierProtocol.swift */,
E2B0AF371D8142BF00A7196C /* UIKit+Migration.swift */,
);
path = UIKit;
sourceTree = "<group>";
@@ -193,6 +200,7 @@
D51335261C959DF20014C9D4 /* StoryboardViewControllerResource.swift */,
E250BE961CCBF60300CC71DE /* StringResource.swift */,
D53F19231C229D7200AE2FAD /* Validatable.swift */,
E2B0AF351D8142A400A7196C /* Core+Migration.swift */,
);
path = Core;
sourceTree = "<group>";
@@ -202,6 +210,7 @@
children = (
D56DC7721C42B65C00623437 /* Bundle+FileResource.swift */,
E20F34A61C92B44100338F81 /* Data+FileResource.swift */,
E2B0AF391D81483900A7196C /* Foundation+Migration.swift */,
);
path = Foundation;
sourceTree = "<group>";
@@ -481,6 +490,7 @@
D543F9BD1C14980600D16A0C /* ReuseIdentifierProtocol.swift in Sources */,
D543F9C11C14984300D16A0C /* NibResource.swift in Sources */,
D553F5851C44157000885232 /* ImageResource.swift in Sources */,
E2B0AF381D8142BF00A7196C /* UIKit+Migration.swift in Sources */,
E20F34A71C92B44100338F81 /* Data+FileResource.swift in Sources */,
D57E1EB51C3D774000DDA68F /* UIFont+FontResource.swift in Sources */,
D5588CAB1C3F9DBE00912F97 /* UINib+NibResource.swift in Sources */,
@@ -490,7 +500,9 @@
D543F9C61C14992000D16A0C /* UICollectionView+ReuseIdentifierProtocol.swift in Sources */,
D543F9BF1C14983100D16A0C /* StoryboardSegueIdentifierProtocol.swift in Sources */,
D543F9C81C14995800D16A0C /* UIViewController+NibResource.swift in Sources */,
E2B0AF3A1D81483900A7196C /* Foundation+Migration.swift in Sources */,
D5E435A91C3CFB460091090C /* NibResource+UIKit.swift in Sources */,
E2B0AF361D8142A400A7196C /* Core+Migration.swift in Sources */,
E250BE971CCBF60300CC71DE /* StringResource.swift in Sources */,
D543F9CF1C149C0A00D16A0C /* TypedStoryboardSegueInfo+UIStoryboardSegue.swift in Sources */,
E250BE941CCBCEB100CC71DE /* ColorResource+UIKit.swift in Sources */,