Skip to content

Releases: AliSoftware/Reusable

Swift 3 support!

14 Nov 17:20
Compare
Choose a tag to compare
  • Converted library and Demo project to Swift 3.
    ⚠️ BREAKING CHANGES ⚠️ The following methods have new signatures:
    • dequeueReusableCell(indexPath:) is now dequeueReusableCell(for:)
    • dequeueReusableCell(indexPath:cellType:) is now dequeueReusableCell(for:cellType:)
    • registerReusableCell(_:) is now register(cellType:)
    • registerReusableHeaderFooterView(_:) is now register(headerFooterViewType:)
    • registerReusableSupplementaryView(_:viewType:) is now register(supplementaryViewType:ofKind:)
    • dequeueReusableSupplementaryView(_:indexPath:viewType:) is now dequeueReusableSupplementaryView(ofKind:for:viewType:)
      @phatblat
      #30
      @ceyhuno
      #31

Swift 2.3 support

06 Nov 20:33
Compare
Choose a tag to compare

2.5.0

12 Oct 18:21
Compare
Choose a tag to compare
  • Added the possibility for NibOwnerLoadable confirming custom views to pass an existing instance as owner
    (used as the File's Owner) in case one already exists. This is especially useful to implement init(coder:)
    to load the content of the XIB as subviews of self after initialization. See MyCustomWidget.swift for an example.
    @AliSoftware

2.4.0

12 Oct 18:21
Compare
Choose a tag to compare
  • Added StoryboardBased and StoryboardSceneBased protocols for storyboard based UIViewController easy instantiation.
    @AliSoftware

NibOwnerLoadable

02 Jun 21:50
Compare
Choose a tag to compare
  • Added NibOwnerLoadable protocol for UIView set as XIB's File's Owner.
    @PoissonBallon, #16

While the NibLoadable protocol is adapted to views loaded from XIB but that are set as the root view of the XIB,
this new NibOwnerLoadable protocol is adapted to view loaded from XIB too, but that are set as the XIB's File's Owner.

2.2.1

01 Mar 21:31
Compare
Choose a tag to compare
  • Fixed issue with register… methods registering the superclass T instead of the dynamic class cellType / viewType.
    @narirou, #13

2.2.0

01 Mar 21:31
Compare
Choose a tag to compare
  • Added optional viewType & cellType parameters to the dequeue functions.
    @k3zi, #11

This parameter is only needed if you can't write … as MyCell (to let Swift infer the cell type from the return type),
which might be the case for example when your cell class is stored in a variable:

let cellType: Any.Type = self.cellTypeForIndexPath(indexPath)
// Can't do this in this case (because cellType is a variable):
let cell = tableView.dequeueReusableCell(indexPath: indexPath) as cellType  // compiler error
// But now we can use that alternate way for such cases:
let cell = tableView.dequeueReusableCell(indexPath: indexPath, cellType: cellType)

But if you know the type at compile time, you can omit the cellType parameter and still do this, letting the return type infer it for you:

let cell = tableView.dequeueReusableCell(indexPath: indexPath) as MyCell

2.1.1

01 Mar 21:30
Compare
Choose a tag to compare
  • Made every method final to allow more optimizations.
    @AliSoftware
  • Banned the use of as! in the source code in favour of guard let x = y else { fatalError(…) }.
    This avoids force-casts (which are considered bad practice) and generate a more explicit fatal error in case the developer forgot something (typically forgot to set the reuseIdentifier in IB).
    @AliSoftware, #6
  • Fixed bundle location of nibs. By default, nib: UINib of NibLoadable protocol will now use the nib located in the bundle of the conforming class.
    @chrisamanse, #10
  • Fixed issue with subclasses of types conforming to Reusable — due to the Swift bug SR-617.
    @chrisamanse, #2

2.1.0

01 Feb 10:15
Compare
Choose a tag to compare
  • Added support for direct instantiation of arbitrary UIView from a nib.
    @jakubvano, #5

There is now a dedicated NibLoadable protocol which can be used on any arbitrary UIView (even non-"reusable" views) to load it from a XIB (via the loadFromNib() function injected via the protocol extension).

The NibReusable protocol still exists for reusable cells but is now declared just as a combination of both the Reusable and NibLoadable protocols.

Add missing public visibility

01 Feb 10:15
Compare
Choose a tag to compare
  • Fixed missing public visibility for the protocols and extensions
  • Improved README documentation