Skip to content

Conversation

@EricBAndrews
Copy link
Member

@EricBAndrews EricBAndrews commented Dec 23, 2025

Initial proof-of-concept for updated post models. Model tier is completely removed and values are fetched when requested if not available.

This demo replaces the normal expanded post with a simple view driven by the new post model. There is currently by design no caching so that all the values must be fetched, illustrating the on-demand fetching operation.

Outstanding work, roughly in order:

  • Flesh out Expected...Views (including things like configurable placeholders)
  • Replace current post models with UnifiedPostModel and update the views

Implementation Notes

PostProperties
This struct holds all the actual properties, all of which are now optional. Properties which were already optional are now double optionals, where nil/nil indicates the value is not resolved and present/nil indicates the value resolved to nil. Double optionals are somewhat awkward, but I believe the most canonical way to represent unresolved nullables.

ExpectedValue
This class handles the on-demand value fetching. It must be provided a function that, when called, populates the underlying PostProperties with the relevant data. UnifiedPostModel.expectedValue makes this somewhat more ergonomic.

Copy link
Member

@Sjmarf Sjmarf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 😄 This'll be much better than what we have now 👀

.transition(.scale)
} else {
MockTextView()
.frame(height: font.leadingHeight)
Copy link
Member

@Sjmarf Sjmarf Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is a permanent view we'll need some sort of @ScaledMetric in here to account for dynamic type.

Another option might be to use redacted(reason: ) (Docs) on some placeholder text. I've not used that API before, though, so don't know how it looks.

Yet another solution would be to .overlay some placeholder text with a rectangle

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

Successfully merging this pull request may close these issues.

3 participants