GithubHelp home page GithubHelp logo

Usage with Xib about functionaltabledata HOT 4 CLOSED

shopify avatar shopify commented on May 1, 2024
Usage with Xib

from functionaltabledata.

Comments (4)

dfairaizl avatar dfairaizl commented on May 1, 2024 1

Ah yep that did the trick - it all makes sense now :-) Any interest in having this documented somewhere? I know its technically out of scope of this project but I imagine this is a common thing.

from functionaltabledata.

raulriera avatar raulriera commented on May 1, 2024

Hey Dan,

A HostCell's view is at the end of a the a UIView itself, you could create a UIView that loads the xib file containing your code into it

Hope that helps, if not let us know

from functionaltabledata.

dfairaizl avatar dfairaizl commented on May 1, 2024

Hi Raul,

Thanks for getting back to me so fast. I can get it working with something like the following but that still has some issues.

let section = TableSection(key: "section-1", rows: [
    DetailCellType(key: "row-1", state: item) { (view, state) in
        let cell: ItemListingDetails = .fromNib()
        view.addSubview(cell)
        
       // constraint stuff
        
        cell.configure(with: state)
    }
] as [CellConfigType])

tableData.renderAndDiff([section])

This is naive but it immediately causes problems like needing to not re-add the nib loaded view to the cell view when the state changes etc.

If you know of another direction please let me know!

from functionaltabledata.

raulriera avatar raulriera commented on May 1, 2024

Hi,

I was thinking something more in the line of

class ContainerView: UIView {
  init() {
     .. load your nib and add it as a subView
  }
}

And then use the ContainerView in your HostCells. You are correct about the problem in the previous message, the cellUpdater { (view, state) in is only meant for changing the properties using the state, not to add or remove anything from the view itself :)

from functionaltabledata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.