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

SwiftUI Navigator #332

Open
wants to merge 1 commit into
base: swiftui-navigator
Choose a base branch
from

Conversation

akaDuality
Copy link
Collaborator

No description provided.

Comment on lines +4 to +8
struct HierarchicalElement: Identifiable { //Structure creating element (similarity of a binary tree node)
var element: any ArtboardElement
var indentationLevel: Int
var isParent: Bool
var id: UUID { element.id }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Нам бы вот этот интерфейс натянуть прямо на объект, свойства сделать вычисляемыми. Тогда получится что при перетаскивании мы можем влиять на сам фрейм и его обновление будет обновляться и в других частях.

Comment on lines +26 to +33
HStack {
Image(systemName: element.isParent ? "folder" : "doc") // Images for creating hiererchy folders
.onTapGesture {
element.isParent.toggle()
}
Text(element.element.label)
}
.padding(.leading, CGFloat(element.indentationLevel * 20))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Это стоит вынести в отдельную вью

HStack {
Image(systemName: element.isParent ? "folder" : "doc") // Images for creating hiererchy folders
.onTapGesture {
element.isParent.toggle()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

По тапу необычно, но я думаю, что так не надо. Лучше при редактировании списка дать выделять несколько компонентов, а в тулбаре показывать кнопку group, так поведение будет более системным, а значит и предсказуемым

Comment on lines +45 to +49
func move(from source: IndexSet, to destination: Int) {
hierarchicalElements.move(fromOffsets: source, toOffset: destination)

updateIndentationLevels()
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Само перемещение хорошо работает, но тут лучше вызывать метод перезентера, чтобы он внутри фрейма данные переставлял

Comment on lines +56 to +60
if isPreviousElementParent {
currentIndentationLevel += 1
} else {
currentIndentationLevel = 0
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Вот эта логика в презентере уже есть

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.

1 participant