R.swift: Deprecated: Use UINib .. instead

Created on 15 Nov 2018  路  7Comments  路  Source: mac-cain13/R.swift

Hello @mac-cain13 Ma
Version: 5.0.0.alpha.2
I got a lot of warning on my project like this

'MyCell' is deprecated: Use UINib(resource: R.nib.myCell) instead

Thank you so much.

Most helpful comment

The correct way to register a cell for reuse, as the documentation states, is: tableView.register(R.nib.myCell)

If you get the error Cannot invoke 'register' with an argument list of type '(_R.nib.myCell)', that means you haven't configured a reuseIdentifier in you nib.
I agree that this isn't a very useful error message from the Swift compiler. However, I'm not sure if we can do something about that.

See the documentation: https://github.com/mac-cain13/R.swift/blob/master/Documentation/Examples.md#reusable-table-view-cells

All 7 comments

You're welcome!

@mac-cain13: Can you update your code in the library to fixing this warning?

I think you should update your code according to the warning. Could you post the code you have in your project that gives this warning? You probably need to replace it with the suggested new initializer.

This is my code which always show warnning " 'myCell' is deprecated: Use UINib(resource: R.nib.myCell) instead":

 tbv.register(R.nib.myCell(), forCellReuseIdentifier: cellID)

Tks.

I try to use this but some cases not work:

  1. tbv.register(UINib(resource: R.nib. myCell), forCellReuseIdentifier: cellID) => no warnning and work as well
  2. tbv.register(R.nib.myCell(), forCellReuseIdentifier: cellID) => get warnning
  3. Follow into Documentation : tbv.register(R.nib.myCell ) => error " Cannot invoke 'register' with an argument list of type '(_R.nib.myCell)'"

Tks.
@mac-cain13

+1

The correct way to register a cell for reuse, as the documentation states, is: tableView.register(R.nib.myCell)

If you get the error Cannot invoke 'register' with an argument list of type '(_R.nib.myCell)', that means you haven't configured a reuseIdentifier in you nib.
I agree that this isn't a very useful error message from the Swift compiler. However, I'm not sure if we can do something about that.

See the documentation: https://github.com/mac-cain13/R.swift/blob/master/Documentation/Examples.md#reusable-table-view-cells

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomlokhorst picture tomlokhorst  路  3Comments

Przemyslaw-Wosko picture Przemyslaw-Wosko  路  4Comments

darecki picture darecki  路  4Comments

vladimirvrabelml picture vladimirvrabelml  路  7Comments

romk1n picture romk1n  路  6Comments