diff --git a/Package.swift b/Package.swift index 51efd73..8ff84b1 100644 --- a/Package.swift +++ b/Package.swift @@ -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. @@ -15,5 +15,5 @@ let package = Package( sources: ["Sources"] ) ], - swiftLanguageVersions: [3, 4, 5] + swiftLanguageVersions: [.v4_2, .v5] ) diff --git a/Sources/Storyboard/StoryboardBased.swift b/Sources/Storyboard/StoryboardBased.swift index 9bcc7ff..18746b4 100644 --- a/Sources/Storyboard/StoryboardBased.swift +++ b/Sources/Storyboard/StoryboardBased.swift @@ -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 { @@ -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 diff --git a/Sources/Storyboard/StoryboardSceneBased.swift b/Sources/Storyboard/StoryboardSceneBased.swift index 3fd720f..b37d7af 100644 --- a/Sources/Storyboard/StoryboardSceneBased.swift +++ b/Sources/Storyboard/StoryboardSceneBased.swift @@ -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 } @@ -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 { @@ -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 diff --git a/Sources/View/NibLoadable.swift b/Sources/View/NibLoadable.swift index 773e7ab..a75c622 100755 --- a/Sources/View/NibLoadable.swift +++ b/Sources/View/NibLoadable.swift @@ -15,6 +15,7 @@ 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 } @@ -22,6 +23,7 @@ public protocol NibLoadable: class { // 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 @@ -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 diff --git a/Sources/View/NibOwnerLoadable.swift b/Sources/View/NibOwnerLoadable.swift index 3cd1711..210ef9a 100644 --- a/Sources/View/NibOwnerLoadable.swift +++ b/Sources/View/NibOwnerLoadable.swift @@ -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 @@ -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. diff --git a/Sources/View/Reusable.swift b/Sources/View/Reusable.swift index 28f8e01..46afd56 100644 --- a/Sources/View/Reusable.swift +++ b/Sources/View/Reusable.swift @@ -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 } @@ -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 { diff --git a/Sources/View/UICollectionView+Reusable.swift b/Sources/View/UICollectionView+Reusable.swift index 318ce38..d5e69dc 100644 --- a/Sources/View/UICollectionView+Reusable.swift +++ b/Sources/View/UICollectionView+Reusable.swift @@ -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`) diff --git a/Sources/View/UITableView+Reusable.swift b/Sources/View/UITableView+Reusable.swift index fc36044..aa9616a 100644 --- a/Sources/View/UITableView+Reusable.swift +++ b/Sources/View/UITableView+Reusable.swift @@ -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`)