mirror of
https://github.com/yattee/yattee.git
synced 2025-04-28 16:00:33 +05:30
iOS click on collapsed chapters expands the view
This commit is contained in:
parent
b0d81cdefd
commit
a7baaeb485
@ -47,16 +47,28 @@ struct ChaptersView: View {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if !chapters.isEmpty {
|
} else if !chapters.isEmpty {
|
||||||
|
#if os(iOS)
|
||||||
|
Button(action: {
|
||||||
|
self.expand.toggle() // Use your expanding logic here
|
||||||
|
}) {
|
||||||
|
contents
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
contents
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var contents: some View {
|
||||||
Section {
|
Section {
|
||||||
ChapterView(chapter: chapters[0])
|
ForEach(chapters.prefix(3).indices, id: \.self) { index in
|
||||||
if chapters.count > 1 {
|
ChapterView(chapter: chapters[index])
|
||||||
ChapterView(chapter: chapters[1])
|
.allowsHitTesting(expand)
|
||||||
.opacity(0.3)
|
.opacity(index == 0 ? 1.0 : 0.3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ChaptersView_Previews: PreviewProvider {
|
struct ChaptersView_Previews: PreviewProvider {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user