Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions Library/Core/FileResource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public extension FileResourceType {
- returns: The full pathname for this resource or nil if the file could not be located.
*/
func path() -> String? {
return bundle.pathForResource(resource: self)
return bundle.pathForResource(self)
}

/**
Expand All @@ -41,7 +41,7 @@ public extension FileResourceType {
- returns: The file URL for this resource or nil if the file could not be located.
*/
func url() -> URL? {
return bundle.URLForResource(resource: self)
return bundle.urlForResource(self)
}
}

Expand Down
2 changes: 1 addition & 1 deletion Library/Core/StoryboardSegueIdentifierProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public struct StoryboardSegueIdentifier<Segue, Source, Destination>: StoryboardS
}

/// Create a new StoryboardSegue based on the identifier and source view controller
public func storyboardSegueWithSource(sourceViewController: Source)
public func storyboardSegue(withSourceViewController sourceViewController: Source)
-> StoryboardSegue<Segue, Source, Destination>
{
return StoryboardSegue(identifier: self, sourceViewController: sourceViewController)
Expand Down
4 changes: 2 additions & 2 deletions Library/Foundation/NSBundle+FileResource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public extension Bundle {

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

Expand All @@ -27,7 +27,7 @@ public extension Bundle {

- returns: The full pathname for the resource file (R.file.*) or nil if the file could not be located.
*/
public func pathForResource(resource: FileResourceType) -> String? {
public func pathForResource(_ resource: FileResourceType) -> String? {
return pathForResource(resource.name, ofType: resource.pathExtension)
}
}
2 changes: 1 addition & 1 deletion Library/UIKit/NibResource+UIKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public extension NibResourceType {

- returns: An array containing the top-level objects from the NIB
*/
public func instantiateWithOwner(ownerOrNil: AnyObject?, options optionsOrNil: [NSObject : AnyObject]? = nil) -> [AnyObject] {
public func instantiate(withOwner ownerOrNil: AnyObject?, options optionsOrNil: [NSObject : AnyObject]? = nil) -> [AnyObject] {
return UINib(resource: self).instantiate(withOwner: ownerOrNil, options: optionsOrNil)
}
}
18 changes: 9 additions & 9 deletions Library/UIKit/UICollectionView+ReuseIdentifierProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public extension UICollectionView {

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

/**
Expand All @@ -31,16 +31,16 @@ public extension UICollectionView {

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

/**
Register a serie of R.nib.* for use in creating new collection view cells.

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

Expand All @@ -49,7 +49,7 @@ public extension UICollectionView {

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

Expand All @@ -58,16 +58,16 @@ public extension UICollectionView {

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

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

- parameter nibResource: A nib resource (R.nib.*) containing a object of type UICollectionReusableView. that has a reuse identifier
*/
public func registerNib<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView>(nibResource: Resource, forSupplementaryViewOfKind kind: String) {
public func registerNib<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UICollectionReusableView>(_ nibResource: Resource, forSupplementaryViewOfKind kind: String) {
register(UINib(resource: nibResource), forSupplementaryViewOfKind: kind, withReuseIdentifier: nibResource.identifier)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public extension UIStoryboard {

- returns: The view controller corresponding to the specified resource (R.storyboard.*.*). If no view controller is associated, this method throws an exception.
*/
public func instantiateViewController<ViewControllerResource: StoryboardViewControllerResourceType>(resource: ViewControllerResource) -> ViewControllerResource.ViewControllerType? {
public func instantiateViewController<ViewControllerResource: StoryboardViewControllerResourceType>(withResource resource: ViewControllerResource) -> ViewControllerResource.ViewControllerType? {
return instantiateViewController(withIdentifier: resource.identifier) as? ViewControllerResource.ViewControllerType
}
}
10 changes: 5 additions & 5 deletions Library/UIKit/UITableView+ReuseIdentifierProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public extension UITableView {

- precondition: You must register a class or nib file using the registerNib: or registerClass:forCellReuseIdentifier: method before calling this method.
*/
public func dequeueReusableCellWithIdentifier<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(identifier: Identifier, forIndexPath indexPath: NSIndexPath) -> Identifier.ReusableType? {
return dequeueReusableCell(withIdentifier: identifier.identifier, for: indexPath as IndexPath) as? Identifier.ReusableType
public func dequeueReusableCell<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewCell>(withIdentifier identifier: Identifier, for indexPath: IndexPath) -> Identifier.ReusableType? {
return dequeueReusableCell(withIdentifier: identifier.identifier, for: indexPath) as? Identifier.ReusableType
}

/**
Expand All @@ -33,7 +33,7 @@ public extension UITableView {

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

Expand All @@ -44,7 +44,7 @@ public extension UITableView {

- 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.
*/
public func dequeueReusableHeaderFooterViewWithIdentifier<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewHeaderFooterView>(identifier: Identifier) -> Identifier.ReusableType? {
public func dequeueReusableHeaderFooterView<Identifier: ReuseIdentifierType where Identifier.ReusableType: UITableViewHeaderFooterView>(withIdentifier identifier: Identifier) -> Identifier.ReusableType? {
return dequeueReusableHeaderFooterView(withIdentifier: identifier.identifier) as? Identifier.ReusableType
}

Expand All @@ -71,7 +71,7 @@ public extension UITableView {

- parameter nibResource: A nib resource (R.nib.*) containing a view that has a reuse identifier
*/
public func registerNibForHeaderFooterView<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UIView>(nibResource: Resource) {
public func registerNibForHeaderFooterView<Resource: NibResourceType where Resource: ReuseIdentifierType, Resource.ReusableType: UIView>(_ nibResource: Resource) {
register(UINib(resource: nibResource), forHeaderFooterViewReuseIdentifier: nibResource.identifier)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public extension SeguePerformerType {
- 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.
- SeeAlso: Library for typed block based segues: [tomlokhorst/SegueManager](https://github.com/tomlokhorst/SegueManager)
*/
public func performSegueWithIdentifier<Segue, Destination>(
public func performSegue<Segue, Destination>(withIdentifier
identifier: StoryboardSegueIdentifier<Segue, Self, Destination>,
sender: AnyObject?) {
performSegue(withIdentifier: identifier.identifier, sender: sender)
Expand Down