-
Notifications
You must be signed in to change notification settings - Fork 8
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
[Setup] Add sample info view and row description #40
Conversation
WebView(htmlString: readmeHTML ?? errorHTML) | ||
.zIndex(informationMode == .readme ? 1 : 0) | ||
WebView(htmlString: codeHTML ?? errorHTML) | ||
.zIndex(informationMode == .code ? 1 : 0) |
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.
Would the opacity modifier be better? Also just to note, I decided to use a ZStack
as opposed to an if
block because the web view would reload when the picker changes, causing the scroll position to be lost. A minor issue, but personally I would prefer it to be kept.
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.
I'm a bit shocked to see actually the webview scroll position doesn't change in README view when I switch between different source code files. 🤔 Can you confirm that?
demo.mp4
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.
I think this makes sense. I also tried it out when adding the picker and experienced the same behavior. The web view for the README is a separate WebView
instance and only its opacity is being changed when the information mode changes. When the picker changes the selected code file, the codeHTML
changes, updating the web view presenting the code HTML. The README's HTML doesn't change, so its web view doesn't update and its scroll position is saved--it's just "hidden" with zero opacity.
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.
Haven't finished reviewing yet, some preliminary comments.
ref: Some info can be found in Esri/arcgis-runtime-samples-ios#899
Removes duplicate `Assets.xcassets` copy.
if isShowingDescription { | ||
Text(sample.description) | ||
.font(.caption) | ||
.foregroundColor(.secondary) | ||
.transition(.move(edge: .top).combined(with: .opacity)) | ||
} |
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.
I think this is Apple's intended way. If the Photos app is opened on iPad vertical with no photos inside, it will show a similar blank screen. Tapping the upper left corner reveals the sidebar. |
Interesting point. I can see how it can be interpreted that way, but does that hold true if Photos are added? In the case of this app, a user won't ever add samples, will they? I think either is fine and it's your call in the end.. just wanted to note it down. |
That's a good point. I'll jot down a card in this repo to show the sidebar by default, and later on poll what others think. 👍 Also, with iOS 16 introduction of |
a warning to investigate2023-03-21 19:05:42.953131-0600 Samples[16092:6402401] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}> |
Description
This PR adds an information view for a sample and a toggle to view the sample's description in the samples list. Within the information view, the user can toggles between the sample's README and source code.
Linked Issue(s)
common-samples/issues/3704
How To Test
Screenshots
Screenshots
To Discuss
When device appearance (light/dark) changes while viewing a sample's code, the colors only change within the current viewport. There is a line that is still in the old color scheme. This shouldn't be a huge issue, but as a workaround, I could change it so that when the color scheme changes, it loads a different CSS file. Currently, there is one CSS file and uses
@media (prefers-color-scheme: dark)
. This would reload cause the HTML to reload and the current scroll position of the web view would not be saved.