Skip to content
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 Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.0
// swift-tools-version:5.1
import PackageDescription

// Note: SPM support is broken until we can add dependency on UIKit.
Expand All @@ -15,5 +15,5 @@ let package = Package(
sources: ["Sources"]
)
],
swiftLanguageVersions: [3, 4, 5]
swiftLanguageVersions: [.v4_2, .v5]
)
5 changes: 3 additions & 2 deletions Sources/Storyboard/StoryboardBased.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ import UIKit
/// * this ViewController is the initialViewController of your Storyboard
///
/// to be able to instantiate them from the Storyboard in a type-safe manner
@available(iOS 10.0, *)
public protocol StoryboardBased: class {
/// The UIStoryboard to use when we want to instantiate this ViewController
static var sceneStoryboard: UIStoryboard { get }
}

// MARK: Default Implementation

@available(iOS 10.0, *)
public extension StoryboardBased {
/// By default, use the storybaord with the same name as the class
static var sceneStoryboard: UIStoryboard {
Expand All @@ -30,7 +31,7 @@ public extension StoryboardBased {
}

// MARK: Support for instantiation from Storyboard

@available(iOS 10.0, *)
public extension StoryboardBased where Self: UIViewController {
/**
Create an instance of the ViewController from its associated Storyboard's initialViewController
Expand Down
5 changes: 3 additions & 2 deletions Sources/Storyboard/StoryboardSceneBased.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import UIKit
/// to be able to instantiate them from the Storyboard in a type-safe manner.
///
/// You need to implement `sceneStoryboard` yourself to indicate the UIStoryboard this scene is from.
@available(iOS 10.0, *)
public protocol StoryboardSceneBased: class {
/// The UIStoryboard to use when we want to instantiate this ViewController
static var sceneStoryboard: UIStoryboard { get }
Expand All @@ -25,7 +26,7 @@ public protocol StoryboardSceneBased: class {
}

// MARK: Default Implementation

@available(iOS 10.0, *)
public extension StoryboardSceneBased {
/// By default, use the `sceneIdentifier` with the same name as the class
static var sceneIdentifier: String {
Expand All @@ -34,7 +35,7 @@ public extension StoryboardSceneBased {
}

// MARK: Support for instantiation from Storyboard

@available(iOS 10.0, *)
public extension StoryboardSceneBased where Self: UIViewController {
/**
Create an instance of the ViewController from its associated Storyboard and the
Expand Down
4 changes: 3 additions & 1 deletion Sources/View/NibLoadable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ import UIKit
/// * this class is used as the XIB's root view
///
/// to be able to instantiate them from the NIB in a type-safe manner
@available(iOS 10.0, *)
public protocol NibLoadable: class {
/// The nib file to use to load a new instance of the View designed in a XIB
static var nib: UINib { get }
}

// MARK: Default implementation

@available(iOS 10.0, *)
public extension NibLoadable {
/// By default, use the nib which have the same name as the name of the class,
/// and located in the bundle of that class
Expand All @@ -31,7 +33,7 @@ public extension NibLoadable {
}

// MARK: Support for instantiation from NIB

@available(iOS 10.0, *)
public extension NibLoadable where Self: UIView {
/**
Returns a `UIView` object instantiated from nib
Expand Down
5 changes: 3 additions & 2 deletions Sources/View/NibOwnerLoadable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ import UIKit
/// * this class is used as the XIB's File's Owner
///
/// to be able to instantiate them from the NIB in a type-safe manner
@available(iOS 10.0, *)
public protocol NibOwnerLoadable: class {
/// The nib file to use to load a new instance of the View designed in a XIB
static var nib: UINib { get }
}

// MARK: Default implementation

@available(iOS 10.0, *)
public extension NibOwnerLoadable {
/// By default, use the nib which have the same name as the name of the class,
/// and located in the bundle of that class
Expand All @@ -31,7 +32,7 @@ public extension NibOwnerLoadable {
}

// MARK: Support for instantiation from NIB

@available(iOS 10.0, *)
public extension NibOwnerLoadable where Self: UIView {
/**
Adds content loaded from the nib to the end of the receiver's list of subviews and adds constraints automatically.
Expand Down
3 changes: 3 additions & 0 deletions Sources/View/Reusable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import UIKit
/// Make your `UITableViewCell` and `UICollectionViewCell` subclasses
/// conform to this protocol when they are *not* NIB-based but only code-based
/// to be able to dequeue them in a type-safe manner
@available(iOS 10.0, *)
public protocol Reusable: class {
/// The reuse identifier to use when registering and later dequeuing a reusable cell
static var reuseIdentifier: String { get }
Expand All @@ -21,10 +22,12 @@ public protocol Reusable: class {
/// Make your `UITableViewCell` and `UICollectionViewCell` subclasses
/// conform to this typealias when they *are* NIB-based
/// to be able to dequeue them in a type-safe manner
@available(iOS 10.0, *)
public typealias NibReusable = Reusable & NibLoadable

// MARK: - Default implementation

@available(iOS 10.0, *)
public extension Reusable {
/// By default, use the name of the class as String for its reuseIdentifier
static var reuseIdentifier: String {
Expand Down
1 change: 1 addition & 0 deletions Sources/View/UICollectionView+Reusable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import UIKit

// MARK: Reusable support for UICollectionView

@available(iOS 10.0, *)
public extension UICollectionView {
/**
Register a NIB-Based `UICollectionViewCell` subclass (conforming to `Reusable` & `NibLoadable`)
Expand Down
2 changes: 1 addition & 1 deletion Sources/View/UITableView+Reusable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit

// MARK: Reusable support for UITableView

@available(iOS 10.0, *)
public extension UITableView {
/**
Register a NIB-Based `UITableViewCell` subclass (conforming to `Reusable` & `NibLoadable`)
Expand Down