Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetViewModel is not updated to SetContent when installed this library via Cocoapods #240

Open
headonn5 opened this issue Jun 5, 2023 · 2 comments

Comments

@headonn5
Copy link

headonn5 commented Jun 5, 2023

I am working with CalendarItemViewRepresentable file at the moment and I see that it has changed the view model to content in its latest implementation. But when I update my HorizonCalendar library via cocoapods, it is not updating my CalendarItemViewRepresentable.swift file.

For example, the new method in this file should look like this

static func setContent(_ content: Content, on view: ViewType)

However, the fetched library via cocoapods still contain the following old method that was replaced with the above method a few months ago in the library

static func setViewModel(_ viewModel: ViewModel, on view: ViewType)

Here is the commit diff:
https://github.com/airbnb/HorizonCalendar/pull/208/files#diff-5beecc162f31533c7d3e0dfcf9a58f5ba2694ab91cf1254a62a38789b9d95e6e

Moreover, this is not restricted to just this file, but throughout the code, I don't see setViewModel being converted to setContent. Please let me know if I missed anything or it indeed is an issue.

@headonn5 headonn5 changed the title CalendarItemViewRepresentable is not updated when installed via Cocoapods SetViewModel is not updated to SetContent when installed this library via Cocoapods Jun 5, 2023
@joaquin102
Copy link

I was facing the same issue along with other multiple issues with protocols and delegates. I installed the swift package manager version and problem solved. Unfortunately that's the only solution.

@nickdnk
Copy link

nickdnk commented Oct 12, 2023

The examples also are not updated, so I just spent a good half hour trying to figure out why the example didn't compile at all.

It still looks like this:

struct DayLabel: CalendarItemViewRepresentable {

  /// Properties that are set once when we initialize the view.
  struct InvariantViewProperties: Hashable {
    let font: UIFont
    let textColor: UIColor
    let backgroundColor: UIColor
  }

  /// Properties that will vary depending on the particular date being displayed.
  struct Content: Equatable {
    let day: Day
  }

  static func makeView(
    withInvariantViewProperties invariantViewProperties: InvariantViewProperties)
    -> UILabel
  {
    let label = UILabel()

    label.backgroundColor = invariantViewProperties.backgroundColor
    label.font = invariantViewProperties.font
    label.textColor = invariantViewProperties.textColor

    label.textAlignment = .center
    label.clipsToBounds = true
    label.layer.cornerRadius = 12
    
    return label
  }

  static func setContent(_ content: Content, on view: UILabel) {
    view.text = "\(content.day.day)"
  }

}

Just FYI. I don't have time to PR changes at the moment.

Edit: Okay I just re-read the problem. It seems my version of the library is outdated, not the documentation. I just installed it via SPM and it claims to be version 1.16, so I'm not really sure what's going on. I've never installed it via cocoapods and I've never had another version.

Edit: I just downloaded 1.16 directly from the tags, and it also has static func setViewModel(_ viewModel: ViewModel, on view: ViewType) - so something is definitely not right with the examples. I'm not sure if the "new" method is supposed to be for version 2.0? If so, perhaps having the master branch display an unreleased version and examples is not a great idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants