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

Commit e6f4575

Browse files
committed
Rename to more Swiftier names
1 parent fe1785e commit e6f4575

11 files changed

+28
-28
lines changed

Diff for: Library/Core/FileResource.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public extension FileResourceType {
4141
- returns: The file URL for this resource or nil if the file could not be located.
4242
*/
4343
func url() -> URL? {
44-
return bundle.URLForResource(self)
44+
return bundle.urlForResource(self)
4545
}
4646
}
4747

Diff for: Library/Core/StoryboardSegueIdentifierProtocol.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public struct StoryboardSegueIdentifier<Segue, Source, Destination>: StoryboardS
4444
}
4545

4646
/// Create a new StoryboardSegue based on the identifier and source view controller
47-
public func storyboardSegueWithSource(_ sourceViewController: Source)
47+
public func storyboardSegue(withSource sourceViewController: Source)
4848
-> StoryboardSegue<Segue, Source, Destination>
4949
{
5050
return StoryboardSegue(identifier: self, sourceViewController: sourceViewController)

Diff for: Library/Core/StoryboardViewControllerResource.swift

-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ public struct StoryboardViewControllerResource<ViewController>: StoryboardViewCo
2222
self.identifier = identifier
2323
}
2424
}
25-

Diff for: Library/Foundation/Bundle+FileResource.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public extension Bundle {
1616

1717
- returns: The file URL for the resource file (R.file.*) or nil if the file could not be located.
1818
*/
19-
public func URLForResource(_ resource: FileResourceType) -> URL? {
19+
public func urlForResource(_ resource: FileResourceType) -> URL? {
2020
return urlForResource(resource.name, withExtension: resource.pathExtension)
2121
}
2222

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 instantiateWithOwner(_ ownerOrNil: AnyObject?, options optionsOrNil: [NSObject : AnyObject]? = nil) -> [AnyObject] {
21+
public func instantiate(withOwner ownerOrNil: AnyObject?, options optionsOrNil: [NSObject : AnyObject]? = [:]) -> [AnyObject] {
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 where SegueIdentifier.SegueType == Segue, SegueIdentifier.SourceType == Source, SegueIdentifier.DestinationType == Destination>(segueIdentifier: SegueIdentifier, segue: UIStoryboardSegue)
19+
{
1920
guard let identifier = segue.identifier,
2021
let sourceViewController = segue.sourceViewController as? SegueIdentifier.SourceType,
2122
let destinationViewController = segue.destinationViewController as? SegueIdentifier.DestinationType,

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

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

1919
- returns: A subclass of UICollectionReusableView or nil if the cast fails.
2020
*/
21-
public func dequeueReusableCellWithReuseIdentifier<Identifier: ReuseIdentifierType where Identifier.ReusableType: UICollectionReusableView>(_ identifier: Identifier, forIndexPath indexPath: IndexPath) -> Identifier.ReusableType? {
21+
public func dequeueReusableCell<Identifier: ReuseIdentifierType where Identifier.ReusableType: UICollectionReusableView>(withReuseIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType? {
2222
return dequeueReusableCell(withReuseIdentifier: identifier.identifier, for: indexPath) as? Identifier.ReusableType
2323
}
2424

@@ -31,7 +31,7 @@ public extension UICollectionView {
3131

3232
- returns: A subclass of UICollectionReusableView or nil if the cast fails.
3333
*/
34-
public func dequeueReusableSupplementaryViewOfKind<Identifier: ReuseIdentifierType where Identifier.ReusableType: UICollectionReusableView>(_ elementKind: String, withReuseIdentifier identifier: Identifier, forIndexPath indexPath: IndexPath) -> Identifier.ReusableType? {
34+
public func dequeueReusableSupplementaryView<Identifier: ReuseIdentifierType where Identifier.ReusableType: UICollectionReusableView>(ofKind elementKind: String, withReuseIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType? {
3535
return dequeueReusableSupplementaryView(ofKind: elementKind, withReuseIdentifier: identifier.identifier, for: indexPath) as? Identifier.ReusableType
3636
}
3737

@@ -40,16 +40,16 @@ public extension UICollectionView {
4040

4141
- parameter nibResources: An array of nib resources (R.nib.*) each containing a object of type UICollectionViewCell that has a reuse identifier
4242
*/
43-
public func registerNibs<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionViewCell>(_ nibResources: [Resource]) {
44-
nibResources.forEach(registerNib)
43+
public func register<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionViewCell>(_ nibResources: [Resource]) {
44+
nibResources.forEach(register)
4545
}
4646

4747
/**
4848
Register a R.nib.* for use in creating new collection view cells.
4949

5050
- parameter nibResource: A nib resource (R.nib.*) containing a object of type UICollectionViewCell that has a reuse identifier
5151
*/
52-
public func registerNib<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionViewCell>(_ nibResource: Resource) {
52+
public func register<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionViewCell>(_ nibResource: Resource) {
5353
register(UINib(resource: nibResource), forCellWithReuseIdentifier: nibResource.identifier)
5454
}
5555

@@ -58,16 +58,16 @@ public extension UICollectionView {
5858

5959
- parameter nibResources: An array of nib resources (R.nib.*) each containing a object of type UICollectionReusableView. that has a reuse identifier
6060
*/
61-
public func registerNibs<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView>(_ nibResources: [Resource], forSupplementaryViewOfKind kind: String) {
62-
nibResources.forEach { self.registerNib($0, forSupplementaryViewOfKind: kind) }
61+
public func register<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView>(_ nibResources: [Resource], forSupplementaryViewOfKind kind: String) {
62+
nibResources.forEach { self.register($0, forSupplementaryViewOfKind: kind) }
6363
}
6464

6565
/**
6666
Register a R.nib.* for use in creating supplementary views for the collection view.
6767

6868
- parameter nibResource: A nib resource (R.nib.*) containing a object of type UICollectionReusableView. that has a reuse identifier
6969
*/
70-
public func registerNib<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView>(_ nibResource: Resource, forSupplementaryViewOfKind kind: String) {
70+
public func register<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView>(_ nibResource: Resource, forSupplementaryViewOfKind kind: String) {
7171
register(UINib(resource: nibResource), forSupplementaryViewOfKind: kind, withReuseIdentifier: nibResource.identifier)
7272
}
7373
}

Diff for: Library/UIKit/UIImage+ImageResource.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public extension UIImage {
1717

1818
- returns: An image that exactly or best matches the desired traits with the given resource (R.image.*), or nil if no suitable image was found.
1919
*/
20-
public convenience init?(resource: ImageResourceType, compatibleWithTraitCollection traitCollection: UITraitCollection? = nil) {
20+
public convenience init?(resource: ImageResourceType, compatibleWith traitCollection: UITraitCollection? = nil) {
2121
self.init(named: resource.name, in: resource.bundle, compatibleWith: traitCollection)
2222
}
2323
}

Diff for: Library/UIKit/UIStoryboard+StoryboardViewControllerResource.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public extension UIStoryboard {
1717

1818
- returns: The view controller corresponding to the specified resource (R.storyboard.*.*). If no view controller is associated, this method throws an exception.
1919
*/
20-
public func instantiateViewController<ViewControllerResource: StoryboardViewControllerResourceType>(_ resource: ViewControllerResource) -> ViewControllerResource.ViewControllerType? {
20+
public func instantiateViewController<ViewControllerResource: StoryboardViewControllerResourceType>(withResource resource: ViewControllerResource) -> ViewControllerResource.ViewControllerType? {
2121
return self.instantiateViewController(withIdentifier: resource.identifier) as? ViewControllerResource.ViewControllerType
2222
}
2323
}

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ 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 dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(_ identifier: Identifier, forIndexPath indexPath: IndexPath) -> Identifier.ReusableType? {
23+
public func dequeueReusableCell<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(withIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType? {
2424
return dequeueReusableCell(withIdentifier: identifier.identifier, for: indexPath) as? Identifier.ReusableType
2525
}
2626

@@ -33,7 +33,7 @@ public extension UITableView {
3333

3434
- precondition: You must register a class or nib file using the registerNib: or registerClass:forCellReuseIdentifier: method before calling this method.
3535
*/
36-
public func dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(_ identifier: Identifier) -> Identifier.ReusableType? {
36+
public func dequeueReusableCell<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(withIdentifier identifier: Identifier) -> Identifier.ReusableType? {
3737
return dequeueReusableCell(withIdentifier: identifier.identifier) as? Identifier.ReusableType
3838
}
3939

@@ -44,7 +44,7 @@ public extension UITableView {
4444

4545
- 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.
4646
*/
47-
public func dequeueReusableHeaderFooterViewWithIdentifier<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewHeaderFooterView>(_ identifier: Identifier) -> Identifier.ReusableType? {
47+
public func dequeueReusableHeaderFooterView<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewHeaderFooterView>(withIdentifier identifier: Identifier) -> Identifier.ReusableType? {
4848
return dequeueReusableHeaderFooterView(withIdentifier: identifier.identifier) as? Identifier.ReusableType
4949
}
5050

@@ -53,16 +53,16 @@ public extension UITableView {
5353

5454
- parameter nibResources: Array of nib resources (R.nib.*) each containing a table view cell that has a reuse identifier
5555
*/
56-
public func registerNibs<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell>(_ nibResources: [Resource]) {
57-
nibResources.forEach(registerNib)
56+
public func register<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell>(_ nibResources: [Resource]) {
57+
nibResources.forEach(register)
5858
}
5959

6060
/**
6161
Register a R.nib.* containing a cell with the table view under it's contained identifier.
6262

6363
- parameter nibResource: A nib resource (R.nib.*) containing a table view cell that has a reuse identifier
6464
*/
65-
public func registerNib<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell>(_ nibResource: Resource) {
65+
public func register<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UITableViewCell>(_ nibResource: Resource) {
6666
register(UINib(resource: nibResource), forCellReuseIdentifier: nibResource.identifier)
6767
}
6868

@@ -71,7 +71,7 @@ public extension UITableView {
7171

7272
- parameter nibResource: A nib resource (R.nib.*) containing a view that has a reuse identifier
7373
*/
74-
public func registerNibForHeaderFooterView<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UIView>(_ nibResource: Resource) {
74+
public func registerHeaderFooterView<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UIView>(_ nibResource: Resource) {
7575
register(UINib(resource: nibResource), forHeaderFooterViewReuseIdentifier: nibResource.identifier)
7676
}
7777
}

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
import UIKit
1111

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

1616
extension UIViewController: SeguePerformerType { }
@@ -22,10 +22,10 @@ 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 performSegueWithIdentifier<Segue, Destination>(
26-
_ identifier: StoryboardSegueIdentifier<Segue, Self, Destination>,
25+
public func performSegue<Segue, Destination>(
26+
withIdentifier identifier: StoryboardSegueIdentifier<Segue, Self, Destination>,
2727
sender: AnyObject?) {
28-
performSegueWithIdentifier(identifier.identifier, sender: sender)
28+
performSegue(withIdentifier: identifier.identifier, sender: sender)
2929
}
3030
}
3131

@@ -34,7 +34,7 @@ public extension StoryboardSegue where Source : UIViewController {
3434
Performs this segue on the source view controller
3535
- 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.
3636
*/
37-
public func performSegue(_ sender: AnyObject? = nil) {
37+
public func performSegue(sender: AnyObject? = nil) {
3838
sourceViewController.performSegue(withIdentifier: identifier.identifier, sender: sender)
3939
}
4040
}

0 commit comments

Comments
 (0)