-
Notifications
You must be signed in to change notification settings - Fork 36
DEMO Unified Post Model #2499
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
base: dev
Are you sure you want to change the base?
DEMO Unified Post Model #2499
Conversation
Sjmarf
left a comment
There was a problem hiding this 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) |
There was a problem hiding this comment.
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
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:
Expected...Views (including things like configurable placeholders)UnifiedPostModeland update the viewsImplementation Notes
PostPropertiesThis 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.
ExpectedValueThis class handles the on-demand value fetching. It must be provided a function that, when called, populates the underlying
PostPropertieswith the relevant data.UnifiedPostModel.expectedValuemakes this somewhat more ergonomic.