Conversation
(cherry picked from commit d4d14bf)
|
Colors would be nice, also in the sidebar. I think we include monochromatic / color icon toggle as a setting to be applied to icons in the sidebar and breadcrumb bar. I will create an issue. Don't worry about that in this PR. |
|
@austincondiff the last todo of this PR (navigating using the breadcrumbs) will be added later - still have to figure out a lot of things in this regard. I would merge this as is for now. |
|
@MarcoCarnevali please review 😊 |
|
|
||
| var title: String | ||
| var image: String | ||
| var color: Color |
There was a problem hiding this comment.
are these (title,image,color) values going to change? Should these be public accessibles?
If not I would set those as privates and change it to let
There was a problem hiding this comment.
I'll change them to let
There was a problem hiding this comment.
and they're private now
| struct BreadcrumbsView: View { | ||
|
|
||
| @ObservedObject var workspace: WorkspaceDocument | ||
| var file: WorkspaceClient.FileItem |
There was a problem hiding this comment.
I think the file could just be a let?
|
|
||
| private func fileInfo() { | ||
| guard let projName = workspace.workspaceClient?.folderURL()?.lastPathComponent else { return } | ||
| var components = file.url.pathComponents.split(separator: projName).last! |
There was a problem hiding this comment.
we should try to avoid force casts... I think we can just put this inside the guard so we don't have to force it
There was a problem hiding this comment.
like
guard let projName = workspace.workspaceClient?.folderURL()?.lastPathComponent,
let components = file.url.pathComponents.split(separator: projName).last else { return }There was a problem hiding this comment.
yeah this should work great!
There was a problem hiding this comment.
let components will be changed to var components since it needs to be mutable.
|
|
||
| public struct WorkspaceClient { | ||
|
|
||
| public var folderURL: () -> URL? |
There was a problem hiding this comment.
honestly I wouldn't add this API. The folderURL is injected while initializing the client itself, so the consumer already has a reference of the directory somewhere
There was a problem hiding this comment.
Where is the question though. couldn't find a reference
There was a problem hiding this comment.
WorkspaceDocument is the class responsible to build the WorkspaceClient
There was a problem hiding this comment.
this means that WorkspaceDocument has a reference of the folderURL
There was a problem hiding this comment.
ok I added a reference var folderURL: URL? to WorkspaceDocument
| Divider() | ||
| } | ||
| .onAppear { | ||
| fileInfo() |
There was a problem hiding this comment.
Why you get fileInfo in onAppear instead of init?
There was a problem hiding this comment.
Because the @State seems to get initialized after .init() and so the names are blank
There was a problem hiding this comment.
All right. Just feel weird do that in onAppear, it means every time the window is active it'll be called.




This PR adds Breadcrumbs Navigation above the editor
This is still WIP. It already shows the right path but navigating is not yes supported.
Also colors would be nice I think
Make navigation possible by clicking on a path component (just like in Xcode)(saved for later, investigation ongoing)